public inbox for u-boot@lists.denx.de
 help / color / mirror / Atom feed
From: "Markus Klotzbücher" <mk@denx.de>
To: u-boot@lists.denx.de
Subject: [U-Boot-Users] [PATCH] USB Storage, add meaningful return value
Date: Wed, 26 Mar 2008 19:14:52 +0100	[thread overview]
Message-ID: <87tzit1her.fsf@denx.de> (raw)
In-Reply-To: <47E850B3.4080000@magtech.com.au> (Aras Vaichas's message of "Tue\, 25 Mar 2008 12\:09\:07 +1100")

Aras Vaichas <arasv@magtech.com.au> 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

  parent reply	other threads:[~2008-03-26 18:14 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
2008-03-25  1:09     ` Aras Vaichas
2008-03-25  7:36       ` Markus Klotzbücher
2008-03-26 18:14       ` Markus Klotzbücher [this message]
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=87tzit1her.fsf@denx.de \
    --to=mk@denx.de \
    --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