diff mbox series

[RFC,08/15] powerpc/eeh: Sync eeh_handle_normal_event()

Message ID 928a11a50e2c6a1df56dc1a9c5ed14dd51ba15f1.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 warning Failed to apply on branch next (6edfc6487b474fe01857dc3f1a9cd701bb9b21c8)
snowpatch_ozlabs/apply_patch fail Failed to apply to any branch

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_driver.c | 4 ++++
 1 file changed, 4 insertions(+)
diff mbox series

Patch

diff --git a/arch/powerpc/kernel/eeh_driver.c b/arch/powerpc/kernel/eeh_driver.c
index b3245d0cfb22..c9d73070793e 100644
--- a/arch/powerpc/kernel/eeh_driver.c
+++ b/arch/powerpc/kernel/eeh_driver.c
@@ -879,6 +879,7 @@  static void eeh_clear_slot_attention(struct pci_dev *pdev)
  * & devices under this slot, and then finally restarting the device
  * drivers (which cause a second set of hotplug events to go out to
  * userspace).
+ * Consumes the reference on 'pe'.
  */
 void eeh_handle_normal_event(struct eeh_pe *pe)
 {
@@ -898,6 +899,7 @@  void eeh_handle_normal_event(struct eeh_pe *pe)
 	if (!bus) {
 		pr_err("%s: Cannot find PCI bus for PHB#%x-PE#%x\n",
 			__func__, pe->phb->global_number, pe->addr);
+		eeh_put_pe(pe); /* Release ref */
 		return;
 	}
 
@@ -1141,6 +1143,7 @@  void eeh_handle_normal_event(struct eeh_pe *pe)
 			pci_hp_remove_devices(bus);
 			pci_unlock_rescan_remove();
 			/* The passed PE should no longer be used */
+			eeh_put_pe(pe); /* Release ref */
 			return;
 		}
 	}
@@ -1160,6 +1163,7 @@  void eeh_handle_normal_event(struct eeh_pe *pe)
 	eeh_pe_state_clear(pe, EEH_PE_RECOVERING, true);
 	pr_info("PE state after recovery:\n");
 	eeh_tree_state_dump_kprintf(pe);
+	eeh_put_pe(pe); /* Release ref */
 }
 
 /**