[U-Boot] [PATCH v2 5/6] net: Be less picky about decoding the netretry env var

Simon Glass sjg at chromium.org
Thu Oct 27 18:24:31 CEST 2011


This is intended purely as a code size reduction.

Signed-off-by: Simon Glass <sjg at chromium.org>
---

 README    |    4 ++++
 net/net.c |    6 +++---
 2 files changed, 7 insertions(+), 3 deletions(-)

diff --git a/README b/README
index a1910dc..4d9ab77 100644
--- a/README
+++ b/README
@@ -3579,6 +3579,10 @@ List of environment variables (most likely not complete):
 		  are tried once without success.
 		  Useful on scripts which control the retry operation
 		  themselves.
+		  When unset, or set to "yes", each network operation
+		  will retry forever. Note that only the first letter
+		  is significant (any word beginning with y, n, o
+		  will select the corressponding option).
 
   npe_ucode	- set load address for the NPE microcode
 
diff --git a/net/net.c b/net/net.c
index cd34bf9..3712e17 100644
--- a/net/net.c
+++ b/net/net.c
@@ -605,11 +605,11 @@ void NetStartAgain(void)
 
 	nretry = getenv("netretry");
 	if (nretry) {
-		if (!strcmp(nretry, "yes"))
+		if (*nretry == 'y')
 			retry_forever = 1;
-		else if (!strcmp(nretry, "no"))
+		else if (!*nretry == 'n')
 			retrycnt = 0;
-		else if (!strcmp(nretry, "once"))
+		else if (*nretry == 'o')	/* "once" */
 			retrycnt = 1;
 		else
 			retrycnt = simple_strtoul(nretry, NULL, 0);
-- 
1.7.3.1



More information about the U-Boot mailing list