public inbox for linux-kernel@vger.kernel.org
 help / color / mirror / Atom feed
From: Cornelia Huck <cornelia.huck@de.ibm.com>
To: Greg Kroah-Hartman <gregkh@suse.de>
Cc: Phil Carmody <ext-phil.2.carmody@nokia.com>,
	linux-kernel@vger.kernel.org
Subject: [PATCH] sysfs: Allow sysfs_move_dir(..., NULL) again.
Date: Tue, 6 Oct 2009 15:33:35 +0200	[thread overview]
Message-ID: <20091006153335.15d02d12@gondolin> (raw)
In-Reply-To: <1254819129.23533.27.camel@pcarmody-desktop>

As device_move() and kobject_move() both handle a NULL destination,
sysfs_move_dir() should do this as well (again) and fall back to
sysfs_root in that case.

Signed-off-by: Cornelia Huck <cornelia.huck@de.ibm.com>

---
 fs/sysfs/dir.c |    3 ++-
 1 file changed, 2 insertions(+), 1 deletion(-)

--- linux-2.6.orig/fs/sysfs/dir.c
+++ linux-2.6/fs/sysfs/dir.c
@@ -894,7 +894,8 @@ int sysfs_move_dir(struct kobject *kobj,
 
 	mutex_lock(&sysfs_rename_mutex);
 	BUG_ON(!sd->s_parent);
-	new_parent_sd = new_parent_kobj->sd ? new_parent_kobj->sd : &sysfs_root;
+	new_parent_sd = (new_parent_kobj && new_parent_kobj->sd) ?
+		new_parent_kobj->sd : &sysfs_root;
 
 	error = 0;
 	if (sd->s_parent == new_parent_sd)

      parent reply	other threads:[~2009-10-06 13:34 UTC|newest]

Thread overview: 8+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2009-10-01 14:50 [PATCH 1/1] Kobject: bail early if no new_parent in kobject_move() Phil Carmody
2009-10-01 14:49 ` Greg KH
2009-10-01 15:01   ` Phil Carmody
2009-10-01 15:01     ` Greg KH
2009-10-05 16:37 ` Cornelia Huck
2009-10-06  8:52   ` Phil Carmody
2009-10-06 13:33     ` Cornelia Huck
2009-10-06 13:33     ` Cornelia Huck [this message]

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=20091006153335.15d02d12@gondolin \
    --to=cornelia.huck@de.ibm.com \
    --cc=ext-phil.2.carmody@nokia.com \
    --cc=gregkh@suse.de \
    --cc=linux-kernel@vger.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