aboutsummaryrefslogtreecommitdiffstats
path: root/drivers/of/fdt.c
diff options
context:
space:
mode:
authorGrant Likely <grant.likely@secretlab.ca>2010-07-23 03:48:25 -0400
committerGrant Likely <grant.likely@secretlab.ca>2010-07-24 18:51:52 -0400
commit9a6b2e588c7809e86161236da3d29581bf5f8402 (patch)
tree0aebb8e868615a2354042a376405cd73d80ef19e /drivers/of/fdt.c
parent883c2cfc8bcc0fd00c5d9f596fb8870f481b5bda (diff)
of: Fix phandle endian issues
The flat tree code wasn't fixing the endianness on phandle values when unflattening the tree, and the code in drivers/of wasn't always doing a be32_to_cpu before trying to dereference the phandle values. This patch fixes them. Signed-off-by: Grant Likely <grant.likely@secretlab.ca>
Diffstat (limited to 'drivers/of/fdt.c')
-rw-r--r--drivers/of/fdt.c4
1 files changed, 2 insertions, 2 deletions
diff --git a/drivers/of/fdt.c b/drivers/of/fdt.c
index dc876cbbd9dd..65da5aec7552 100644
--- a/drivers/of/fdt.c
+++ b/drivers/of/fdt.c
@@ -320,13 +320,13 @@ unsigned long __init unflatten_dt_node(unsigned long mem,
320 if ((strcmp(pname, "phandle") == 0) || 320 if ((strcmp(pname, "phandle") == 0) ||
321 (strcmp(pname, "linux,phandle") == 0)) { 321 (strcmp(pname, "linux,phandle") == 0)) {
322 if (np->phandle == 0) 322 if (np->phandle == 0)
323 np->phandle = *((u32 *)*p); 323 np->phandle = be32_to_cpup((__be32*)*p);
324 } 324 }
325 /* And we process the "ibm,phandle" property 325 /* And we process the "ibm,phandle" property
326 * used in pSeries dynamic device tree 326 * used in pSeries dynamic device tree
327 * stuff */ 327 * stuff */
328 if (strcmp(pname, "ibm,phandle") == 0) 328 if (strcmp(pname, "ibm,phandle") == 0)
329 np->phandle = *((u32 *)*p); 329 np->phandle = be32_to_cpup((__be32 *)*p);
330 pp->name = pname; 330 pp->name = pname;
331 pp->length = sz; 331 pp->length = sz;
332 pp->value = (void *)*p; 332 pp->value = (void *)*p;