summaryrefslogtreecommitdiff
path: root/common
diff options
context:
space:
mode:
authorTom Wai-Hong Tam <waihong@chromium.org>2011-08-12 17:40:39 +0800
committerSimon Glass <sjg@chromium.org>2011-08-29 10:59:30 -0700
commit82eb16399e9eaf25a27a0487f2c815f9f6486d43 (patch)
tree1c4634b5b43b22caa9f8baa0e1f73421ead88070 /common
parentecc8c1e8ec9339a11a6dd79a3bd4ed65da79b189 (diff)
Fix bug of get_addr() in fdt_decode.c.
The original description is to match the field holding "one address with no trailing data". So the if condition should be equal length: if (cell && len != sizeof(addr_t)) But it still worked fine except the lcd frame-buffer value because all other fields are somethings like: reg = <0x70006040 0x40>, not exactly one address. So this CL fixed the matching to either one address or two addresses. BUG=chrome-os-partner:5338 TEST=build without error and manually print the frame-buffer value to verify. Change-Id: I7a1a64feafc4e883f23044c1d04da09b2122ff40 Reviewed-on: http://gerrit.chromium.org/gerrit/5875 Tested-by: Tom Wai-Hong Tam <waihong@chromium.org> Reviewed-by: Bryan Freed <bfreed@chromium.org>
Diffstat (limited to 'common')
-rw-r--r--common/fdt_decode.c6
1 files changed, 3 insertions, 3 deletions
diff --git a/common/fdt_decode.c b/common/fdt_decode.c
index 8192aa10af..ef52185f1c 100644
--- a/common/fdt_decode.c
+++ b/common/fdt_decode.c
@@ -66,8 +66,8 @@ static int find_alias_node(const void *blob, const char *name)
/**
* Look up an address property in a node and return it as an address.
- * The property must hold exactly one address with no trailing data.
- * This is only tested on 32-bit machines.
+ * The property must hold either one address with no trailing data or
+ * one address with a length. This is only tested on 32-bit machines.
*
* @param blob FDT blob
* @param node node to examine
@@ -80,7 +80,7 @@ static addr_t get_addr(const void *blob, int node, const char *prop_name)
int len;
cell = fdt_getprop(blob, node, prop_name, &len);
- if (cell && len != sizeof(addr_t))
+ if (cell && (len == sizeof(addr_t) || len == sizeof(addr_t) * 2))
return addr_to_cpu(*cell);
return ADDR_T_NONE;
}