From aaad108b889c6980a2d05262a2f7febb14f94d68 Mon Sep 17 00:00:00 2001 From: Kim B. Heino Date: Fri, 12 Mar 2010 15:46:56 +0200 Subject: USB storage count Here's another USB storage patch. Currently U-Boot handles storage devices #0 - #4 as valid devices, even if there is none connected. This patch fixes usb_stor_get_dev() to check detected device count instead of MAX-define. This is very important for ill behaving devices. usb_dev_desc[] can be partially initialized if device probe fails. After fixing get_dev() it was easy to fix "usb part" etc commands. Previously it outputed "Unknown partition table" five times, now it's "no USB devices available". Signed-off-by: Kim B. Heino --- common/usb_storage.c | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) (limited to 'common/usb_storage.c') diff --git a/common/usb_storage.c b/common/usb_storage.c index a8642c9cc51..239bddc5118 100644 --- a/common/usb_storage.c +++ b/common/usb_storage.c @@ -175,7 +175,7 @@ void uhci_show_temp_int_td(void); block_dev_desc_t *usb_stor_get_dev(int index) { - return (index < USB_MAX_STOR_DEV) ? &usb_dev_desc[index] : NULL; + return (index < usb_max_devs) ? &usb_dev_desc[index] : NULL; } -- cgit v1.2.3