[<prev] [next>] [<thread-prev] [day] [month] [year] [list]
Message-ID: <YQEtJkPFDWMSAd/C@kroah.com>
Date: Wed, 28 Jul 2021 12:10:46 +0200
From: Greg KH <gregkh@...uxfoundation.org>
To: Qiao Yanbo <qiaoyanbo_310@....com>
Cc: rafael@...nel.org, linux-kernel@...r.kernel.org
Subject: Re: [PATCH] kobject: kobject_add_internal cleanup
On Tue, Jul 27, 2021 at 10:32:12PM +0800, Qiao Yanbo wrote:
> From: qiaoyanbo <qiaoyanbo_310@....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@....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
Powered by blists - more mailing lists