[PATCH 2/2] of: base: of_new_property(): use xstrdup() instead of strdup()

[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

 



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@xxxxxxxxx>
---
 drivers/of/base.c | 7 +------
 1 file changed, 1 insertion(+), 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);
 
-- 
2.11.0


_______________________________________________
barebox mailing list
barebox@xxxxxxxxxxxxxxxxxxx
http://lists.infradead.org/mailman/listinfo/barebox



[Index of Archives]     [Linux Embedded]     [Linux USB Devel]     [Linux Audio Users]     [Yosemite News]     [Linux Kernel]     [Linux SCSI]     [XFree86]

  Powered by Linux