diff options
author | Antony Pavlov <antonynpavlov@gmail.com> | 2017-04-17 13:42:10 +0300 |
---|---|---|
committer | Sascha Hauer <s.hauer@pengutronix.de> | 2017-04-28 08:05:03 +0200 |
commit | 5a95e5fb082a62f427f8fe95b90dfd2a7f46aa2d (patch) | |
tree | 3c4cd2f2493e77baf31833be16032f9dbca23345 | |
parent | c7ebd4c98bdc9c3b7bbb1203a6a32d1332698b03 (diff) | |
download | barebox-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>
-rw-r--r-- | drivers/of/base.c | 7 |
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); |