9
0
Fork 0

param: add error check to dev_param_set_generic()

The function dev_param_set_generic() may fail because of
out of memory.  If so, return -ENOMEM.

Signed-off-by: Masahiro Yamada <yamada.m@jp.panasonic.com>
Signed-off-by: Sascha Hauer <s.hauer@pengutronix.de>
This commit is contained in:
Masahiro Yamada 2015-01-29 11:42:13 +09:00 committed by Sascha Hauer
parent a1b347f24c
commit 31cbf0880d
1 changed files with 1 additions and 1 deletions

View File

@ -114,7 +114,7 @@ int dev_param_set_generic(struct device_d *dev, struct param_d *p,
return 0;
}
p->value = strdup(val);
return 0;
return p->value ? 0 : -ENOMEM;
}
static const char *param_get_generic(struct device_d *dev, struct param_d *p)