Received: by 10.223.185.111 with SMTP id b44csp522093wrg; Fri, 9 Mar 2018 08:48:34 -0800 (PST) X-Google-Smtp-Source: AG47ELvtymCE6/TdYb9pfNEwbxKtMKHJHkKvZY4IgP6iIcB4HQiVh02Tmi8Dn1Imqg0uE6kTjQj/ X-Received: by 10.99.111.130 with SMTP id k124mr25621887pgc.236.1520614114297; Fri, 09 Mar 2018 08:48:34 -0800 (PST) ARC-Seal: i=1; a=rsa-sha256; t=1520614114; cv=none; d=google.com; s=arc-20160816; b=HzY4H+7+rg5Zj11RRnU0nu+TynYlRbcqLcpoo31/YtDNC5tAUjgJLbVunEwHfCXOmO THzw9FFkZYsM1h7fbRNOI6FcMWELD9YEJxhXS1b6VsWdeUJ8ZxGgptcJLrVw+eAj06K/ RhEHrvb7cTBH6CQ3YJ3ky7/6ee7S4a3fVCK6n5Mn125bVcs5/+6ote7lRNMvPLcsWZhs JE14Mt4oQxOt3gJfojmzNH5XcSave5dJmQbcOMnNBOZnYhzFkv3YOnB15h5THNBk3TZD c2jizJmz+bpN2GCVmn7FxtsTMTpwD7OanObD6yS0+fMafux/yYyOzVJ2XMLnZ0QELu4v C5OA== ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=google.com; s=arc-20160816; h=list-id:precedence:sender:subject:content-transfer-encoding :content-language:in-reply-to:mime-version:user-agent:date :message-id:from:references:cc:to:arc-authentication-results; bh=bJcaL8m1Wm/PH5nz1+TqTABoCApuUW4wh5DSBbbGzGQ=; b=Jgad+Lsd2NHN2hvEqIME6XGY3Y1fjxWT4cLgRxKEbuoJXLEVjJNy0mIFdUrQ1aGR7A oXlyCEEb2yYKQ8bFAEIt2aZpTLm10jlMFipczEehSlfxWiMshd2BVF+qK2fxuiTaDYTa 2BUYYs9HIfLT6/9BFOg13Z/K5XUPfMz4VwB1l/fG2UAnJshNFpxOwMiXlj8xgz3DFjBt /5nvXRMgovIq8xnsnvxWCNYxhrDwh9VCEU2TzEVb1HCzPEpV6JPEms3Hm/73LQMPnmAY DPbbBhXtz1WP3ubf2Ct6gyUtdpZcFAzxv/yZXqwmMhjMX7JjS2I+QNLJQy0POLgExc6d wWNA== ARC-Authentication-Results: i=1; mx.google.com; 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 Return-Path: Received: from vger.kernel.org (vger.kernel.org. [209.132.180.67]) by mx.google.com with ESMTP id u3si950406pgo.349.2018.03.09.08.48.19; Fri, 09 Mar 2018 08:48:34 -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; 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 Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S932072AbeCIQrG (ORCPT + 99 others); Fri, 9 Mar 2018 11:47:06 -0500 Received: from ale.deltatee.com ([207.54.116.67]:60812 "EHLO ale.deltatee.com" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S1751166AbeCIQrE (ORCPT ); Fri, 9 Mar 2018 11:47:04 -0500 Received: from guinness.priv.deltatee.com ([172.16.1.162]) by ale.deltatee.com with esmtp (Exim 4.89) (envelope-from ) id 1euLAa-0007bx-VJ; Fri, 09 Mar 2018 09:47:01 -0700 To: Arvind Yadav , jdmason@kudzu.us, dave.jiang@intel.com, allenbh@gmail.com Cc: linux-kernel@vger.kernel.org, linux-ntb@googlegroups.com References: <6717325ea580df9a0294db6f83fd72a5db3daad9.1520591515.git.arvind.yadav.cs@gmail.com> From: Logan Gunthorpe Message-ID: <81eaa48f-2d47-6e4e-9445-356930d974a3@deltatee.com> Date: Fri, 9 Mar 2018 09:46:54 -0700 User-Agent: Mozilla/5.0 (X11; Linux x86_64; rv:52.0) Gecko/20100101 Thunderbird/52.6.0 MIME-Version: 1.0 In-Reply-To: <6717325ea580df9a0294db6f83fd72a5db3daad9.1520591515.git.arvind.yadav.cs@gmail.com> Content-Type: text/plain; charset=utf-8; format=flowed Content-Language: en-US Content-Transfer-Encoding: 7bit X-SA-Exim-Connect-IP: 172.16.1.162 X-SA-Exim-Rcpt-To: linux-ntb@googlegroups.com, linux-kernel@vger.kernel.org, allenbh@gmail.com, dave.jiang@intel.com, jdmason@kudzu.us, arvind.yadav.cs@gmail.com X-SA-Exim-Mail-From: logang@deltatee.com X-Spam-Checker-Version: SpamAssassin 3.4.1 (2015-04-28) on ale.deltatee.com X-Spam-Level: X-Spam-Status: No, score=-8.7 required=5.0 tests=ALL_TRUSTED,BAYES_00, GREYLIST_ISWHITE,MYRULES_FREE,T_RP_MATCHES_RCVD autolearn=ham autolearn_force=no version=3.4.1 Subject: Re: [PATCH] ntb_transport: use put_device() instead of kfree() X-SA-Exim-Version: 4.2.1 (built Tue, 02 Aug 2016 21:08:31 +0000) X-SA-Exim-Scanned: Yes (on ale.deltatee.com) Sender: linux-kernel-owner@vger.kernel.org Precedence: bulk List-ID: X-Mailing-List: linux-kernel@vger.kernel.org Looks correct to me. Thanks! Reviewed-by: Logan Gunthorpe On 09/03/18 03:33 AM, Arvind Yadav wrote: > 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; > } > >