PCI: cadence: Fix runtime PM imbalance on error
authorDinghao Liu <dinghao.liu@zju.edu.cn>
Wed, 20 May 2020 09:02:53 +0000 (17:02 +0800)
committerLorenzo Pieralisi <lorenzo.pieralisi@arm.com>
Tue, 7 Jul 2020 10:29:12 +0000 (11:29 +0100)
pm_runtime_get_sync() increments the runtime PM usage counter even
it returns an error code. Thus a pairing decrement is needed on
the error handling path to keep the counter balanced.

Link: https://lore.kernel.org/r/20200520090253.2761-1-dinghao.liu@zju.edu.cn
Signed-off-by: Dinghao Liu <dinghao.liu@zju.edu.cn>
Signed-off-by: Lorenzo Pieralisi <lorenzo.pieralisi@arm.com>
drivers/pci/controller/cadence/pcie-cadence-plat.c

index f5c6bf6dfcb8b6f622454a2d559236d363a5e961..33c3868e6dbd3552ff1f32f8e771ca0d0b2b34b5 100644 (file)
@@ -115,9 +115,8 @@ static int cdns_plat_pcie_probe(struct platform_device *pdev)
        }
 
  err_init:
-       pm_runtime_put_sync(dev);
-
  err_get_sync:
+       pm_runtime_put_sync(dev);
        pm_runtime_disable(dev);
        cdns_pcie_disable_phy(cdns_plat_pcie->pcie);
        phy_count = cdns_plat_pcie->pcie->phy_count;