From: akinobu.mita@gmail.com (Akinobu Mita)
To: linux-kernel@vger.kernel.org, linux-usb-devel@lists.sourceforge.net
Cc: Greg Kroah-Hartman <gregkh@suse.de>
Subject: [PATCH] driver core: handle bus_attach_device() failure
Date: Mon, 9 Oct 2006 18:12:01 +0900 [thread overview]
Message-ID: <20061009091201.GA6448@localhost> (raw)
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:
next reply other threads:[~2006-10-09 9:11 UTC|newest]
Thread overview: 2+ messages / expand[flat|nested] mbox.gz Atom feed top
2006-10-09 9:12 Akinobu Mita [this message]
2006-10-09 9:32 ` Cornelia Huck
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=20061009091201.GA6448@localhost \
--to=akinobu.mita@gmail.com \
--cc=gregkh@suse.de \
--cc=linux-kernel@vger.kernel.org \
--cc=linux-usb-devel@lists.sourceforge.net \
/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
all inboxes | Powered by JetHome®