Patchwork [01/22] powerpc/eeh: Enhance converting EEH dev

login
register
mail settings
Submitter Gavin Shan
Date March 1, 2013, 2:16 p.m.
Message ID <1362147440-14096-2-git-send-email-shangw@linux.vnet.ibm.com>
Download mbox | patch
Permalink /patch/224364/
State Accepted, archived
Commit 2d5c121678ce2c7e12ecc174121badeea0b98fe0
Delegated to: Michael Ellerman
Headers show

Comments

Gavin Shan - March 1, 2013, 2:16 p.m.
Under some special circumstances, the EEH device doesn't have the
associated device tree node or PCI device. It is caused by the
PCI device corresponding to the device tree node can't support
EEH function.

The patch enhances converting EEH device to device tree node or
PCI device accordingly to avoid system crash.

Signed-off-by: Gavin Shan <shangw@linux.vnet.ibm.com>
---
 arch/powerpc/include/asm/eeh.h |    4 ++--
 1 files changed, 2 insertions(+), 2 deletions(-)

Patch

diff --git a/arch/powerpc/include/asm/eeh.h b/arch/powerpc/include/asm/eeh.h
index a80e32b..e32c3c5 100644
--- a/arch/powerpc/include/asm/eeh.h
+++ b/arch/powerpc/include/asm/eeh.h
@@ -95,12 +95,12 @@  struct eeh_dev {
 
 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)
 {
-	return edev->pdev;
+	return edev ? edev->pdev : NULL;
 }
 
 /*