[U-Boot-Users] [PATCH] USB Storage, add meaningful return value

Jon Loeliger jdl at freescale.com
Tue Mar 25 15:23:43 CET 2008


Jerry Van Baren wrote:

> 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
> 


Hey Stefan,

What do you think?  Wouldn't a policy of _always_ using
braces even for single sub-statements have just made this
a _correct_ no-brainer from the onset? :-)

jdl

PS -- No, no point.  Why do you ask?




More information about the U-Boot mailing list