From: Greg Kroah-Hartman <gregkh@linuxfoundation.org>
To: poeschel@lemonage.de
Cc: "Rafael J. Wysocki" <rafael@kernel.org>,
open list <linux-kernel@vger.kernel.org>
Subject: Re: [PATCH] driver core: Remove double assignment
Date: Tue, 29 Sep 2020 14:25:33 +0200 [thread overview]
Message-ID: <20200929122533.GA1193271@kroah.com> (raw)
In-Reply-To: <20200929115808.2815382-1-poeschel@lemonage.de>
On Tue, Sep 29, 2020 at 01:58:08PM +0200, poeschel@lemonage.de wrote:
> From: Lars Poeschel <poeschel@lemonage.de>
>
> This removes an assignment in device_add. It assigned the parent
> kobject to the kobject of the new device. This is not necessary,
> because the call to kobject_add a few lines later also does this same
> assignment.
>
> Signed-off-by: Lars Poeschel <poeschel@lemonage.de>
> ---
> drivers/base/core.c | 4 +---
> 1 file changed, 1 insertion(+), 3 deletions(-)
>
> diff --git a/drivers/base/core.c b/drivers/base/core.c
> index bb5806a2bd4c..03b5396cd192 100644
> --- a/drivers/base/core.c
> +++ b/drivers/base/core.c
> @@ -2847,8 +2847,6 @@ int device_add(struct device *dev)
> error = PTR_ERR(kobj);
> goto parent_error;
> }
> - if (kobj)
> - dev->kobj.parent = kobj;
>
> /* use parent numa_node */
> if (parent && (dev_to_node(dev) == NUMA_NO_NODE))
> @@ -2856,7 +2854,7 @@ int device_add(struct device *dev)
>
> /* first, register with generic layer. */
> /* we require the name to be set before, and pass NULL */
> - error = kobject_add(&dev->kobj, dev->kobj.parent, NULL);
> + error = kobject_add(&dev->kobj, kobj, NULL);
That's very subtle, and might not really be correct for all users, have
you checked?
Anyway, I'd rather leave this as-is if possible, as we know this works
correctly, and it is not going to save any time/energy to remove that
assignment, right?
thanks,
greg k-h
next prev parent reply other threads:[~2020-09-29 12:25 UTC|newest]
Thread overview: 4+ messages / expand[flat|nested] mbox.gz Atom feed top
2020-09-29 11:58 [PATCH] driver core: Remove double assignment poeschel
2020-09-29 12:25 ` Greg Kroah-Hartman [this message]
2020-09-29 13:14 ` Lars Poeschel
2020-10-02 7:52 ` [driver core] 9c28a17954: WARNING:at_kernel/events/core.c:#perf_event_sysfs_init kernel test robot
Reply instructions:
You may reply publicly to this message via plain-text email
using any one of the following methods:
* Save the following mbox file, import it into your mail client,
and reply-to-all from there: mbox
Avoid top-posting and favor interleaved quoting:
https://en.wikipedia.org/wiki/Posting_style#Interleaved_style
* Reply using the --to, --cc, and --in-reply-to
switches of git-send-email(1):
git send-email \
--in-reply-to=20200929122533.GA1193271@kroah.com \
--to=gregkh@linuxfoundation.org \
--cc=linux-kernel@vger.kernel.org \
--cc=poeschel@lemonage.de \
--cc=rafael@kernel.org \
/path/to/YOUR_REPLY
https://kernel.org/pub/software/scm/git/docs/git-send-email.html
* If your mail client supports setting the In-Reply-To header
via mailto: links, try the mailto: link
Be sure your reply has a Subject: header at the top and a blank line
before the message body.
This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox;
as well as URLs for NNTP newsgroup(s).