mirror of https://lore.kernel.org/lkml/
 help / color / mirror / Atom feed
From: Cornelia Huck <cornelia.huck@de.ibm.com>
To: Wang Chen <wangchen@cn.fujitsu.com>
Cc: Greg Kroah-Hartman <gregkh@suse.de>, linux-kernel@vger.kernel.org
Subject: Re: [PATCH 2/2] kobjects: Transmit return value of kobject_uevent_env() to caller
Date: Tue, 24 Jun 2008 16:24:48 +0200	[thread overview]
Message-ID: <20080624162448.4b1e3d87@gondolin.boeblingen.de.ibm.com> (raw)
In-Reply-To: <4860B75A.1050307@cn.fujitsu.com>

On Tue, 24 Jun 2008 16:59:06 +0800,
Wang Chen <wangchen@cn.fujitsu.com> wrote:

> The error signal shouldn't be dropped.
> 
> Signed-off-by: Wang Chen <wangchen@cn.fujitsu.com>
> ---
> diff --git a/lib/kobject.c b/lib/kobject.c
> index 718e510..e5de71e 100644
> --- a/lib/kobject.c
> +++ b/lib/kobject.c
> @@ -430,7 +430,7 @@ int kobject_rename(struct kobject *kobj, const char *new_name)
>  	 * Some hotplug package track interfaces by their name and
>  	 * therefore want to know when the name is changed by the user. */
>  	if (!error)
> -		kobject_uevent_env(kobj, KOBJ_MOVE, envp);
> +		error = kobject_uevent_env(kobj, KOBJ_MOVE, envp);
> 
>  out:
>  	kfree(devpath_string);
> @@ -482,7 +482,7 @@ int kobject_move(struct kobject *kobj, struct kobject *new_parent)
>  	kobj->parent = new_parent;
>  	new_parent = NULL;
>  	kobject_put(old_parent);
> -	kobject_uevent_env(kobj, KOBJ_MOVE, envp);
> +	error = kobject_uevent_env(kobj, KOBJ_MOVE, envp);
>  out:
>  	kobject_put(new_parent);
>  	kobject_put(kobj);
> 
> 
> 

This looks wrong. If everything went right except sending the uevent,
you'll make the caller believe that the whole operation failed, while
in reality the sysfs operation succeeded. Either just drop the error
again (or print a warning), or undo the previous operations on error
(which may fail).

  reply	other threads:[~2008-06-24 14:25 UTC|newest]

Thread overview: 5+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2008-06-24  8:59 Wang Chen
2008-06-24 14:24 ` Cornelia Huck [this message]
     [not found]   ` <486198F1.6000601@cn.fujitsu.com>
2008-06-25  9:08     ` Wang Chen
2008-07-01 10:51       ` Cornelia Huck
2008-07-02  8:32         ` Wang Chen

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=20080624162448.4b1e3d87@gondolin.boeblingen.de.ibm.com \
    --to=cornelia.huck@de.ibm.com \
    --cc=gregkh@suse.de \
    --cc=linux-kernel@vger.kernel.org \
    --cc=wangchen@cn.fujitsu.com \
    /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

all inboxes | Powered by JetHome®