powerpc/powernv/eeh: Skip finding bus for VF resets
authorRussell Currey <ruscur@russell.cc>
Mon, 12 Sep 2016 04:17:23 +0000 (14:17 +1000)
committerMichael Ellerman <mpe@ellerman.id.au>
Thu, 22 Sep 2016 21:54:21 +0000 (07:54 +1000)
When the PE used in pnv_eeh_reset() is that of a VF,
pnv_eeh_reset_vf_pe() is used.  Unlike the other reset functions called
in pnv_eeh_reset(), the VF reset doesn't require a bus, and if a bus was
missing the function would error out before resetting the VF PE.

To avoid this, reorder the VF reset function to occur before finding and
checking the bus.

Signed-off-by: Russell Currey <ruscur@russell.cc>
Reviewed-by: Andrew Donnellan <andrew.donnellan@au1.ibm.com>
Signed-off-by: Michael Ellerman <mpe@ellerman.id.au>
arch/powerpc/platforms/powernv/eeh-powernv.c

index cb08e6aaf9bdcad288171d901fdc0edbd38dfb35..68f1a854f97dac4b4de7e2ecd892ec0913464398 100644 (file)
@@ -1090,14 +1090,15 @@ static int pnv_eeh_reset(struct eeh_pe *pe, int option)
                }
        }
 
+       if (pe->type & EEH_PE_VF)
+               return pnv_eeh_reset_vf_pe(pe, option);
+
        bus = eeh_pe_bus_get(pe);
        if (!bus) {
                pr_err("%s: Cannot find PCI bus for PHB#%d-PE#%x\n",
                        __func__, pe->phb->global_number, pe->addr);
                return -EIO;
        }
-       if (pe->type & EEH_PE_VF)
-               return pnv_eeh_reset_vf_pe(pe, option);
 
        if (pci_is_root_bus(bus) ||
            pci_is_root_bus(bus->parent))