Commit ee7e2f3c authored by Hauke Mehrtens's avatar Hauke Mehrtens Committed by John Crispin

MIPS: BCM47XX: use common error codes in nvram reads

Instead of using our own error codes use some common codes.
Signed-off-by: default avatarHauke Mehrtens <hauke@hauke-m.de>
Patchwork: http://patchwork.linux-mips.org/patch/4739/Signed-off-by: default avatarJohn Crispin <blogic@openwrt.org>
parent bb765632
...@@ -124,7 +124,7 @@ int nvram_getenv(char *name, char *val, size_t val_len) ...@@ -124,7 +124,7 @@ int nvram_getenv(char *name, char *val, size_t val_len)
char *var, *value, *end, *eq; char *var, *value, *end, *eq;
if (!name) if (!name)
return NVRAM_ERR_INV_PARAM; return -EINVAL;
if (!nvram_buf[0]) if (!nvram_buf[0])
early_nvram_init(); early_nvram_init();
...@@ -143,6 +143,6 @@ int nvram_getenv(char *name, char *val, size_t val_len) ...@@ -143,6 +143,6 @@ int nvram_getenv(char *name, char *val, size_t val_len)
return snprintf(val, val_len, "%s", value); return snprintf(val, val_len, "%s", value);
} }
} }
return NVRAM_ERR_ENVNOTFOUND; return -ENOENT;
} }
EXPORT_SYMBOL(nvram_getenv); EXPORT_SYMBOL(nvram_getenv);
...@@ -51,7 +51,7 @@ static int get_nvram_var(const char *prefix, const char *postfix, ...@@ -51,7 +51,7 @@ static int get_nvram_var(const char *prefix, const char *postfix,
create_key(prefix, postfix, name, key, sizeof(key)); create_key(prefix, postfix, name, key, sizeof(key));
err = nvram_getenv(key, buf, len); err = nvram_getenv(key, buf, len);
if (fallback && err == NVRAM_ERR_ENVNOTFOUND && prefix) { if (fallback && err == -ENOENT && prefix) {
create_key(NULL, postfix, name, key, sizeof(key)); create_key(NULL, postfix, name, key, sizeof(key));
err = nvram_getenv(key, buf, len); err = nvram_getenv(key, buf, len);
} }
......
...@@ -32,9 +32,6 @@ struct nvram_header { ...@@ -32,9 +32,6 @@ struct nvram_header {
#define NVRAM_MAX_VALUE_LEN 255 #define NVRAM_MAX_VALUE_LEN 255
#define NVRAM_MAX_PARAM_LEN 64 #define NVRAM_MAX_PARAM_LEN 64
#define NVRAM_ERR_INV_PARAM -8
#define NVRAM_ERR_ENVNOTFOUND -9
extern int nvram_getenv(char *name, char *val, size_t val_len); extern int nvram_getenv(char *name, char *val, size_t val_len);
static inline void nvram_parse_macaddr(char *buf, u8 macaddr[6]) static inline void nvram_parse_macaddr(char *buf, u8 macaddr[6])
......
Markdown is supported
0%
or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment