summaryrefslogtreecommitdiffstats
path: root/drivers
diff options
context:
space:
mode:
authorJean-Christophe PLAGNIOL-VILLARD <plagnioj@jcrosoft.com>2013-02-13 19:09:05 +0100
committerSascha Hauer <s.hauer@pengutronix.de>2013-02-14 09:27:35 +0100
commit210bb761d89d84081f47ecacef6ce637348a7564 (patch)
tree92a68702004d601fb01fe4864e226f6cd4afdee6 /drivers
parent9acb6113f0c7e40f70d20bd8c62b4f5dc9caa493 (diff)
downloadbarebox-210bb761d89d84081f47ecacef6ce637348a7564.tar.gz
barebox-210bb761d89d84081f47ecacef6ce637348a7564.tar.xz
of_add_memory: check the device_type is memory
Signed-off-by: Jean-Christophe PLAGNIOL-VILLARD <plagnioj@jcrosoft.com> Signed-off-by: Sascha Hauer <s.hauer@pengutronix.de>
Diffstat (limited to 'drivers')
-rw-r--r--drivers/of/base.c11
1 files changed, 7 insertions, 4 deletions
diff --git a/drivers/of/base.c b/drivers/of/base.c
index ee4d22ed72..1625257667 100644
--- a/drivers/of/base.c
+++ b/drivers/of/base.c
@@ -693,12 +693,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);