From: Kim B. Heino <Kim.Heino@bluegiga.com>
To: u-boot@lists.denx.de
Subject: [U-Boot] [PATCH] USB storage probe
Date: Fri, 12 Mar 2010 10:07:00 +0200 [thread overview]
Message-ID: <20100312100700.1ed6bcec@bluegiga.com> (raw)
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>
diff -ur u-boot.orig/common/usb_storage.c u-boot/common/usb_storage.c
--- u-boot.orig/common/usb_storage.c 2010-03-12 01:26:32.000000000 +0200
+++ u-boot/common/usb_storage.c 2010-03-12 09:51:56.355564562 +0200
@@ -244,7 +244,7 @@
* 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 @@
USB_STOR_PRINTF("inquiry returns %d\n", i);
if (i == 0)
break;
- } while (retry--);
+ } while (--retry);
if (!retry) {
printf("error in inquiry\n");
next reply other threads:[~2010-03-12 8:07 UTC|newest]
Thread overview: 2+ messages / expand[flat|nested] mbox.gz Atom feed top
2010-03-12 8:07 Kim B. Heino [this message]
2010-03-24 19:47 ` [U-Boot] [PATCH] USB storage probe Remy Bohmer
Reply instructions:
You may reply publicly to this message via plain-text email
using any one of the following methods:
* Save the following mbox file, import it into your mail client,
and reply-to-all from there: mbox
Avoid top-posting and favor interleaved quoting:
https://en.wikipedia.org/wiki/Posting_style#Interleaved_style
* Reply using the --to, --cc, and --in-reply-to
switches of git-send-email(1):
git send-email \
--in-reply-to=20100312100700.1ed6bcec@bluegiga.com \
--to=kim.heino@bluegiga.com \
--cc=u-boot@lists.denx.de \
/path/to/YOUR_REPLY
https://kernel.org/pub/software/scm/git/docs/git-send-email.html
* If your mail client supports setting the In-Reply-To header
via mailto: links, try the mailto: link
Be sure your reply has a Subject: header at the top and a blank line
before the message body.
This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox