public inbox for u-boot@lists.denx.de
 help / color / mirror / Atom feed
* [U-Boot] [PATCH] USB storage probe
@ 2010-03-12  8:07 Kim B. Heino
  2010-03-24 19:47 ` Remy Bohmer
  0 siblings, 1 reply; 2+ messages in thread
From: Kim B. Heino @ 2010-03-12  8:07 UTC (permalink / raw)
  To: u-boot

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");

^ permalink raw reply	[flat|nested] 2+ messages in thread

* [U-Boot] [PATCH] USB storage probe
  2010-03-12  8:07 [U-Boot] [PATCH] USB storage probe Kim B. Heino
@ 2010-03-24 19:47 ` Remy Bohmer
  0 siblings, 0 replies; 2+ messages in thread
From: Remy Bohmer @ 2010-03-24 19:47 UTC (permalink / raw)
  To: u-boot

Hi,

2010/3/12 Kim B. Heino <Kim.Heino@bluegiga.com>:
> 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>

Applied to U-boot-usb
Thanks.

Remy

^ permalink raw reply	[flat|nested] 2+ messages in thread

end of thread, other threads:[~2010-03-24 19:47 UTC | newest]

Thread overview: 2+ messages (download: mbox.gz follow: Atom feed
-- links below jump to the message on this page --
2010-03-12  8:07 [U-Boot] [PATCH] USB storage probe Kim B. Heino
2010-03-24 19:47 ` Remy Bohmer

This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox