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 <Kim.Heino@bluegiga.com>
This commit is contained in:
Kim B. Heino
2010-03-12 15:46:56 +02:00
committed by Remy Bohmer
parent d7a22a364c
commit aaad108b88
2 changed files with 9 additions and 6 deletions

View File

@ -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;
}