[PATCH 1/1] of_add_memory: check the device_type is memory
Jean-Christophe PLAGNIOL-VILLARD
plagnioj at jcrosoft.com
Wed Feb 13 13:09:05 EST 2013
Signed-off-by: Jean-Christophe PLAGNIOL-VILLARD <plagnioj at jcrosoft.com>
---
drivers/of/base.c | 11 +++++++----
1 file changed, 7 insertions(+), 4 deletions(-)
diff --git a/drivers/of/base.c b/drivers/of/base.c
index f2986ab..fd9b8e1 100644
--- a/drivers/of/base.c
+++ b/drivers/of/base.c
@@ -738,12 +738,15 @@ int of_add_memory(struct device_node *node, bool dump)
{
int na, nc;
const __be32 *reg, *endp;
- int len, r = 0;
+ int len, r = 0, ret;
static char str[6];
- struct property *type;
+ const char *device_type;
- type = of_find_property(node, "device_type");
- if (!type)
+ ret = of_property_read_string(node, "device_type", &device_type);
+ if (ret)
+ return -ENXIO;
+
+ if (strcmp(device_type, "memory"))
return -ENXIO;
of_bus_count_cells(node, &na, &nc);
--
1.7.10.4
More information about the barebox
mailing list