[<prev] [next>] [<thread-prev] [thread-next>] [day] [month] [year] [list]
Message-ID: <CANq1E4TcjmcPbj2GvgUcXA7_+AaevbMTC6+2CsbrugJjjC755A@mail.gmail.com>
Date: Sun, 8 Dec 2013 15:42:33 +0100
From: David Herrmann <dh.herrmann@...il.com>
To: linux-kernel <linux-kernel@...r.kernel.org>
Cc: Greg Kroah-Hartman <gregkh@...uxfoundation.org>,
David Herrmann <dh.herrmann@...il.com>
Subject: Re: [PATCH] driver core: fix device_create() error path
Hi Greg
Ping?
Thanks
David
On Thu, Nov 21, 2013 at 8:15 PM, David Herrmann <dh.herrmann@...il.com> wrote:
> We call put_device() in the error path, which is fine for dev==NULL.
> However, in case kobject_set_name_vargs() fails, we have dev!=NULL but
> device_initialized() wasn't called, yet.
>
> Fix this by splitting device_register() into explicit calls to
> device_add() and an early call to device_initialize().
>
> Signed-off-by: David Herrmann <dh.herrmann@...il.com>
> ---
> drivers/base/core.c | 3 ++-
> 1 file changed, 2 insertions(+), 1 deletion(-)
>
> diff --git a/drivers/base/core.c b/drivers/base/core.c
> index 34abf4d..4be8911 100644
> --- a/drivers/base/core.c
> +++ b/drivers/base/core.c
> @@ -1676,6 +1676,7 @@ device_create_groups_vargs(struct class *class, struct device *parent,
> goto error;
> }
>
> + device_initialize(dev);
> dev->devt = devt;
> dev->class = class;
> dev->parent = parent;
> @@ -1687,7 +1688,7 @@ device_create_groups_vargs(struct class *class, struct device *parent,
> if (retval)
> goto error;
>
> - retval = device_register(dev);
> + retval = device_add(dev);
> if (retval)
> goto error;
>
> --
> 1.8.4.2
>
--
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