Commit 8175bd58 authored by Oliver O'Halloran's avatar Oliver O'Halloran Committed by Michael Ellerman
Browse files

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: 98ba956f ("powerpc/pseries/eeh: Rework device EEH PE determination")
Signed-off-by: default avatarOliver O'Halloran <oohall@gmail.com>
Signed-off-by: default avatarMichael Ellerman <mpe@ellerman.id.au>
Link: https://lore.kernel.org/r/20201007040903.819081-2-oohall@gmail.com
parent 269e5833
Loading
Loading
Loading
Loading
+4 −5
Original line number Diff line number Diff line
@@ -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);