From mboxrd@z Thu Jan 1 00:00:00 1970 From: Markus =?utf-8?Q?Klotzb=C3=BCcher?= Date: Wed, 26 Mar 2008 19:14:52 +0100 Subject: [U-Boot-Users] [PATCH] USB Storage, add meaningful return value In-Reply-To: <47E850B3.4080000@magtech.com.au> (Aras Vaichas's message of "Tue\, 25 Mar 2008 12\:09\:07 +1100") References: <20080325000744.4CC59248BE@gemini.denx.de> <47E845EA.9010804@gmail.com> <47E850B3.4080000@magtech.com.au> Message-ID: <87tzit1her.fsf@denx.de> List-Id: MIME-Version: 1.0 Content-Type: text/plain; charset="us-ascii" Content-Transfer-Encoding: 7bit To: u-boot@lists.denx.de Aras Vaichas writes: > ______________________________________________________________________ > This email has been scanned by the MessageLabs Email Security System. > For more information please visit http://www.messagelabs.com/email > ______________________________________________________________________--- a/include/usb.h 2008-03-19 13:47:18.000000000 +1100 Its my fault for not paying attention correctly, but this line essentially broke git-am so that this chunk didn't get applied correctly. > -void usb_stor_info(void) > +int usb_stor_info(void) > { > int i; > > - if (usb_max_devs > 0) > + if (usb_max_devs > 0) { > for (i = 0; i < usb_max_devs; i++) { > printf (" Device %d: ", i); > dev_print(&usb_dev_desc[i]); > + return 0; > } Returning here will result in only the first of all storage devices to be printed. > - else > + } else { > printf("No storage devices, perhaps not 'usb start'ed..?\n"); > + return 1; > + } > } > > /********************************************************************************* I committed the following patch to fix this diff --git a/common/usb_storage.c b/common/usb_storage.c index 81d2f92..d263b6c 100644 --- a/common/usb_storage.c +++ b/common/usb_storage.c @@ -196,12 +196,12 @@ int usb_stor_info(void) for (i = 0; i < usb_max_devs; i++) { printf (" Device %d: ", i); dev_print(&usb_dev_desc[i]); - return 0; } - } else { - printf("No storage devices, perhaps not 'usb start'ed..?\n"); - return 1; + return 0; } + + printf("No storage devices, perhaps not 'usb start'ed..?\n"); + return 1; } /********************************************************************************* Best regards Markus -- DENX Software Engineering GmbH, MD: Wolfgang Denk & Detlev Zundel HRB 165235 Munich, Office: Kirchenstr.5, D-82194 Groebenzell, Germany Phone: +49-8142-66989-0 Fax: +49-8142-66989-80 Email: office@denx.de