Commit 2d5c1216 authored by Gavin Shan's avatar Gavin Shan Committed by Benjamin Herrenschmidt

powerpc/eeh: Enhance converting EEH dev

Under some special circumstances, the EEH device doesn't have the
associated device tree node or PCI device. The patch enhances those
functions converting EEH device to device tree node or PCI device
accordingly to avoid unnecessary system crash.
Signed-off-by: default avatarGavin Shan <shangw@linux.vnet.ibm.com>
Signed-off-by: default avatarBenjamin Herrenschmidt <benh@kernel.crashing.org>
parent 5fb62169
...@@ -95,12 +95,12 @@ struct eeh_dev { ...@@ -95,12 +95,12 @@ struct eeh_dev {
static inline struct device_node *eeh_dev_to_of_node(struct eeh_dev *edev) static inline struct device_node *eeh_dev_to_of_node(struct eeh_dev *edev)
{ {
return edev->dn; return edev ? edev->dn : NULL;
} }
static inline struct pci_dev *eeh_dev_to_pci_dev(struct eeh_dev *edev) static inline struct pci_dev *eeh_dev_to_pci_dev(struct eeh_dev *edev)
{ {
return edev->pdev; return edev ? edev->pdev : NULL;
} }
/* /*
......
Markdown is supported
0%
or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment