[Skiboot] [PATCH] firenze-pci: Fix infinite loop in firenze_pci_add_loc_code()

Oliver O'Halloran oohall at gmail.com
Wed Feb 26 16:29:34 AEDT 2020


If ibm,slot-location-code isn't in a PCI device's parent node the loop
to search for it will never terminate since p = np->parent is always
going to return the same result.

Fixes: ab1b05d29f5e ("PCI: create optional loc-code platform callback")
Signed-off-by: Oliver O'Halloran <oohall at gmail.com>
---
 platforms/ibm-fsp/firenze-pci.c | 2 +-
 1 file changed, 1 insertion(+), 1 deletion(-)

diff --git a/platforms/ibm-fsp/firenze-pci.c b/platforms/ibm-fsp/firenze-pci.c
index efbe5525da4b..12e0e98991aa 100644
--- a/platforms/ibm-fsp/firenze-pci.c
+++ b/platforms/ibm-fsp/firenze-pci.c
@@ -987,7 +987,7 @@ void firenze_pci_add_loc_code(struct dt_node *np, struct pci_device *pd)
 	 * prefer fully-qualified slot-location-code, walk-up parent tree
 	 * to find one
 	 */
-	for (p = np->parent; p; p = np->parent) {
+	for (p = np->parent; p; p = p->parent) {
 		blcode = dt_prop_get_def(p, "ibm,slot-location-code", NULL);
 		if (blcode)
 			break;
-- 
2.21.1



More information about the Skiboot mailing list