From: Jerry Van Baren <gvb.uboot@gmail.com>
To: u-boot@lists.denx.de
Subject: [U-Boot-Users] [PATCH] USB Storage, add meaningful return value
Date: Mon, 24 Mar 2008 20:23:06 -0400 [thread overview]
Message-ID: <47E845EA.9010804@gmail.com> (raw)
In-Reply-To: <20080325000744.4CC59248BE@gemini.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
next prev parent reply other threads:[~2008-03-25 0:23 UTC|newest]
Thread overview: 10+ messages / expand[flat|nested] mbox.gz Atom feed top
2008-03-24 23:19 [U-Boot-Users] [PATCH] USB Storage, add meaningful return value Aras Vaichas
2008-03-25 0:07 ` Wolfgang Denk
2008-03-25 0:23 ` Jerry Van Baren [this message]
2008-03-25 1:09 ` Aras Vaichas
2008-03-25 7:36 ` Markus Klotzbücher
2008-03-26 18:14 ` Markus Klotzbücher
2008-03-25 14:23 ` Jon Loeliger
2008-03-25 14:34 ` Scott Wood
2008-03-25 14:36 ` Jon Loeliger
2008-03-25 14:40 ` Stefan Roese
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=47E845EA.9010804@gmail.com \
--to=gvb.uboot@gmail.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