Received: by 10.223.185.111 with SMTP id b44csp142626wrg; Fri, 9 Mar 2018 02:35:32 -0800 (PST) X-Google-Smtp-Source: AG47ELuNht0x65QkDiFIlw8sEsKBKuEo+J2WT0QXjx65LzQ4VuGp0dHniOJl9MlR+ezR3MxoUEVG X-Received: by 10.99.171.10 with SMTP id p10mr23670241pgf.176.1520591731951; Fri, 09 Mar 2018 02:35:31 -0800 (PST) ARC-Seal: i=1; a=rsa-sha256; t=1520591731; cv=none; d=google.com; s=arc-20160816; b=CvGqOAEnGMsw/hkbXxEG+XUQcUsJ4zIjEU/5bf5++Lc75zwQ/WCSwjezaLay0mEDag VqYxDIQXsgjTLFi01/63BI1GbCtFxaKjos3S/uioJssP96nw2lrVC5gh435h6Le3ryW6 eTv8IeYdSspAl5ONZLdFPkfjEjFb/xjjCKVZPHQOApCzo9sJW0IBIrcZ0KuEC1O9g5OV 1+YxxUvePdnEvHDfD8G0lj8HCApwBV9m2/UtwUij4dUAoqN2Mg+78zHJBGE79FYBfWdR XboZ98KhSb8YNMZvND5HpVyg5/FTsuEtM7EXna+LJ+Hsw7+wHQd4y4EjDT7GQEpQMe7b 5uAQ== ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=google.com; s=arc-20160816; h=list-id:precedence:sender:message-id:date:subject:cc:to:from :dkim-signature:arc-authentication-results; bh=qkCN6aqeQJtbHxVDaplk9i8u0YCSG+Ge0EJLRFTkmxk=; b=gqrUanU7O5d8o/ailLCC53J1fuOBrFWjeC/ufH395hHPVzCmCIOoAl+GYJMRj8ORE/ +FFjYjvLYwiqeFptNmkCLSAb3F8wDzQfPh1ousseNTtrfn+gkEtHQBrM2S+6lTx3BnWP d7UA8CpkGB8WYFfCrXyJ3fgSSgH/eDuo9tujT9OXR0hpJGH3PCJB9MCgjF0DnFw75M19 U9CebmjXXCGjT+uD8B23zOH9kL3gfsXDQkXrNZV8+KesQbNuUrCgrOU5oJLBLntD7R1X proKjIyEUq5zqkNnd85UW2FEL6uaVEgC/3TTdCzsBrKKc5HohApg8/L/90mbtsgBDEjF iAzA== ARC-Authentication-Results: i=1; mx.google.com; dkim=pass header.i=@gmail.com header.s=20161025 header.b=VT4++NVC; spf=pass (google.com: best guess record for domain of linux-kernel-owner@vger.kernel.org designates 209.132.180.67 as permitted sender) smtp.mailfrom=linux-kernel-owner@vger.kernel.org; dmarc=pass (p=NONE sp=QUARANTINE dis=NONE) header.from=gmail.com Return-Path: Received: from vger.kernel.org (vger.kernel.org. [209.132.180.67]) by mx.google.com with ESMTP id i23-v6si660482pll.579.2018.03.09.02.35.17; Fri, 09 Mar 2018 02:35:31 -0800 (PST) Received-SPF: pass (google.com: best guess record for domain of linux-kernel-owner@vger.kernel.org designates 209.132.180.67 as permitted sender) client-ip=209.132.180.67; Authentication-Results: mx.google.com; dkim=pass header.i=@gmail.com header.s=20161025 header.b=VT4++NVC; spf=pass (google.com: best guess record for domain of linux-kernel-owner@vger.kernel.org designates 209.132.180.67 as permitted sender) smtp.mailfrom=linux-kernel-owner@vger.kernel.org; dmarc=pass (p=NONE sp=QUARANTINE dis=NONE) header.from=gmail.com Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S1751188AbeCIKeT (ORCPT + 99 others); Fri, 9 Mar 2018 05:34:19 -0500 Received: from mail-io0-f193.google.com ([209.85.223.193]:39448 "EHLO mail-io0-f193.google.com" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S1751145AbeCIKeS (ORCPT ); Fri, 9 Mar 2018 05:34:18 -0500 Received: by mail-io0-f193.google.com with SMTP id b34so3069116ioj.6 for ; Fri, 09 Mar 2018 02:34:18 -0800 (PST) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=gmail.com; s=20161025; h=from:to:cc:subject:date:message-id; bh=qkCN6aqeQJtbHxVDaplk9i8u0YCSG+Ge0EJLRFTkmxk=; b=VT4++NVCeu5ddUnzLrFGdumzsXiu7lCeRgn8e8ewBcebXaW5ckz2xIgDHni45op/zz ihmOqwdLRKHm5j8nXu/6ugIRNS6dIydMkSSvqitC1VbRTyyVaA7R9kOgfAmdGTNgMtf2 5pt80kPUd/1xIOqAteRIiSym2O+ljYrItYongnvHYhim3kGgQ4CpbtCbFcQOJR7Rc0Wp /3m52KqSIphFzPsPGhtQqXp5QW+8FQLcDI01YDqMiDRNfIjGToouhESLHNIaUucXI2X+ Dm32GlhEY6XM/SZD/YQWmRSwKSY12rVnd9XLXCKDRbipYh6RuWkmS0OcOukTLyCv5zwI 4bOQ== X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20161025; h=x-gm-message-state:from:to:cc:subject:date:message-id; bh=qkCN6aqeQJtbHxVDaplk9i8u0YCSG+Ge0EJLRFTkmxk=; b=qy4nK+q4rnyuM5bzX4vO22lMLJhZohKy5GkWMIHqsDdSnQVw35+fhvCHT5pWqMME5g Ed9Qg5jP1VS3uObArbIf0+91tJW85ehPuekngjb3W/5P9ZzbOidvKqZYZMoaj9ZzF4Oz N2NlKCBZDm/YHHnhpj3Gv8IWdzr32mWmXTI3CVQs58sx4DxwAPjPcu4sMo7sOokVYVhv s7kh8cCoCsxO8SGLteq/hrgWldwA1rsg6f13Pgz6f2U/J9r84LJADZFwfEfDhDpWz1LY 5b0I0ciRLYh7FlRFotf2sAOB39zE33RD9Uol/06f6+vD7BipYHjhXoE4uNMO2nbUsEmZ fuLg== X-Gm-Message-State: AElRT7H+Rz3l+6LELiHvl9hEqNc7UHjsTfEZZS+RWLS7pI3T8Mki02Hk SppfHFE69KJjsAqrRoin6Zc= X-Received: by 10.107.34.80 with SMTP id i77mr1806929ioi.220.1520591657493; Fri, 09 Mar 2018 02:34:17 -0800 (PST) Received: from symbol-HP-Z420-Workstation.zebra.lan ([149.23.17.254]) by smtp.googlemail.com with ESMTPSA id b74sm628235itd.11.2018.03.09.02.34.14 (version=TLS1_2 cipher=ECDHE-RSA-AES128-SHA bits=128/128); Fri, 09 Mar 2018 02:34:16 -0800 (PST) From: Arvind Yadav To: jdmason@kudzu.us, dave.jiang@intel.com, allenbh@gmail.com Cc: linux-kernel@vger.kernel.org, linux-ntb@googlegroups.com Subject: [PATCH] ntb_transport: use put_device() instead of kfree() Date: Fri, 9 Mar 2018 16:03:24 +0530 Message-Id: <6717325ea580df9a0294db6f83fd72a5db3daad9.1520591515.git.arvind.yadav.cs@gmail.com> X-Mailer: git-send-email 1.9.1 Sender: linux-kernel-owner@vger.kernel.org Precedence: bulk List-ID: X-Mailing-List: linux-kernel@vger.kernel.org Never directly free @dev after calling device_register(), even if it returned an error! Always use put_device() to give up the reference initialized. Signed-off-by: Arvind Yadav --- drivers/ntb/ntb_transport.c | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/drivers/ntb/ntb_transport.c b/drivers/ntb/ntb_transport.c index 9878c48..8182a3a 100644 --- a/drivers/ntb/ntb_transport.c +++ b/drivers/ntb/ntb_transport.c @@ -393,7 +393,7 @@ int ntb_transport_register_client_dev(char *device_name) rc = device_register(dev); if (rc) { - kfree(client_dev); + put_device(dev); goto err; } -- 1.9.1