[U-Boot] [PATCH] usb_scan_devices: fix output with no devices

Mike Frysinger vapier at gentoo.org
Mon Jan 19 05:04:27 CET 2009


From: Bryan Wu <bryan.wu at analog.com>

We should check the return of usb_new_device() so that if no USB device is
found, we print out the right message rather than always saying "new usb
device found".

Signed-off-by: Bryan Wu <bryan.wu at analog.com>
Signed-off-by: Mike Frysinger <vapier at gentoo.org>
---
this is against u-boot-usb.git ... apparently that has a lot of whitespace
cleanups in it.  i'm guessing those will be merged into mainline after the
next release ?  or should i redo the patch against u-boot.git ?

 common/usb.c |    6 ++++--
 1 files changed, 4 insertions(+), 2 deletions(-)

diff --git a/common/usb.c b/common/usb.c
index ee18152..87ab752 100644
--- a/common/usb.c
+++ b/common/usb.c
@@ -939,8 +939,10 @@ void usb_scan_devices(void)
 	dev_index = 0;
 	/* device 0 is always present (root hub, so let it analyze) */
 	dev = usb_alloc_new_device();
-	usb_new_device(dev);
-	printf("%d USB Device(s) found\n", dev_index);
+	if (usb_new_device(dev))
+		printf("No USB Device found\n");
+	else
+		printf("%d USB Device(s) found\n", dev_index);
 	/* insert "driver" if possible */
 #ifdef CONFIG_USB_KEYBOARD
 	drv_usb_kbd_init();
-- 
1.6.1



More information about the U-Boot mailing list