aboutsummaryrefslogtreecommitdiffstats
path: root/arch/powerpc/include/asm
diff options
context:
space:
mode:
authorThadeu Lima de Souza Cascardo <cascardo@linux.vnet.ibm.com>2012-01-11 04:09:58 -0500
committerBenjamin Herrenschmidt <benh@kernel.crashing.org>2012-02-13 23:01:39 -0500
commit778a785f02ad846446e91dab49331bd7d853c514 (patch)
tree4f8969fe08df41ced83f44ec9dd459ab10e72d69 /arch/powerpc/include/asm
parent444080d13d05dc38d07dd3bf751d38bce7ab7c72 (diff)
powerpc/pseries/eeh: Fix crash when error happens during device probe
EEH may happen during a PCI driver probe. If the driver is trying to access some register in a loop, the EEH code will try to print the driver name. But the driver pointer in struct pci_dev is not set until probe returns successfully. Use a function to test if the device and the driver pointer is NULL before accessing the driver's name. Signed-off-by: Thadeu Lima de Souza Cascardo <cascardo@linux.vnet.ibm.com> Signed-off-by: Benjamin Herrenschmidt <benh@kernel.crashing.org>
Diffstat (limited to 'arch/powerpc/include/asm')
-rw-r--r--arch/powerpc/include/asm/ppc-pci.h5
1 files changed, 5 insertions, 0 deletions
diff --git a/arch/powerpc/include/asm/ppc-pci.h b/arch/powerpc/include/asm/ppc-pci.h
index 43268f15004..6d422979eba 100644
--- a/arch/powerpc/include/asm/ppc-pci.h
+++ b/arch/powerpc/include/asm/ppc-pci.h
@@ -142,6 +142,11 @@ static inline const char *eeh_pci_name(struct pci_dev *pdev)
142 return pdev ? pci_name(pdev) : "<null>"; 142 return pdev ? pci_name(pdev) : "<null>";
143} 143}
144 144
145static inline const char *eeh_driver_name(struct pci_dev *pdev)
146{
147 return (pdev && pdev->driver) ? pdev->driver->name : "<null>";
148}
149
145#endif /* CONFIG_EEH */ 150#endif /* CONFIG_EEH */
146 151
147#else /* CONFIG_PCI */ 152#else /* CONFIG_PCI */