[PATCH 24/29] of: make value of property in of_new_property optional

Sascha Hauer s.hauer at pengutronix.de
Tue Feb 26 15:18:51 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 6b12979..c47801a 100644
--- a/drivers/of/base.c
+++ b/drivers/of/base.c
@@ -676,8 +676,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