Thread (1 message) 1 message, 1 author, 2012-01-15
DORMANTno replies

[PATCH 03/17] fdt: Correct GPIO name access in fdtdec

From: Simon Glass <hidden>
Date: 2012-01-15 00:47:15
Also in: u-boot
Subsystem: library code, the rest · Maintainers: Andrew Morton, Linus Torvalds

This was missing an fdt32_to_cpu() call so got the name pointer wrong.
If the GPIO module looks at it, this would cause a problem.

Signed-off-by: Simon Glass <redacted>
---
 lib/fdtdec.c |    3 ++-
 1 files changed, 2 insertions(+), 1 deletions(-)
diff --git a/lib/fdtdec.c b/lib/fdtdec.c
index bcb2343..f7d0c95 100644
--- a/lib/fdtdec.c
+++ b/lib/fdtdec.c
@@ -418,7 +418,7 @@ static int fdtdec_decode_gpios(const void *blob, int node,
 	}
 
 	/* We will use the name to tag the GPIO */
-	name = fdt_string(blob, prop->nameoff);
+	name = fdt_string(blob, fdt32_to_cpu(prop->nameoff));
 	cell = (u32 *)prop->data;
 	len /= sizeof(u32) * 3;		/* 3 cells per GPIO record */
 	if (len > max_count) {
@@ -444,6 +444,7 @@ int fdtdec_decode_gpio(const void *blob, int node, const char *prop_name,
 
 	debug("%s: %s\n", __func__, prop_name);
 	gpio->gpio = FDT_GPIO_NONE;
+	gpio->name = NULL;
 	err = fdtdec_decode_gpios(blob, node, prop_name, gpio, 1);
 	return err == 1 ? 0 : err;
 }
-- 
1.7.7.3
Keyboard shortcuts
hback out one level
jnext message in thread
kprevious message in thread
ldrill in
Escclose help / fold thread tree
?toggle this help