[U-Boot] [PATCH 3/6] "return" is not a function

Guennadi Liakhovetski lg at denx.de
Wed Aug 27 17:52:45 CEST 2008


Signed-off-by: Guennadi Liakhovetski <lg at denx.de>
---
 tools/env/fw_env.c |   88 ++++++++++++++++++++++++++--------------------------
 1 files changed, 44 insertions(+), 44 deletions(-)

diff --git a/tools/env/fw_env.c b/tools/env/fw_env.c
index 6f7fdb2..2c82970 100644
--- a/tools/env/fw_env.c
+++ b/tools/env/fw_env.c
@@ -200,7 +200,7 @@ char *fw_getenv (char *name)
 	char *env, *nxt;
 
 	if (env_init ())
-		return (NULL);
+		return NULL;
 
 	for (env = environment.data; *env; env = nxt + 1) {
 		char *val;
@@ -209,15 +209,15 @@ char *fw_getenv (char *name)
 			if (nxt >= &environment.data[ENV_SIZE]) {
 				fprintf (stderr, "## Error: "
 					"environment not terminated\n");
-				return (NULL);
+				return NULL;
 			}
 		}
 		val = envmatch (name, env);
 		if (!val)
 			continue;
-		return (val);
+		return val;
 	}
-	return (NULL);
+	return NULL;
 }
 
 /*
@@ -231,7 +231,7 @@ int fw_printenv (int argc, char *argv[])
 	int rc = 0;
 
 	if (env_init ())
-		return (-1);
+		return -1;
 
 	if (argc == 1) {		/* Print all env variables  */
 		for (env = environment.data; *env; env = nxt + 1) {
@@ -239,13 +239,13 @@ int fw_printenv (int argc, char *argv[])
 				if (nxt >= &environment.data[ENV_SIZE]) {
 					fprintf (stderr, "## Error: "
 						"environment not terminated\n");
-					return (-1);
+					return -1;
 				}
 			}
 
 			printf ("%s\n", env);
 		}
-		return (0);
+		return 0;
 	}
 
 	if (strcmp (argv[1], "-n") == 0) {
@@ -255,7 +255,7 @@ int fw_printenv (int argc, char *argv[])
 		if (argc != 2) {
 			fprintf (stderr, "## Error: "
 				"`-n' option requires exactly one argument\n");
-			return (-1);
+			return -1;
 		}
 	} else {
 		n_flag = 0;
@@ -271,7 +271,7 @@ int fw_printenv (int argc, char *argv[])
 				if (nxt >= &environment.data[ENV_SIZE]) {
 					fprintf (stderr, "## Error: "
 						"environment not terminated\n");
-					return (-1);
+					return -1;
 				}
 			}
 			val = envmatch (name, env);
@@ -290,7 +290,7 @@ int fw_printenv (int argc, char *argv[])
 		}
 	}
 
-	return (rc);
+	return rc;
 }
 
 /*
@@ -309,11 +309,11 @@ int fw_setenv (int argc, char *argv[])
 	char *name;
 
 	if (argc < 2) {
-		return (EINVAL);
+		return EINVAL;
 	}
 
 	if (env_init ())
-		return (errno);
+		return errno;
 
 	name = argv[1];
 
@@ -325,7 +325,7 @@ int fw_setenv (int argc, char *argv[])
 			if (nxt >= &environment.data[ENV_SIZE]) {
 				fprintf (stderr, "## Error: "
 					"environment not terminated\n");
-				return (EINVAL);
+				return EINVAL;
 			}
 		}
 		if ((oldval = envmatch (name, env)) != NULL)
@@ -342,7 +342,7 @@ int fw_setenv (int argc, char *argv[])
 		if ((strcmp (name, "ethaddr") == 0) ||
 			(strcmp (name, "serial#") == 0)) {
 			fprintf (stderr, "Can't overwrite \"%s\"\n", name);
-			return (EROFS);
+			return EROFS;
 		}
 
 		if (*++nxt == '\0') {
@@ -381,7 +381,7 @@ int fw_setenv (int argc, char *argv[])
 		fprintf (stderr,
 			"Error: environment overflow, \"%s\" deleted\n",
 			name);
-		return (-1);
+		return -1;
 	}
 	while ((*env = *name++) != '\0')
 		env++;
@@ -407,10 +407,10 @@ int fw_setenv (int argc, char *argv[])
 	/* write environment back to flash */
 	if (flash_write ()) {
 		fprintf (stderr, "Error: can't write fw_env to flash\n");
-		return (-1);
+		return -1;
 	}
 
-	return (0);
+	return 0;
 }
 
 static int flash_write (void)
@@ -423,7 +423,7 @@ static int flash_write (void)
 		fprintf (stderr,
 			 "Can't open %s: %s\n",
 			 DEVNAME (curdev), strerror (errno));
-		return (-1);
+		return -1;
 	}
 
 	if (HaveRedundEnv) {
@@ -434,7 +434,7 @@ static int flash_write (void)
 				 "Can't open %s: %s\n",
 				 DEVNAME (otherdev),
 				 strerror (errno));
-			return (-1);
+			return -1;
 		}
 	} else {
 		otherdev = curdev;
@@ -460,21 +460,21 @@ static int flash_write (void)
 				 "Cannot malloc %d bytes: %s\n",
 				 resid,
 				 strerror (errno));
