[PATCH] driver core: handles kobject_uevent failure while device_add
From: Dmitriy Monakhov
Date: Sun Mar 11 2007 - 15:11:47 EST
Signed-off-by: Monakhov Dmitriy <dmonakhov@xxxxxxxxxx>
---
drivers/base/core.c | 10 ++++++++--
1 files changed, 8 insertions(+), 2 deletions(-)
diff --git a/drivers/base/core.c b/drivers/base/core.c
index 142c222..da73012 100644
--- a/drivers/base/core.c
+++ b/drivers/base/core.c
@@ -630,8 +630,11 @@ int device_add(struct device *dev)
goto PMError;
if ((error = bus_add_device(dev)))
goto BusError;
- if (!dev->uevent_suppress)
- kobject_uevent(&dev->kobj, KOBJ_ADD);
+ if (!dev->uevent_suppress) {
+ error = kobject_uevent(&dev->kobj, KOBJ_ADD);
+ if (error)
+ goto UeventError;
+ }
bus_attach_device(dev);
if (parent)
klist_add_tail(&dev->knode_parent, &parent->klist_children);
@@ -651,6 +654,9 @@ int device_add(struct device *dev)
kfree(class_name);
put_device(dev);
return error;
+
+ UeventError:
+ bus_remove_device(dev);
BusError:
device_pm_remove(dev);
PMError:
--
1.5.0.1
-
To unsubscribe from this list: send the line "unsubscribe linux-kernel" in
the body of a message to majordomo@xxxxxxxxxxxxxxx
More majordomo info at http://vger.kernel.org/majordomo-info.html
Please read the FAQ at http://www.tux.org/lkml/