Re: [PATCH 21/38] workqueue: add missing put_device call

Tejun Heo
2013-12-19T15:45:25Z

On Thu, Dec 19, 2013 at 10:42 AM, Levente Kurusa <levex@linux.com> wrote:
>> 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.

Of course not. For the third time: A failed call shouldn't make
material changes which makes difference to its caller. An obj which
failed init should be destructible in the exact reverse operation that
the caller took to create it. This is a fundamental rule of any API
design. There sure are occasional exceptions but there's no reason to
deviate from that here.

Thanks.

--
tejun