All of lore.kernel.org
 help / color / mirror / Atom feed
From: Chen Gang <gang.chen@asianux.com>
To: Chen Gang F T <chen.gang.flying.transformer@gmail.com>
Cc: Rusty Russell <rusty@rustcorp.com.au>,
	khali@linux-fr.org, David.Woodhouse@intel.com,
	"linux-kernel@vger.kernel.org" <linux-kernel@vger.kernel.org>
Subject: Re: [PATCH] kernel/params.c: print failure information instead of 'KOBJ_ADD' to user space, when sysfs_create_file() fails.
Date: Fri, 12 Jul 2013 07:45:21 +0800	[thread overview]
Message-ID: <51DF4391.4010609@asianux.com> (raw)
In-Reply-To: <51DCCE96.9050600@gmail.com>

On 07/10/2013 11:01 AM, Chen Gang F T wrote:
> 
>> > Hmm..., do we need call kobject_get() before kobject_put() in failure
>> > processing block ?
>> > 
> Oh, sorry for what I said for kobject_get/put() items above, it is
> incorrect.
> 
> What about the diff below for kobject_get() ?
> 
> -------------------------------diff begin-------------------------------
> 
> diff --git a/kernel/params.c b/kernel/params.c
> index 440e65d..ef8d720 100644
> --- a/kernel/params.c
> +++ b/kernel/params.c
> @@ -754,11 +754,11 @@ static struct module_kobject * __init locate_module_kobject(const char *name)
>  				name, err);
>  			return NULL;
>  		}
> -
> -		/* So that we hold reference in both cases. */
> -		kobject_get(&mk->kobj);
>  	}
>  
> +	/* So that we hold reference in both cases. */
> +	kobject_get(&mk->kobj);
> +
>  	return mk;
>  }
> 
> -------------------------------diff end---------------------------------
> 

Sorry again, this diff is incorrect, the original implementation has no
issues.


> And it also need add additional kobject_put(), if we really need
> process the failure in version_sysfs_builtin().

If need process failure, we really need it, but now, we only use
BUG_ON() is enough.


Thanks.
-- 
Chen Gang

  reply	other threads:[~2013-07-11 23:46 UTC|newest]

Thread overview: 10+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2013-07-09  3:37 [PATCH] kernel/params.c: print failure information instead of 'KOBJ_ADD' to user space, when sysfs_create_file() fails Chen Gang
2013-07-09  8:07 ` Rusty Russell
2013-07-10  2:17   ` Chen Gang F T
2013-07-10  2:35     ` Chen Gang
2013-07-10  3:01       ` Chen Gang F T
2013-07-11 23:45         ` Chen Gang [this message]
2013-07-11  1:53     ` Rusty Russell
2013-07-11  2:57       ` Chen Gang
2013-07-11  4:06       ` [PATCH v2] kernel/params.c: add/modify failure processing code " Chen Gang
2013-07-22  2:41         ` Chen Gang

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=51DF4391.4010609@asianux.com \
    --to=gang.chen@asianux.com \
    --cc=David.Woodhouse@intel.com \
    --cc=chen.gang.flying.transformer@gmail.com \
    --cc=khali@linux-fr.org \
    --cc=linux-kernel@vger.kernel.org \
    --cc=rusty@rustcorp.com.au \
    /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 an external index of several public inboxes,
see mirroring instructions on how to clone and mirror
all data and code used by this external index.