Skip to contentSkip to conversation

powerpc/eeh: Delete eeh_pe->config_addr

PATCH Applied Oliver O'Halloran 2 participants 3 messages Oct 7, 2020 – Oct 9, 2020

Subsystems (2)
lore
Share & tools
lore

Oliver O'Halloran

author reviewer
#0 lore raw

PATCH 1/2 powerpc/eeh: Delete eeh_pe->config_addr

The eeh_pe->config_addr field was supposed to be removed in commit 35d64734b643 ("powerpc/eeh: Clean up PE addressing") which made it largely unused. Finish the job.

---
mpe: the Fixes SHA is from ppc/next, fold it into that if you want.

---
 arch/powerpc/include/asm/eeh.h | 1 -
 arch/powerpc/kernel/eeh.c      | 2 +-
 arch/powerpc/kernel/eeh_pe.c   | 4 ++--
 3 files changed, 3 insertions(+), 4 deletions(-)
arch/powerpc/include/asm/eeh.h +0 -1
index dd6a4ac6c713..b1a5bba2e0b9 100644
@@ -73,7 +73,6 @@ struct pci_dn;
 struct eeh_pe {
 	int type;			/* PE type: PHB/Bus/Device	*/
 	int state;			/* PE EEH dependent mode	*/
-	int config_addr;		/* Traditional PCI address	*/
 	int addr;			/* PE configuration address	*/
 	struct pci_controller *phb;	/* Associated PHB		*/
 	struct pci_bus *bus;		/* Top PCI bus for bus PE	*/
arch/powerpc/kernel/eeh.c +1 -1
index 87de8b798b2d..0e160dffcb86 100644
@@ -466,7 +466,7 @@ int eeh_dev_check_failure(struct eeh_dev *edev)
 		return 0;
 	}
 
-	if (!pe->addr && !pe->config_addr) {
+	if (!pe->addr) {
 		eeh_stats.no_cfg_addr++;
 		return 0;
 	}
arch/powerpc/kernel/eeh_pe.c +2 -2
index 61b7d4019051..845e024321d4 100644
@@ -354,8 +354,8 @@ int eeh_pe_tree_insert(struct eeh_dev *edev, struct eeh_pe *new_pe_parent)
 		pr_err("%s: out of memory!\n", __func__);
 		return -ENOMEM;
 	}
-	pe->addr	= edev->pe_config_addr;
-	pe->config_addr	= edev->bdfn;
+
+	pe->addr = edev->pe_config_addr;
 
 	/*
 	 * Put the new EEH PE into hierarchy tree. If the parent
Signature · 1 line
2.26.2
author reviewer
#1 lore raw

PATCH 2/2 powerpc/pseries/eeh: Fix use of uninitialised variable

If the RTAS call to query the PE address for a device fails we jump the
err: label where an error message is printed along with the return code. However, the printed return code is from the "ret" variable which isn't set at that point since we assigned the result to "addr" instead. Fix this by consistently using the "ret" variable for the result of the RTAS call helpers an dropping the "addr" local variable"

Fixes 98ba956f6a38 ("powerpc/pseries/eeh: Rework device EEH PE determination")
---
 arch/powerpc/platforms/pseries/eeh_pseries.c | 9 ++++-----
 1 file changed, 4 insertions(+), 5 deletions(-)
arch/powerpc/platforms/pseries/eeh_pseries.c +4 -5
index d8fd5f7b2143..cf024fa37bda 100644
@@ -363,7 +363,6 @@ void pseries_eeh_init_edev(struct pci_dn *pdn)
 {
 	struct eeh_pe pe, *parent;
 	struct eeh_dev *edev;
-	int addr;
 	u32 pcie_flags;
 	int ret;
 
@@ -422,8 +421,8 @@ void pseries_eeh_init_edev(struct pci_dn *pdn)
 	}
 
 	/* first up, find the pe_config_addr for the PE containing the device */
-	addr = pseries_eeh_get_pe_config_addr(pdn);
-	if (addr < 0) {
+	ret = pseries_eeh_get_pe_config_addr(pdn);
+	if (ret < 0) {
 		eeh_edev_dbg(edev, "Unable to find pe_config_addr\n");
 		goto err;
 	}
@@ -431,7 +430,7 @@ void pseries_eeh_init_edev(struct pci_dn *pdn)
 	/* Try enable EEH on the fake PE */
 	memset(&pe, 0, sizeof(struct eeh_pe));
 	pe.phb = pdn->phb;
-	pe.addr = addr;
+	pe.addr = ret;
 
 	eeh_edev_dbg(edev, "Enabling EEH on device\n");
 	ret = eeh_ops->set_option(&pe, EEH_OPT_ENABLE);
@@ -440,7 +439,7 @@ void pseries_eeh_init_edev(struct pci_dn *pdn)
 		goto err;
 	}
 
-	edev->pe_config_addr = addr;
+	edev->pe_config_addr = pe.addr;
 
 	eeh_add_flag(EEH_ENABLED);
 
Signature · 1 line
2.26.2
#2 lore raw
In reply to Oliver O'Halloran
Quoted 3 lines · Oliver O'Halloran

The eeh_pe->config_addr field was supposed to be removed in commit 35d64734b643 ("powerpc/eeh: Clean up PE addressing") which made it largely unused. Finish the job.

Applied to powerpc/next.

[1/2] powerpc/eeh: Delete eeh_pe->config_addr

      https://git.kernel.org/powerpc/c/269e583357df32d77368903214f10f43fa5d7a5f
[2/2] powerpc/pseries/eeh: Fix use of uninitialised variable
      https://git.kernel.org/powerpc/c/8175bd580e629dcf9cc507794da774a6b8d3a9bd

cheers