Nico Huber (nico.huber@secunet.com) just uploaded a new patch set to gerrit, which you can find at http://review.coreboot.org/1131
-gerrit
commit 82568c60960b61ff510b1ba4ef24a688e1a900ae Author: Nico Huber nico.huber@secunet.com Date: Thu Jun 21 11:21:23 2012 +0200
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 --- 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 99b65e0..d5514f9 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; }