* [PATCH] param: add error check to dev_param_set_generic()
@ 2015-01-29 2:42 Masahiro Yamada
2015-01-29 8:55 ` Sascha Hauer
0 siblings, 1 reply; 2+ messages in thread
From: Masahiro Yamada @ 2015-01-29 2:42 UTC (permalink / raw)
To: barebox
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>
---
lib/parameter.c | 2 +-
1 file changed, 1 insertion(+), 1 deletion(-)
diff --git a/lib/parameter.c b/lib/parameter.c
index d337ef3..71262c4 100644
--- a/lib/parameter.c
+++ b/lib/parameter.c
@@ -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)
--
1.9.1
_______________________________________________
barebox mailing list
barebox@lists.infradead.org
http://lists.infradead.org/mailman/listinfo/barebox
^ permalink raw reply [flat|nested] 2+ messages in thread
* Re: [PATCH] param: add error check to dev_param_set_generic()
2015-01-29 2:42 [PATCH] param: add error check to dev_param_set_generic() Masahiro Yamada
@ 2015-01-29 8:55 ` Sascha Hauer
0 siblings, 0 replies; 2+ messages in thread
From: Sascha Hauer @ 2015-01-29 8:55 UTC (permalink / raw)
To: Masahiro Yamada; +Cc: barebox
On Thu, Jan 29, 2015 at 11:42:13AM +0900, Masahiro Yamada wrote:
> 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>
Applied, thanks
Sascha
--
Pengutronix e.K. | |
Industrial Linux Solutions | http://www.pengutronix.de/ |
Peiner Str. 6-8, 31137 Hildesheim, Germany | Phone: +49-5121-206917-0 |
Amtsgericht Hildesheim, HRA 2686 | Fax: +49-5121-206917-5555 |
_______________________________________________
barebox mailing list
barebox@lists.infradead.org
http://lists.infradead.org/mailman/listinfo/barebox
^ permalink raw reply [flat|nested] 2+ messages in thread
end of thread, other threads:[~2015-01-29 8:55 UTC | newest]
Thread overview: 2+ messages (download: mbox.gz / follow: Atom feed)
-- links below jump to the message on this page --
2015-01-29 2:42 [PATCH] param: add error check to dev_param_set_generic() Masahiro Yamada
2015-01-29 8:55 ` Sascha Hauer
This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox