diff options
author | Kim B. Heino <Kim.Heino@bluegiga.com> | 2010-03-12 10:07:00 +0200 |
---|---|---|
committer | Remy Bohmer <linux@bohmer.net> | 2010-04-08 21:40:00 +0200 |
commit | fac71cc49f93db7d460dbc957dfbbadefa2ca0e9 (patch) | |
tree | 185f85830abc80e6d6e15fabdab23dbd60260a3e /common/usb_storage.c | |
parent | aaad108b889c6980a2d05262a2f7febb14f94d68 (diff) | |
download | u-boot-imx-fac71cc49f93db7d460dbc957dfbbadefa2ca0e9.zip u-boot-imx-fac71cc49f93db7d460dbc957dfbbadefa2ca0e9.tar.gz u-boot-imx-fac71cc49f93db7d460dbc957dfbbadefa2ca0e9.tar.bz2 |
USB storage probe
While debugging one ill behaving USB device I found two bugs in USB
storage probe.
usb_stor_get_info() returns -1 (error), 0 (skip) or 1 (ok). First part
of this patch fixes error case.
Second part fixes usb_inquiry()'s retry counter handling. Original code
had retry = -1 on error case, not retry = 0 as checked in the next line.
Signed-off-by: Kim B. Heino <Kim.Heino@bluegiga.com>
Diffstat (limited to 'common/usb_storage.c')
-rw-r--r-- | common/usb_storage.c | 4 |
1 files changed, 2 insertions, 2 deletions
diff --git a/common/usb_storage.c b/common/usb_storage.c index 239bddc..4fc01a2 100644 --- a/common/usb_storage.c +++ b/common/usb_storage.c @@ -244,7 +244,7 @@ int usb_stor_scan(int mode) * get info and fill it in */ if (usb_stor_get_info(dev, &usb_stor[usb_max_devs], - &usb_dev_desc[usb_max_devs])) + &usb_dev_desc[usb_max_devs]) == 1) usb_max_devs++; } /* if storage device */ @@ -888,7 +888,7 @@ static int usb_inquiry(ccb *srb, struct us_data *ss) USB_STOR_PRINTF("inquiry returns %d\n", i); if (i == 0) break; - } while (retry--); + } while (--retry); if (!retry) { printf("error in inquiry\n"); |