[<prev] [next>] [<thread-prev] [thread-next>] [day] [month] [year] [list]
Message-ID: <CAOS58YPnh40gdZFJ_8H2-ZnHxibQNW387ivtubH4p8G-h5QCtw@mail.gmail.com>
Date: Thu, 19 Dec 2013 10:45:21 -0500
From: Tejun Heo <tj@...nel.org>
To: Levente Kurusa <levex@...ux.com>
Cc: LKML <linux-kernel@...r.kernel.org>,
Greg KH <gregkh@...uxfoundation.org>
Subject: Re: [PATCH 21/38] workqueue: add missing put_device call
On Thu, Dec 19, 2013 at 10:42 AM, Levente Kurusa <levex@...ux.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
--
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