diff mbox series

powerpc/powernv/sriov: Fix use of uninitialised variable

Message ID 20200803075408.132601-1-oohall@gmail.com (mailing list archive)
State Accepted
Commit 2075ec9896c5aef01e837198381d04cfa6452317
Headers show
Series powerpc/powernv/sriov: Fix use of uninitialised variable | expand

Checks

Context Check Description
snowpatch_ozlabs/apply_patch success Successfully applied on branch powerpc/merge (14fd53d1e5ee7350564cac75e336f8c0dea13bc9)
snowpatch_ozlabs/build-ppc64le warning Upstream build failed, couldn't test patch
snowpatch_ozlabs/build-ppc64be warning Upstream build failed, couldn't test patch
snowpatch_ozlabs/build-ppc64e warning Upstream build failed, couldn't test patch
snowpatch_ozlabs/build-pmac32 warning Upstream build failed, couldn't test patch
snowpatch_ozlabs/checkpatch warning total: 1 errors, 3 warnings, 0 checks, 14 lines checked
snowpatch_ozlabs/needsstable fail Test needsstable on branch powerpc/merge

Commit Message

Oliver O'Halloran Aug. 3, 2020, 7:54 a.m. UTC
Initialising the value before using it is generally regarded as a good
idea so do that.

Fixes: 4c51f3e1e870 ("powerpc/powernv/sriov: Make single PE mode a per-BAR setting")
Reported-by: Nathan Chancellor <natechancellor@gmail.com>
Signed-off-by: Oliver O'Halloran <oohall@gmail.com>
---
 arch/powerpc/platforms/powernv/pci-sriov.c | 4 +---
 1 file changed, 1 insertion(+), 3 deletions(-)

Comments

Michael Ellerman Aug. 5, 2020, 12:42 a.m. UTC | #1
On Mon, 3 Aug 2020 17:54:08 +1000, Oliver O'Halloran wrote:
> Initialising the value before using it is generally regarded as a good
> idea so do that.

Applied to powerpc/next.

[1/1] powerpc/powernv/sriov: Fix use of uninitialised variable
      https://git.kernel.org/powerpc/c/2075ec9896c5aef01e837198381d04cfa6452317

cheers
diff mbox series

Patch

diff --git a/arch/powerpc/platforms/powernv/pci-sriov.c b/arch/powerpc/platforms/powernv/pci-sriov.c
index 7894745fd4f8..c4434f20f42f 100644
--- a/arch/powerpc/platforms/powernv/pci-sriov.c
+++ b/arch/powerpc/platforms/powernv/pci-sriov.c
@@ -253,9 +253,9 @@  void pnv_pci_ioda_fixup_iov(struct pci_dev *pdev)
 resource_size_t pnv_pci_iov_resource_alignment(struct pci_dev *pdev,
 						      int resno)
 {
+	resource_size_t align = pci_iov_resource_size(pdev, resno);
 	struct pnv_phb *phb = pci_bus_to_pnvhb(pdev->bus);
 	struct pnv_iov_data *iov = pnv_iov_get(pdev);
-	resource_size_t align;
 
 	/*
 	 * iov can be null if we have an SR-IOV device with IOV BAR that can't
@@ -266,8 +266,6 @@  resource_size_t pnv_pci_iov_resource_alignment(struct pci_dev *pdev,
 	if (!iov)
 		return align;
 
-	align = pci_iov_resource_size(pdev, resno);
-
 	/*
 	 * If we're using single mode then we can just use the native VF BAR
 	 * alignment. We validated that it's possible to use a single PE