[PATCH 1/2] parameter: return empty string for unset parameters
Sascha Hauer
s.hauer at pengutronix.de
Sun May 13 08:04:28 EDT 2012
Currently we return NULL for unset parameters. As we can't set them
back to NULL once set this is not very consistent. Return an empty
string instead.
Signed-off-by: Sascha Hauer <s.hauer at pengutronix.de>
---
lib/parameter.c | 2 +-
1 file changed, 1 insertion(+), 1 deletion(-)
diff --git a/lib/parameter.c b/lib/parameter.c
index baf7720..c75c21e 100644
--- a/lib/parameter.c
+++ b/lib/parameter.c
@@ -135,7 +135,7 @@ int dev_param_set_generic(struct device_d *dev, struct param_d *p,
static const char *param_get_generic(struct device_d *dev, struct param_d *p)
{
- return p->value;
+ return p->value ? p->value : "";
}
static struct param_d *__dev_add_param(struct device_d *dev, const char *name,
--
1.7.10
More information about the barebox
mailing list