Move initialized local variable declaration to top and set drvdata pointer only when the probe function succeeds. No functional change intended. Signed-off-by: Bjorn Helgaas <bhelgaas@xxxxxxxxxx> --- drivers/pci/host/pcie-armada8k.c | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/drivers/pci/host/pcie-armada8k.c b/drivers/pci/host/pcie-armada8k.c index 19086a4..36002e4 100644 --- a/drivers/pci/host/pcie-armada8k.c +++ b/drivers/pci/host/pcie-armada8k.c @@ -197,9 +197,9 @@ static int armada8k_add_pcie_port(struct armada8k_pcie *armada8k, static int armada8k_pcie_probe(struct platform_device *pdev) { + struct device *dev = &pdev->dev; struct armada8k_pcie *armada8k; struct pcie_port *pp; - struct device *dev = &pdev->dev; struct resource *base; int ret; @@ -215,7 +215,6 @@ static int armada8k_pcie_probe(struct platform_device *pdev) pp = &armada8k->pp; pp->dev = dev; - platform_set_drvdata(pdev, armada8k); /* Get the dw-pcie unit configuration/control registers base. */ base = platform_get_resource_byname(pdev, IORESOURCE_MEM, "ctrl"); @@ -230,6 +229,7 @@ static int armada8k_pcie_probe(struct platform_device *pdev) if (ret) goto fail; + platform_set_drvdata(pdev, armada8k); return 0; fail: -- To unsubscribe from this list: send the line "unsubscribe linux-pci" in the body of a message to majordomo@xxxxxxxxxxxxxxx More majordomo info at http://vger.kernel.org/majordomo-info.html