Commit 47a34861 authored by Hauke Mehrtens's avatar Hauke Mehrtens Committed by Ralf Baechle

MIPS: BCM47xx: Fix nvram_getenv return value.

Nvram_getenv should behave like cfe_getenv. cfe_getenv returns 0 on
success and -9 if the value was not found. If the input was wrong -8
will be returned by cfe_getenv.  Change nvram_getenv to do the same.
Signed-off-by: default avatarHauke Mehrtens <hauke@hauke-m.de>
Cc: Waldemar Brodkorb <wbx@openadk.org>
Cc: linux-mips@linux-mips.org
Patchwork: https://patchwork.linux-mips.org/patch/1520/Signed-off-by: default avatarRalf Baechle <ralf@linux-mips.org>
parent 2b5987ab
...@@ -69,7 +69,7 @@ int nvram_getenv(char *name, char *val, size_t val_len) ...@@ -69,7 +69,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 1; return NVRAM_ERR_INV_PARAM;
if (!nvram_buf[0]) if (!nvram_buf[0])
early_nvram_init(); early_nvram_init();
...@@ -89,6 +89,6 @@ int nvram_getenv(char *name, char *val, size_t val_len) ...@@ -89,6 +89,6 @@ int nvram_getenv(char *name, char *val, size_t val_len)
return 0; return 0;
} }
} }
return 1; return NVRAM_ERR_ENVNOTFOUND;
} }
EXPORT_SYMBOL(nvram_getenv); EXPORT_SYMBOL(nvram_getenv);
...@@ -31,6 +31,9 @@ struct nvram_header { ...@@ -31,6 +31,9 @@ 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);
#endif #endif
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