[U-Boot] [PATCH v4 5/9] main: Use get/setenv_ulong()

Simon Glass sjg at chromium.org
Wed May 15 18:23:57 CEST 2013


These functions are now available, so use them to avoid extra code here.

Signed-off-by: Simon Glass <sjg at chromium.org>
Reviewed-by: Joe Hershberger <joe.hershberger at ni.com>
---
Changes in v4: None
Changes in v3: None

 common/main.c | 8 ++------
 1 file changed, 2 insertions(+), 6 deletions(-)

diff --git a/common/main.c b/common/main.c
index 159b8e1..38fadac 100644
--- a/common/main.c
+++ b/common/main.c
@@ -352,18 +352,14 @@ static void process_boot_delay(void)
 #ifdef CONFIG_BOOTCOUNT_LIMIT
 	unsigned long bootcount = 0;
 	unsigned long bootlimit = 0;
-	char *bcs;
-	char bcs_set[16];
 #endif /* CONFIG_BOOTCOUNT_LIMIT */
 
 #ifdef CONFIG_BOOTCOUNT_LIMIT
 	bootcount = bootcount_load();
 	bootcount++;
 	bootcount_store (bootcount);
-	sprintf (bcs_set, "%lu", bootcount);
-	setenv ("bootcount", bcs_set);
-	bcs = getenv ("bootlimit");
-	bootlimit = bcs ? simple_strtoul (bcs, NULL, 10) : 0;
+	setenv_ulong("bootcount", bootcount);
+	bootlimit = getenv_ulong("bootlimit", 10, 0);
 #endif /* CONFIG_BOOTCOUNT_LIMIT */
 
 	s = getenv ("bootdelay");
-- 
1.8.2.1



More information about the U-Boot mailing list