From mboxrd@z Thu Jan 1 00:00:00 1970 From: Jerry Van Baren Date: Mon, 24 Mar 2008 20:23:06 -0400 Subject: [U-Boot-Users] [PATCH] USB Storage, add meaningful return value In-Reply-To: <20080325000744.4CC59248BE@gemini.denx.de> References: <20080325000744.4CC59248BE@gemini.denx.de> Message-ID: <47E845EA.9010804@gmail.com> List-Id: MIME-Version: 1.0 Content-Type: text/plain; charset="us-ascii" Content-Transfer-Encoding: 7bit To: u-boot@lists.denx.de Wolfgang Denk wrote: > Dear Aras, > > in message <47E836F8.6090702@magtech.com.au> you wrote: >> This patch changes the "usb storage" command to return success iff it >> finds a USB storage device, otherwise it returns error. > > Thanks. I appreciate your contribution, but please fix the coding > style: > >> @@ -196,9 +196,13 @@ >> for (i = 0; i < usb_max_devs; i++) { > > There is probably a { missing before this line (as this is not a > single-line statement). > >> printf (" Device %d: ", i); >> dev_print(&usb_dev_desc[i]); >> + return 0; >> } >> else >> + { > > ...and then this should read > > } else { > > Thanks. > > Best regards, > > Wolfgang Denk Just in case Wolfgang was too terse, I'll add to his critique... the original code is the origin of the coding violations: void usb_stor_info(void) { int i; if (usb_max_devs > 0) for (i = 0; i < usb_max_devs; i++) { printf (" Device %d: ", i); dev_print(&usb_dev_desc[i]); } else printf("No storage devices, perhaps not 'usb start'ed..?\n"); } It doesn't have braces on the "if (usb_max_devs > 0)" which is syntactically OK but the source of the coding violation. Please add braces after the "if" and "} else {" per Wolfgang's comments. Thanks for making the code a little better and a little prettier, ;-) gvb