* [PATCH 2/8] Fixup initialisation oops for anonymous transport classes
@ 2008-03-18 13:32 Hannes Reinecke
2008-03-20 18:14 ` James Bottomley
0 siblings, 1 reply; 2+ messages in thread
From: Hannes Reinecke @ 2008-03-18 13:32 UTC (permalink / raw)
To: James Bottomley; +Cc: linux-scsi
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
^ permalink raw reply related [flat|nested] 2+ messages in thread
* Re: [PATCH 2/8] Fixup initialisation oops for anonymous transport classes
2008-03-18 13:32 [PATCH 2/8] Fixup initialisation oops for anonymous transport classes Hannes Reinecke
@ 2008-03-20 18:14 ` James Bottomley
0 siblings, 0 replies; 2+ messages in thread
From: James Bottomley @ 2008-03-20 18:14 UTC (permalink / raw)
To: Hannes Reinecke; +Cc: linux-scsi
On Tue, 2008-03-18 at 14:32 +0100, Hannes Reinecke wrote:
> Anonymous transport classes might call transport_add_class_devices
> with NULL classdev.
They do ... but it doesn't cause an oops. class_device_add first calls
class_device_get() which returns -EINVAL for a NULL classdev. It looks
like device_add() does exactly the same thing in the new scheme, so what
oops were you seeing?
James
^ permalink raw reply [flat|nested] 2+ messages in thread
end of thread, other threads:[~2008-03-20 18:14 UTC | newest]
Thread overview: 2+ messages (download: mbox.gz follow: Atom feed
-- links below jump to the message on this page --
2008-03-18 13:32 [PATCH 2/8] Fixup initialisation oops for anonymous transport classes Hannes Reinecke
2008-03-20 18:14 ` James Bottomley
This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox