This patch handles bus_attach_device() failure in device_add().

Cc: Greg Kroah-Hartman <[EMAIL PROTECTED]>
Signed-off-by: Akinobu Mita <[EMAIL PROTECTED]>

 drivers/base/core.c |   22 ++++++++++++++++------
 1 file changed, 16 insertions(+), 6 deletions(-)

Index: 2.6-mm/drivers/base/core.c
===================================================================
--- 2.6-mm.orig/drivers/base/core.c     2006-10-03 22:58:40.000000000 +0900
+++ 2.6-mm/drivers/base/core.c  2006-10-09 16:57:52.000000000 +0900
@@ -530,7 +530,9 @@ int device_add(struct device *dev)
        if ((error = bus_add_device(dev)))
                goto BusError;
        kobject_uevent(&dev->kobj, KOBJ_ADD);
-       bus_attach_device(dev);
+       if ((error = bus_attach_device(dev)))
+               goto BusAttachError;
+
        if (parent)
                klist_add_tail(&dev->knode_parent, &parent->klist_children);
 
@@ -548,6 +550,8 @@ int device_add(struct device *dev)
  Done:
        put_device(dev);
        return error;
+ BusAttachError:
+       bus_remove_device(dev);
  BusError:
        device_pm_remove(dev);
  PMError:

-------------------------------------------------------------------------
Take Surveys. Earn Cash. Influence the Future of IT
Join SourceForge.net's Techsay panel and you'll get the chance to share your
opinions on IT & business topics through brief surveys -- and earn cash
http://www.techsay.com/default.php?page=join.php&p=sourceforge&CID=DEVDEV
_______________________________________________
linux-usb-devel@lists.sourceforge.net
To unsubscribe, use the last form field at:
https://lists.sourceforge.net/lists/listinfo/linux-usb-devel

Reply via email to