linux-kernel.vger.kernel.org archive mirror
 help / color / mirror / Atom feed
From: Greg KH <gregkh@linuxfoundation.org>
To: Qiao Yanbo <qiaoyanbo_310@163.com>
Cc: rafael@kernel.org, linux-kernel@vger.kernel.org
Subject: Re: [PATCH] kobject: kobject_add_internal cleanup
Date: Wed, 28 Jul 2021 12:10:46 +0200	[thread overview]
Message-ID: <YQEtJkPFDWMSAd/C@kroah.com> (raw)
In-Reply-To: <20210727143212.39142-1-qiaoyanbo_310@163.com>

On Tue, Jul 27, 2021 at 10:32:12PM +0800, Qiao Yanbo wrote:
> From: qiaoyanbo <qiaoyanbo_310@163.com>

This does not match your "From:" line in your email address, please use
your real name here and in your signed-off-by line like your email
shows.

> 
> parent assignment in "if" block only need to consider when parent is NULL.

I do not understand, why is this needed?  What does this fix?

> 
> Signed-off-by: qiaoyanbo <qiaoyanbo_310@163.com>
> ---
>  lib/kobject.c | 5 +++--
>  1 file changed, 3 insertions(+), 2 deletions(-)
> 
> diff --git a/lib/kobject.c b/lib/kobject.c
> index ea53b30cf..d1f4b3411 100644
> --- a/lib/kobject.c
> +++ b/lib/kobject.c
> @@ -241,10 +241,11 @@ static int kobject_add_internal(struct kobject *kobj)
>  
>  	/* join kset if set, use it as parent if we do not already have one */
>  	if (kobj->kset) {
> -		if (!parent)
> +		if (!parent) {
>  			parent = kobject_get(&kobj->kset->kobj);
> +			kobj->parent = parent;
> +		}
>  		kobj_kset_join(kobj);
> -		kobj->parent = parent;

I think this might break code as well, did you test this?  What about
the root kobjects with no parent, you still need to set that, right?

What problem does this solve that you have run into?

thanks,

greg k-h

  reply	other threads:[~2021-07-28 10:10 UTC|newest]

Thread overview: 6+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2021-07-27 14:32 [PATCH] kobject: kobject_add_internal cleanup Qiao Yanbo
2021-07-28 10:10 ` Greg KH [this message]
     [not found]   ` <3be7ce57.62f6.17af280a47f.Coremail.qiaoyanbo_310@163.com>
2021-07-29 13:59     ` Greg KH
     [not found]       ` <54cc7e43.808a.17af32725d9.Coremail.qiaoyanbo_310@163.com>
2021-07-30  4:48         ` Greg KH
2021-07-30 12:47           ` qiaoyanbo_310
2021-07-30 13:37             ` Greg KH

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=YQEtJkPFDWMSAd/C@kroah.com \
    --to=gregkh@linuxfoundation.org \
    --cc=linux-kernel@vger.kernel.org \
    --cc=qiaoyanbo_310@163.com \
    --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).