diff options
author | Nico Huber <nico.huber@secunet.com> | 2012-06-21 11:21:23 +0200 |
---|---|---|
committer | Patrick Georgi <patrick@georgi-clan.de> | 2012-06-22 08:55:50 +0200 |
commit | d8a6680073179e1f7a357ee02e3d9d5103b78eb4 (patch) | |
tree | 31f542af8657990e847da35c0d666cf16af41509 /payloads/libpayload/drivers/usb/usb.c | |
parent | 445a3a04d8cb388786bbe8f997bf2034521dea09 (diff) | |
download | coreboot-d8a6680073179e1f7a357ee02e3d9d5103b78eb4.tar.xz |
libpayload: Add check for failure in usb_attach_device()
This adds a simple check if a device is really configured before
returning it's address to the usb hub driver who wants to attach it.
Change-Id: I6fea140217c3e7468cc48ef7c3cbf2be8d11f47a
Signed-off-by: Nico Huber <nico.huber@secunet.com>
Reviewed-on: http://review.coreboot.org/1131
Tested-by: build bot (Jenkins)
Reviewed-by: Stefan Reinauer <stefan.reinauer@coreboot.org>
Diffstat (limited to 'payloads/libpayload/drivers/usb/usb.c')
-rw-r--r-- | payloads/libpayload/drivers/usb/usb.c | 3 |
1 files changed, 2 insertions, 1 deletions
diff --git a/payloads/libpayload/drivers/usb/usb.c b/payloads/libpayload/drivers/usb/usb.c index 99b65e03f2..d5514f980c 100644 --- a/payloads/libpayload/drivers/usb/usb.c +++ b/payloads/libpayload/drivers/usb/usb.c @@ -487,6 +487,7 @@ usb_attach_device(hci_t *controller, int hubaddress, int port, int speed) usbdev_t *newdev_t = controller->devices[newdev]; // determine responsible driver - current done in set_address newdev_t->init (newdev_t); - return newdev; + /* init() may have called usb_detach_device() yet, so check */ + return controller->devices[newdev] ? newdev : -1; } |