[PATCH 1/1] of_add_memory: check the device_type is memory

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

 



Signed-off-by: Jean-Christophe PLAGNIOL-VILLARD <plagnioj@xxxxxxxxxxxx>
---
 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


_______________________________________________
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