mail archive of the barebox mailing list
 help / color / mirror / Atom feed
* [PATCH] of: Fix endless loop in of_add_memory
@ 2013-08-14  7:35 Sascha Hauer
  0 siblings, 0 replies; only message in thread
From: Sascha Hauer @ 2013-08-14  7:35 UTC (permalink / raw)
  To: barebox

of_add_memory is stuck in an endless loop when a memory bank with zero
size is passed. Fix this.

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

diff --git a/drivers/of/base.c b/drivers/of/base.c
index 34a06c2..33dfd5a 100644
--- a/drivers/of/base.c
+++ b/drivers/of/base.c
@@ -1555,8 +1555,11 @@ int of_add_memory(struct device_node *node, bool dump)
 		return -ENXIO;
 
 	while (!of_address_to_resource(node, n, &res)) {
-		if (!resource_size(&res))
+		if (!resource_size(&res)) {
+			n++;
 			continue;
+		}
+
 		of_add_memory_bank(node, dump, n,
 				res.start, resource_size(&res));
 		n++;
-- 
1.8.4.rc2


_______________________________________________
barebox mailing list
barebox@lists.infradead.org
http://lists.infradead.org/mailman/listinfo/barebox

^ permalink raw reply	[flat|nested] only message in thread

only message in thread, other threads:[~2013-08-14  7:35 UTC | newest]

Thread overview: (only message) (download: mbox.gz / follow: Atom feed)
-- links below jump to the message on this page --
2013-08-14  7:35 [PATCH] of: Fix endless loop in of_add_memory Sascha Hauer

This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox