diff options
-rw-r--r-- | common/usb_storage.c | 14 |
1 files changed, 7 insertions, 7 deletions
diff --git a/common/usb_storage.c b/common/usb_storage.c index 60531e2aa48..f2d2ad9fb24 100644 --- a/common/usb_storage.c +++ b/common/usb_storage.c @@ -176,6 +176,13 @@ static int usb_stor_probe_device(struct usb_device *dev) if (dev == NULL) return -ENOENT; /* no more devices available */ + /* We don't have space to even probe if we hit the maximum */ + if (usb_max_devs == USB_MAX_STOR_DEV) { + printf("max USB Storage Device reached: %d stopping\n", + usb_max_devs); + return -ENOSPC; + } + debug("\n\nProbing for storage\n"); if (usb_storage_probe(dev, 0, &usb_stor[usb_max_devs])) { /* OK, it's a storage device. Iterate over its LUNs @@ -210,13 +217,6 @@ static int usb_stor_probe_device(struct usb_device *dev) } } - /* if storage device */ - if (usb_max_devs == USB_MAX_STOR_DEV) { - printf("max USB Storage Device reached: %d stopping\n", - usb_max_devs); - return -ENOSPC; - } - return 0; } |