summaryrefslogtreecommitdiffstats
path: root/drivers/of
diff options
context:
space:
mode:
authorAntony Pavlov <antonynpavlov@gmail.com>2017-04-17 13:42:10 +0300
committerSascha Hauer <s.hauer@pengutronix.de>2017-04-28 08:05:03 +0200
commit5a95e5fb082a62f427f8fe95b90dfd2a7f46aa2d (patch)
tree3c4cd2f2493e77baf31833be16032f9dbca23345 /drivers/of
parentc7ebd4c98bdc9c3b7bbb1203a6a32d1332698b03 (diff)
downloadbarebox-5a95e5fb082a62f427f8fe95b90dfd2a7f46aa2d.tar.gz
barebox-5a95e5fb082a62f427f8fe95b90dfd2a7f46aa2d.tar.xz
of: base: of_new_property(): use xstrdup() instead of strdup()
At the moment of_new_property() uses xfunctions for memory allocation so we can use xstrdup() instead of strdup() for code simplification. A side effect of this commmit is that the of_new_property() function can't return NULL anymore if CONFIG_OFTREE is set. Signed-off-by: Antony Pavlov <antonynpavlov@gmail.com> Signed-off-by: Sascha Hauer <s.hauer@pengutronix.de>
Diffstat (limited to 'drivers/of')
-rw-r--r--drivers/of/base.c7
1 files changed, 1 insertions, 6 deletions
diff --git a/drivers/of/base.c b/drivers/of/base.c
index 1161ce9793..c9bdd91810 100644
--- a/drivers/of/base.c
+++ b/drivers/of/base.c
@@ -1802,12 +1802,7 @@ struct property *of_new_property(struct device_node *node, const char *name,
struct property *prop;
prop = xzalloc(sizeof(*prop));
- prop->name = strdup(name);
- if (!prop->name) {
- free(prop);
- return NULL;
- }
-
+ prop->name = xstrdup(name);
prop->length = len;
prop->value = xzalloc(len);