-			return (-1);
+			return -1;
 		}
 		if (lseek (fdr, DEVOFFSET (otherdev) + CFG_ENV_SIZE, SEEK_SET)
 		    == -1) {
 			fprintf (stderr, "seek error on %s: %s\n",
 				 DEVNAME (otherdev),
 				 strerror (errno));
-			return (-1);
+			return -1;
 		}
 		if ((rc = read (fdr, data, resid)) != resid) {
 			fprintf (stderr,
 				 "read error on %s: %s\n",
 				 DEVNAME (otherdev),
 				 strerror (errno));
-			return (-1);
+			return -1;
 		}
 	}
 
@@ -486,7 +486,7 @@ static int flash_write (void)
 		fprintf (stderr, "MTD erase error on %s: %s\n",
 			 DEVNAME (otherdev),
 			 strerror (errno));
-		return (-1);
+		return -1;
 	}
 
 	printf ("Done\n");
@@ -496,14 +496,14 @@ static int flash_write (void)
 		fprintf (stderr,
 			 "seek error on %s: %s\n",
 			 DEVNAME (otherdev), strerror (errno));
-		return (-1);
+		return -1;
 	}
 
 	if (write (fdr, environment.image, CFG_ENV_SIZE) != CFG_ENV_SIZE) {
 		fprintf (stderr,
 			 "Write error on %s: %s\n",
 			 DEVNAME (otherdev), strerror (errno));
-		return (-1);
+		return -1;
 	}
 
 	if (resid) {
@@ -511,7 +511,7 @@ static int flash_write (void)
 			fprintf (stderr,
 				 "write error on %s: %s\n",
 				 DEVNAME (curdev), strerror (errno));
-			return (-1);
+			return -1;
 		}
 		free (data);
 	}
@@ -521,14 +521,14 @@ static int flash_write (void)
 		    == -1) {
 			fprintf (stderr, "seek error on %s: %s\n",
 				 DEVNAME (curdev), strerror (errno));
-			return (-1);
+			return -1;
 		}
 		if (write (fd, &obsolete_flag, sizeof (obsolete_flag)) !=
 		    sizeof (obsolete_flag)) {
 			fprintf (stderr,
 				 "Write error on %s: %s\n",
 				 DEVNAME (curdev), strerror (errno));
-			return (-1);
+			return -1;
 		}
 	}
 	printf ("Done\n");
@@ -545,7 +545,7 @@ static int flash_write (void)
 				 "I/O error on %s: %s\n",
 				 DEVNAME (otherdev),
 				 strerror (errno));
-			return (-1);
+			return -1;
 		}
 	}
 	printf ("Done\n");
@@ -554,11 +554,11 @@ static int flash_write (void)
 		fprintf (stderr,
 			 "I/O error on %s: %s\n",
 			 DEVNAME (curdev), strerror (errno));
-		return (-1);
+		return -1;
 	}
 
 	/* everything ok */
-	return (0);
+	return 0;
 }
 
 static int flash_read (void)
@@ -569,31 +569,31 @@ static int flash_read (void)
 		fprintf (stderr,
 			 "Can't open %s: %s\n",
 			 DEVNAME (curdev), strerror (errno));
-		return (-1);
+		return -1;
 	}
 
 	if (lseek (fd, DEVOFFSET (curdev), SEEK_SET) == -1) {
 		fprintf (stderr,
 			 "seek error on %s: %s\n",
 			 DEVNAME (curdev), strerror (errno));
-		return (-1);
+		return -1;
 	}
 	if (read (fd, environment.image, CFG_ENV_SIZE) != CFG_ENV_SIZE) {
 		fprintf (stderr,
 			 "Read error on %s: %s\n",
 			 DEVNAME (curdev), strerror (errno));
-		return (-1);
+		return -1;
 	}
 
 	if (close (fd)) {
 		fprintf (stderr,
 			 "I/O error on %s: %s\n",
 			 DEVNAME (curdev), strerror (errno));
-		return (-1);
+		return -1;
 	}
 
 	/* everything ok */
-	return (0);
+	return 0;
 }
 
 /*
@@ -607,10 +607,10 @@ static char *envmatch (char * s1, char * s2)
 
 	while (*s1 == *s2++)
 		if (*s1++ == '=')
-			return (s2);
+			return s2;
 	if (*s1 == '\0' && *(s2 - 1) == '=')
-		return (s2);
-	return (NULL);
+		return s2;
+	return NULL;
 }
 
 /*
@@ -631,7 +631,7 @@ static int env_init (void)
 		fprintf (stderr,
 			"Not enough memory for environment (%ld bytes)\n",
 			CFG_ENV_SIZE);
-		return (errno);
+		return errno;
 	}
 
 	/* read environment from FLASH to local buffer */
@@ -640,7 +640,7 @@ static int env_init (void)
 		environment.image->single.data;
 	curdev = 0;
 	if (flash_read ()) {
-		return (errno);
+		return errno;
 	}
 
 	crc1 = crc32 (0, (uint8_t *) environment.data, ENV_SIZE);
@@ -659,12 +659,12 @@ static int env_init (void)
 			fprintf (stderr,
 				"Not enough memory for environment (%ld bytes)\n",
 				CFG_ENV_SIZE);
-			return (errno);
+			return errno;
 		}
 		environment.image = (union env_image *)addr2;
 
 		if (flash_read ()) {
-			return (errno);
+			return errno;
 		}
 
 		crc2 = crc32 (0, (uint8_t *) environment.image->redund.data,
@@ -730,7 +730,7 @@ static int env_init (void)
 		}
 		environment.data = environment.image->redund.data;
 	}
-	return (0);
+	return 0;
 }
 
 
-- 
1.5.4



More information about the U-Boot mailing list