[<prev] [next>] [<thread-prev] [day] [month] [year] [list]
Message-ID: <5AACE1F0.1080109@gmail.com>
Date: Sat, 17 Mar 2018 15:07:52 +0530
From: arvindY <arvind.yadav.cs@...il.com>
To: Chris Leech <cleech@...hat.com>, lduncan@...e.com,
jejb@...ux.vnet.ibm.com, martin.petersen@...cle.com,
linux-kernel@...r.kernel.org, open-iscsi@...glegroups.com,
linux-scsi@...r.kernel.org
Subject: Re: [PATCH] scsi: scsi_transport_iscsi: use put_device() instead of
kfree()
On Thursday 15 March 2018 11:14 PM, Chris Leech wrote:
> On Wed, Mar 07, 2018 at 05:07:33PM +0530, 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 <arvind.yadav.cs@...il.com>
>> ---
>> drivers/scsi/scsi_transport_iscsi.c | 27 +++++++++++++--------------
>> 1 file changed, 13 insertions(+), 14 deletions(-)
>>
>> @@ -783,7 +781,7 @@ struct iscsi_iface *
>>
>> free_iface:
>> put_device(iface->dev.parent);
>> - kfree(iface);
>> + put_device(&iface->dev);
>> return NULL;
>> }
>> EXPORT_SYMBOL_GPL(iscsi_create_iface);
> Am I reading the device code correctly that the parent reference is only
> released in the unregister path (device_unregister calls device_del) and
> so the manual put_device on the parent here is still correct?
>
> Just want to make sure that's still needed with the call to put_device.
The manual put_device on the parent is not correct.
This should be removed for here. we should call
put_device(&iface->dev) only and It'll released
parent reference.
> Other than that question, I this all looks good.
> Thanks.
>
> Signed-off-by: Chris Leech <cleech@...hat.com>
>
~arvind
Powered by blists - more mailing lists