[PATCH 26/37] of: make value of property in of_new_property optional

Sascha Hauer s.hauer at pengutronix.de
Mon Mar 4 04:53:29 EST 2013


Signed-off-by: Sascha Hauer <s.hauer at pengutronix.de>
---
 drivers/of/base.c |    6 ++++--
 1 file changed, 4 insertions(+), 2 deletions(-)

diff --git a/drivers/of/base.c b/drivers/of/base.c
index 9f9d9a0..5891138 100644
--- a/drivers/of/base.c
+++ b/drivers/of/base.c
@@ -677,8 +677,10 @@ struct property *of_new_property(struct device_node *node, const char *name,
 
 	prop->name = strdup(name);
 	prop->length = len;
-	prop->value = xzalloc(len);
-	memcpy(prop->value, data, len);
+	if (len) {
+		prop->value = xzalloc(len);
+		memcpy(prop->value, data, len);
+	}
 
 	list_add_tail(&prop->list, &node->properties);
 
-- 
1.7.10.4




More information about the barebox mailing list