aboutsummaryrefslogtreecommitdiffstats
path: root/arch/mips/bcm47xx
diff options
context:
space:
mode:
authorHauke Mehrtens <hauke@hauke-m.de>2012-12-26 14:53:26 -0500
committerJohn Crispin <blogic@openwrt.org>2013-02-15 13:01:57 -0500
commit924ffb7dba80f44211d4ba08157496c6e37d307a (patch)
treeddf105932259ac4a1dbe64a2e5120729f58a330d /arch/mips/bcm47xx
parent111bd981e2216827aab95503596501ab71bc7a7d (diff)
MIPS: BCM47XX: trim the nvram values for parsing
Some nvram values on some devices have a newline character at the end of the value, that caused read errors. Trim the string before reading the number. Signed-off-by: Hauke Mehrtens <hauke@hauke-m.de> Patchwork: http://patchwork.linux-mips.org/patch/4745/ Signed-off-by: John Crispin <blogic@openwrt.org>
Diffstat (limited to 'arch/mips/bcm47xx')
-rw-r--r--arch/mips/bcm47xx/sprom.c6
1 files changed, 3 insertions, 3 deletions
diff --git a/arch/mips/bcm47xx/sprom.c b/arch/mips/bcm47xx/sprom.c
index 89b9bf46b13b..38492301a7b5 100644
--- a/arch/mips/bcm47xx/sprom.c
+++ b/arch/mips/bcm47xx/sprom.c
@@ -71,7 +71,7 @@ static void nvram_read_ ## type (const char *prefix, \
71 fallback); \ 71 fallback); \
72 if (err < 0) \ 72 if (err < 0) \
73 return; \ 73 return; \
74 err = kstrto ## type (buf, 0, &var); \ 74 err = kstrto ## type(strim(buf), 0, &var); \
75 if (err) { \ 75 if (err) { \
76 pr_warn("can not parse nvram name %s%s%s with value %s got %i\n", \ 76 pr_warn("can not parse nvram name %s%s%s with value %s got %i\n", \
77 prefix, name, postfix, buf, err); \ 77 prefix, name, postfix, buf, err); \
@@ -99,7 +99,7 @@ static void nvram_read_u32_2(const char *prefix, const char *name,
99 err = get_nvram_var(prefix, NULL, name, buf, sizeof(buf), fallback); 99 err = get_nvram_var(prefix, NULL, name, buf, sizeof(buf), fallback);
100 if (err < 0) 100 if (err < 0)
101 return; 101 return;
102 err = kstrtou32(buf, 0, &val); 102 err = kstrtou32(strim(buf), 0, &val);
103 if (err) { 103 if (err) {
104 pr_warn("can not parse nvram name %s%s with value %s got %i\n", 104 pr_warn("can not parse nvram name %s%s with value %s got %i\n",
105 prefix, name, buf, err); 105 prefix, name, buf, err);
@@ -120,7 +120,7 @@ static void nvram_read_leddc(const char *prefix, const char *name,
120 err = get_nvram_var(prefix, NULL, name, buf, sizeof(buf), fallback); 120 err = get_nvram_var(prefix, NULL, name, buf, sizeof(buf), fallback);
121 if (err < 0) 121 if (err < 0)
122 return; 122 return;
123 err = kstrtou32(buf, 0, &val); 123 err = kstrtou32(strim(buf), 0, &val);
124 if (err) { 124 if (err) {
125 pr_warn("can not parse nvram name %s%s with value %s got %i\n", 125 pr_warn("can not parse nvram name %s%s with value %s got %i\n",
126 prefix, name, buf, err); 126 prefix, name, buf, err);