usb_scan_devices: fix output with no devices
authorBryan Wu <bryan.wu@analog.com>
Mon, 19 Jan 2009 04:04:27 +0000 (23:04 -0500)
committerRemy Bohmer <linux@bohmer.net>
Wed, 28 Jan 2009 18:57:31 +0000 (19:57 +0100)
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@analog.com>
Signed-off-by: Mike Frysinger <vapier@gentoo.org>
Signed-off-by: Remy Bohmer <linux@bohmer.net>
common/usb.c

index 5f468315285cbd381fc1bb08f115de1ce36a612c..87fca70706519353561722fdb91a4eee8701085f 100644 (file)
@@ -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();