public inbox for linux-scsi@vger.kernel.org
 help / color / mirror / Atom feed
From: hare@suse.de (Hannes Reinecke)
To: James Bottomley <James.Bottomley@HansenPartnership.com>
Cc: linux-scsi@vger.kernel.org
Subject: [PATCH 2/8] Fixup initialisation oops for anonymous transport classes
Date: Tue, 18 Mar 2008 14:32:28 +0100	[thread overview]
Message-ID: <20080318133228.53EAE1F60F@pentland.suse.de> (raw)


Anonymous transport classes might call transport_add_class_devices
with NULL classdev.

Signed-off-by: Hannes Reinecke <hare@suse.de>
---
 drivers/base/transport_class.c |    8 +++++++-
 1 files changed, 7 insertions(+), 1 deletions(-)

diff --git a/drivers/base/transport_class.c b/drivers/base/transport_class.c
index 72cf462..61a611c 100644
--- a/drivers/base/transport_class.c
+++ b/drivers/base/transport_class.c
@@ -150,10 +150,16 @@ static int transport_add_class_device(struct attribute_container *cont,
 				      struct device *dev,
 				      struct device *classdev)
 {
-	int error = attribute_container_add_class_device(classdev);
+	int error;
 	struct transport_container *tcont = 
 		attribute_container_to_transport_container(cont);
 
+	/* NULL if called from anonymous transport classes */
+	if (!classdev)
+		return 0;
+
+	error = attribute_container_add_class_device(classdev);
+
 	if (!error && tcont->statistics)
 		error = sysfs_create_group(&classdev->kobj, tcont->statistics);
 
-- 
1.5.2.4


             reply	other threads:[~2008-03-18 13:32 UTC|newest]

Thread overview: 2+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2008-03-18 13:32 Hannes Reinecke [this message]
2008-03-20 18:14 ` [PATCH 2/8] Fixup initialisation oops for anonymous transport classes James Bottomley

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=20080318133228.53EAE1F60F@pentland.suse.de \
    --to=hare@suse.de \
    --cc=James.Bottomley@HansenPartnership.com \
    --cc=linux-scsi@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