diff options
author | David S. Miller <davem@sunset.davemloft.net> | 2007-03-01 02:20:12 -0500 |
---|---|---|
committer | David S. Miller <davem@sunset.davemloft.net> | 2007-03-02 18:22:49 -0500 |
commit | b85cdd490ac52ee039636f809b9b98b1300fcf3d (patch) | |
tree | 0c35fa87f07eda71128ecfaaf62f37c613918adf /arch/sparc64/kernel/of_device.c | |
parent | 562aa1d4c6a874373f9a48ac184f662fbbb06a04 (diff) |
[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: David S. Miller <davem@davemloft.net>
Diffstat (limited to 'arch/sparc64/kernel/of_device.c')
-rw-r--r-- | arch/sparc64/kernel/of_device.c | 7 |
1 files changed, 4 insertions, 3 deletions
diff --git a/arch/sparc64/kernel/of_device.c b/arch/sparc64/kernel/of_device.c index ad74e5e8778e..1f4598524bdd 100644 --- a/arch/sparc64/kernel/of_device.c +++ b/arch/sparc64/kernel/of_device.c | |||
@@ -581,7 +581,7 @@ static void __init build_device_resources(struct of_device *op, | |||
581 | u32 *reg = (preg + (index * ((na + ns) * 4))); | 581 | u32 *reg = (preg + (index * ((na + ns) * 4))); |
582 | struct device_node *dp = op->node; | 582 | struct device_node *dp = op->node; |
583 | struct device_node *pp = p_op->node; | 583 | struct device_node *pp = p_op->node; |
584 | struct of_bus *pbus; | 584 | struct of_bus *pbus, *dbus; |
585 | u64 size, result = OF_BAD_ADDR; | 585 | u64 size, result = OF_BAD_ADDR; |
586 | unsigned long flags; | 586 | unsigned long flags; |
587 | int dna, dns; | 587 | int dna, dns; |
@@ -599,6 +599,7 @@ static void __init build_device_resources(struct of_device *op, | |||
599 | 599 | ||
600 | dna = na; | 600 | dna = na; |
601 | dns = ns; | 601 | dns = ns; |
602 | dbus = bus; | ||
602 | 603 | ||
603 | while (1) { | 604 | while (1) { |
604 | dp = pp; | 605 | dp = pp; |
@@ -611,13 +612,13 @@ static void __init build_device_resources(struct of_device *op, | |||
611 | pbus = of_match_bus(pp); | 612 | pbus = of_match_bus(pp); |
612 | pbus->count_cells(dp, &pna, &pns); | 613 | pbus->count_cells(dp, &pna, &pns); |
613 | 614 | ||
614 | if (build_one_resource(dp, bus, pbus, addr, | 615 | if (build_one_resource(dp, dbus, pbus, addr, |
615 | dna, dns, pna)) | 616 | dna, dns, pna)) |
616 | break; | 617 | break; |
617 | 618 | ||
618 | dna = pna; | 619 | dna = pna; |
619 | dns = pns; | 620 | dns = pns; |
620 | bus = pbus; | 621 | dbus = pbus; |
621 | } | 622 | } |
622 | 623 | ||
623 | build_res: | 624 | build_res: |