* [PATCH] driver core: handle bus_attach_device() failure
@ 2006-10-09 9:12 Akinobu Mita
2006-10-09 9:32 ` Cornelia Huck
0 siblings, 1 reply; 2+ messages in thread
From: Akinobu Mita @ 2006-10-09 9:12 UTC (permalink / raw)
To: linux-kernel, linux-usb-devel; +Cc: Greg Kroah-Hartman
This patch handles bus_attach_device() failure in device_add().
Cc: Greg Kroah-Hartman <gregkh@suse.de>
Signed-off-by: Akinobu Mita <akinobu.mita@gmail.com>
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:
^ permalink raw reply [flat|nested] 2+ messages in thread
* Re: [PATCH] driver core: handle bus_attach_device() failure
2006-10-09 9:12 [PATCH] driver core: handle bus_attach_device() failure Akinobu Mita
@ 2006-10-09 9:32 ` Cornelia Huck
0 siblings, 0 replies; 2+ messages in thread
From: Cornelia Huck @ 2006-10-09 9:32 UTC (permalink / raw)
To: Akinobu Mita; +Cc: linux-kernel, linux-usb-devel, Greg Kroah-Hartman
On Mon, 9 Oct 2006 18:12:01 +0900,
akinobu.mita@gmail.com (Akinobu Mita) wrote:
> This patch handles bus_attach_device() failure in device_add().
>
> Cc: Greg Kroah-Hartman <gregkh@suse.de>
> Signed-off-by: Akinobu Mita <akinobu.mita@gmail.com>
>
> 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:
This won't quite work :)
See also
http://marc.theaimsgroup.com/?l=linux-kernel&m=116008235424179&w=2 ff.
for a discussion on it. I'll send an updated patch soon :)
--
Cornelia Huck
Linux for zSeries Developer
Tel.: +49-7031-16-4837, Mail: cornelia.huck@de.ibm.com
^ permalink raw reply [flat|nested] 2+ messages in thread
end of thread, other threads:[~2006-10-09 9:32 UTC | newest]
Thread overview: 2+ messages (download: mbox.gz follow: Atom feed
-- links below jump to the message on this page --
2006-10-09 9:12 [PATCH] driver core: handle bus_attach_device() failure Akinobu Mita
2006-10-09 9:32 ` Cornelia Huck
This is an external index of several public inboxes,
see mirroring instructions on how to clone and mirror
all data and code used by this external index.