diff mbox series

[RFC,05/15] powerpc/eeh: Sync eeh_pe_get_parent()

Message ID 69c50f9c4e5e4d0c53dad23e8d2afa55a50eaf2e.1569996166.git.sbobroff@linux.ibm.com (mailing list archive)
State RFC
Headers show
Series powerpc/eeh: Synchronize access to struct eeh_pe | expand

Checks

Context Check Description
snowpatch_ozlabs/apply_patch success Successfully applied on branch next (6edfc6487b474fe01857dc3f1a9cd701bb9b21c8)
snowpatch_ozlabs/checkpatch success total: 0 errors, 0 warnings, 0 checks, 28 lines checked

Commit Message

Sam Bobroff Oct. 2, 2019, 6:02 a.m. UTC
Synchronize access to eeh_pe.

Signed-off-by: Sam Bobroff <sbobroff@linux.ibm.com>
---
 arch/powerpc/kernel/eeh_pe.c | 12 ++++++++++--
 1 file changed, 10 insertions(+), 2 deletions(-)
diff mbox series

Patch

diff --git a/arch/powerpc/kernel/eeh_pe.c b/arch/powerpc/kernel/eeh_pe.c
index b89ed46f14e6..0486d3c6ff20 100644
--- a/arch/powerpc/kernel/eeh_pe.c
+++ b/arch/powerpc/kernel/eeh_pe.c
@@ -469,10 +469,12 @@  struct eeh_pe *eeh_pe_find(struct pci_controller *phb,
  * The whole PEs existing in the system are organized as hierarchy
  * tree. The function is used to retrieve the parent PE according
  * to the parent EEH device.
+ * Returns a referenced PE.
  */
 static struct eeh_pe *eeh_pe_get_parent(struct eeh_dev *edev)
 {
 	struct eeh_dev *parent;
+	struct eeh_pe *pe;
 	struct pci_dn *pdn = eeh_dev_to_pdn(edev);
 
 	/*
@@ -490,8 +492,14 @@  static struct eeh_pe *eeh_pe_get_parent(struct eeh_dev *edev)
 		if (!parent)
 			return NULL;
 
-		if (parent->pe)
-			return parent->pe;
+		if (parent->pe) {
+			/* TODO: Unsafe until eeh_dev can be synchronized
+			 * with eeh_pe.
+			 */
+			pe = parent->pe;
+			eeh_get_pe(pe);
+			return pe;
+		}
 
 		pdn = pdn->parent;
 	}