Commit b85cdd49 authored by David S. Miller's avatar David S. Miller

[SPARC]: Fix bus handling in build_device_resources().

We mistakedly modify 'bus' in the innermost loop.  What
should happen is that at each register index iteration,
we start with the same 'bus'.

So preserve it's value at the top level, and use a loop
local variable 'dbus' for iteration.

This bug causes registers other than the first to be
decoded improperly.
Signed-off-by: default avatarDavid S. Miller <davem@davemloft.net>
parent 562aa1d4
...@@ -495,7 +495,7 @@ static void __init build_device_resources(struct of_device *op, ...@@ -495,7 +495,7 @@ static void __init build_device_resources(struct of_device *op,
u32 *reg = (preg + (index * ((na + ns) * 4))); u32 *reg = (preg + (index * ((na + ns) * 4)));
struct device_node *dp = op->node; struct device_node *dp = op->node;
struct device_node *pp = p_op->node; struct device_node *pp = p_op->node;
struct of_bus *pbus; struct of_bus *pbus, *dbus;
u64 size, result = OF_BAD_ADDR; u64 size, result = OF_BAD_ADDR;
unsigned long flags; unsigned long flags;
int dna, dns; int dna, dns;
...@@ -516,6 +516,7 @@ static void __init build_device_resources(struct of_device *op, ...@@ -516,6 +516,7 @@ static void __init build_device_resources(struct of_device *op,
dna = na; dna = na;
dns = ns; dns = ns;
dbus = bus;
while (1) { while (1) {
dp = pp; dp = pp;
...@@ -528,13 +529,13 @@ static void __init build_device_resources(struct of_device *op, ...@@ -528,13 +529,13 @@ static void __init build_device_resources(struct of_device *op,
pbus = of_match_bus(pp); pbus = of_match_bus(pp);
pbus->count_cells(dp, &pna, &pns); pbus->count_cells(dp, &pna, &pns);
if (build_one_resource(dp, bus, pbus, addr, if (build_one_resource(dp, dbus, pbus, addr,
dna, dns, pna)) dna, dns, pna))
break; break;
dna = pna; dna = pna;
dns = pns; dns = pns;
bus = pbus; dbus = pbus;
} }
build_res: build_res:
......
...@@ -581,7 +581,7 @@ static void __init build_device_resources(struct of_device *op, ...@@ -581,7 +581,7 @@ static void __init build_device_resources(struct of_device *op,
u32 *reg = (preg + (index * ((na + ns) * 4))); u32 *reg = (preg + (index * ((na + ns) * 4)));
struct device_node *dp = op->node; struct device_node *dp = op->node;
struct device_node *pp = p_op->node; struct device_node *pp = p_op->node;
struct of_bus *pbus; struct of_bus *pbus, *dbus;
u64 size, result = OF_BAD_ADDR; u64 size, result = OF_BAD_ADDR;
unsigned long flags; unsigned long flags;
int dna, dns; int dna, dns;
...@@ -599,6 +599,7 @@ static void __init build_device_resources(struct of_device *op, ...@@ -599,6 +599,7 @@ static void __init build_device_resources(struct of_device *op,
dna = na; dna = na;
dns = ns; dns = ns;
dbus = bus;
while (1) { while (1) {
dp = pp; dp = pp;
...@@ -611,13 +612,13 @@ static void __init build_device_resources(struct of_device *op, ...@@ -611,13 +612,13 @@ static void __init build_device_resources(struct of_device *op,
pbus = of_match_bus(pp); pbus = of_match_bus(pp);
pbus->count_cells(dp, &pna, &pns); pbus->count_cells(dp, &pna, &pns);
if (build_one_resource(dp, bus, pbus, addr, if (build_one_resource(dp, dbus, pbus, addr,
dna, dns, pna)) dna, dns, pna))
break; break;
dna = pna; dna = pna;
dns = pns; dns = pns;
bus = pbus; dbus = pbus;
} }
build_res: build_res:
......
Markdown is supported
0%
or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment