We should use of_get_next_child() in the EEH gather_pci_data()
routine to safely traverse the node's children.

Signed-off-by: Michael Ellerman <[EMAIL PROTECTED]>
---
 arch/powerpc/platforms/pseries/eeh.c |    4 +---
 1 files changed, 1 insertions(+), 3 deletions(-)

diff --git a/arch/powerpc/platforms/pseries/eeh.c 
b/arch/powerpc/platforms/pseries/eeh.c
index 22322b3..7309caa 100644
--- a/arch/powerpc/platforms/pseries/eeh.c
+++ b/arch/powerpc/platforms/pseries/eeh.c
@@ -238,12 +238,10 @@ static size_t gather_pci_data(struct pci_dn *pdn, char * 
buf, size_t len)
 
        /* Gather status on devices under the bridge */
        if (dev->class >> 16 == PCI_BASE_CLASS_BRIDGE) {
-               dn = pdn->node->child;
-               while (dn) {
+               for (dn = NULL; (dn = of_get_next_child(pdn->node, dn));) {
                        pdn = PCI_DN(dn);
                        if (pdn)
                                n += gather_pci_data(pdn, buf+n, len-n);
-                       dn = dn->sibling;
                }
        }
 
-- 
1.5.2.rc1.1884.g59b20

_______________________________________________
Linuxppc-dev mailing list
Linuxppc-dev@ozlabs.org
https://ozlabs.org/mailman/listinfo/linuxppc-dev

Reply via email to