[<prev] [next>] [<thread-prev] [thread-next>] [day] [month] [year] [list]
Message-ID: <52B313D8.6090508@linux.com>
Date: Thu, 19 Dec 2013 16:42:16 +0100
From: Levente Kurusa <levex@...ux.com>
To: Tejun Heo <tj@...nel.org>
CC: LKML <linux-kernel@...r.kernel.org>,
Greg KH <gregkh@...uxfoundation.org>
Subject: Re: [PATCH 21/38] workqueue: add missing put_device call
[+Cc Greg]
On 12/19/2013 04:34 PM, Tejun Heo wrote:
> Hello,
>
> On Thu, Dec 19, 2013 at 10:31 AM, Levente Kurusa <levex@...ux.com> wrote:
>> The reason I removed the kfree() was because the put_device() will decrement
>> wq_dev->dev's reference count to zero (it is set to one by device_register) and hence the
>> wq_device_release() will be called. Now, this effectively does the same the kfree() call
>> would have done but also driver core is notified.
>
> Yeah, I know it does the same thing. It's just not the right way to do it.
>
>> Also, if you take a look at the comment for the device_register() function, it explicitly
>> says NOT to kfree the struct device, but instead call put_device() and let the device's release()
>> function take care.
>
> Greg, the API as described by the comment is really weird and
> unconventional. Failed calls are not supposed to have side effects
> which require explicit cleanup. Can we please update the comment?
>
Yes, it was already discussed that it would be more sane to have
device_register() call put_device() if it would fail, but Greg
said that the API was designed so that no kfree()s happen in the core.
--
Regards,
Levente Kurusa
--
To unsubscribe from this list: send the line "unsubscribe linux-kernel" in
the body of a message to majordomo@...r.kernel.org
More majordomo info at http://vger.kernel.org/majordomo-info.html
Please read the FAQ at http://www.tux.org/lkml/
Powered by blists - more mailing lists