[U-Boot] [PATCH v5 3/5] net: fix potential compiler warning

Michael Walle michael at walle.cc
Sat May 12 00:50:47 CEST 2012


Future compiler versions may generate a "too many arguments for functions"
warning.

Signed-off-by: Michael Walle <michael at walle.cc>
Cc: Joe Hershberger <joe.hershberger at gmail.com>
---
 net/eth.c |   14 ++++++++++++--
 1 files changed, 12 insertions(+), 2 deletions(-)

diff --git a/net/eth.c b/net/eth.c
index c9f05d8..afce863 100644
--- a/net/eth.c
+++ b/net/eth.c
@@ -58,7 +58,12 @@ int eth_getenv_enetaddr_by_index(const char *base_name, int index,
 				 uchar *enetaddr)
 {
 	char enetvar[32];
-	sprintf(enetvar, index ? "%s%daddr" : "%saddr", base_name, index);
+
+	if (index)
+		sprintf(enetvar, "%s%daddr", base_name, index);
+	else
+		sprintf(enetvar, "%saddr", base_name);
+
 	return eth_getenv_enetaddr(enetvar, enetaddr);
 }
 
@@ -66,7 +71,12 @@ static int eth_mac_skip(int index)
 {
 	char enetvar[15];
 	char *skip_state;
-	sprintf(enetvar, index ? "eth%dmacskip" : "ethmacskip", index);
+
+	if (index)
+		sprintf(enetvar, "eth%dmacskip", index);
+	else
+		sprintf(enetvar, "ethmacskip");
+
 	return ((skip_state = getenv(enetvar)) != NULL);
 }
 
-- 
1.7.2.5



More information about the U-Boot mailing list