linux-kernel.vger.kernel.org archive mirror
 help / color / mirror / Atom feed
From: Greg KH <gregkh@linuxfoundation.org>
To: qiaoyanbo_310 <qiaoyanbo_310@163.com>
Cc: rafael@kernel.org, linux-kernel@vger.kernel.org
Subject: Re: Re: [PATCH] kobject: kobject_add_internal cleanup
Date: Thu, 29 Jul 2021 15:59:02 +0200	[thread overview]
Message-ID: <YQK0JuI1w1zsEHeC@kroah.com> (raw)
In-Reply-To: <3be7ce57.62f6.17af280a47f.Coremail.qiaoyanbo_310@163.com>

A: http://en.wikipedia.org/wiki/Top_post
Q: Were do I find info about this thing called top-posting?
A: Because it messes up the order in which people normally read text.
Q: Why is top-posting such a bad thing?
A: Top-posting.
Q: What is the most annoying thing in e-mail?

A: No.
Q: Should I include quotations after my reply?

http://daringfireball.net/2007/07/on_top

On Thu, Jul 29, 2021 at 09:42:34PM +0800, qiaoyanbo_310 wrote:
> Hi Greg k-h,
> 
> 
> First at all, there is my mistake about From line different with Sign off line. They all should be "Qiao Yanbo".

Great, please fix that up.

> Secondly, the problem this patch wants to solve is: In this function, the parent variable is first called "kobject_get (kobj->parent) " assignment. When the parent is not null, the just obtained parent is assigned back to "kobj - > parent", which is meaningless. Actually, "kobj->kset->kobj" will be assigned to "kobj->parent" only when the parent is NULL. So this patch solves the problem of meaningless assignment.

Why is this a problem?  What bug is this solving?  Is the code somehow
now faster or smaller that can be measured?

> Finally , I tested this patch and didn't see any additional problems in my environment.
> 
> 
> Here is the original code snippet. I hope you can understand my idea.
> ======================================================= 
>        parent = kobject_get(kobj->parent);
> 
> 
>         /* join kset if set, use it as parent if we do not already have one */
>         if (kobj->kset) {
>                 if (!parent)
>                         parent = kobject_get(&kobj->kset->kobj);
>                 kobj_kset_join(kobj);
>                 kobj->parent = parent;

I do not see a bug with this code, what is wrong with it?

thanks,

greg k-h

  parent reply	other threads:[~2021-07-29 14:08 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
     [not found]   ` <3be7ce57.62f6.17af280a47f.Coremail.qiaoyanbo_310@163.com>
2021-07-29 13:59     ` Greg KH [this message]
     [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=YQK0JuI1w1zsEHeC@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).