PCI: rcar: Fix runtime PM imbalance in rcar_pcie_ep_probe()
authorDinghao Liu <dinghao.liu@zju.edu.cn>
Thu, 8 Apr 2021 07:24:02 +0000 (15:24 +0800)
committerLorenzo Pieralisi <lorenzo.pieralisi@arm.com>
Thu, 5 Aug 2021 13:08:57 +0000 (14:08 +0100)
pm_runtime_get_sync() will increase the runtime PM counter
even it returns an error. Thus a pairing decrement is needed
to prevent refcount leak. Fix this by replacing this API with
pm_runtime_resume_and_get(), which will not change the runtime
PM counter on error.

Link: https://lore.kernel.org/r/20210408072402.15069-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>
Reviewed-by: Geert Uytterhoeven <geert+renesas@glider.be>
drivers/pci/controller/pcie-rcar-ep.c

index b4a288e..c91d85b 100644 (file)
@@ -492,9 +492,9 @@ static int rcar_pcie_ep_probe(struct platform_device *pdev)
        pcie->dev = dev;
 
        pm_runtime_enable(dev);
-       err = pm_runtime_get_sync(dev);
+       err = pm_runtime_resume_and_get(dev);
        if (err < 0) {
-               dev_err(dev, "pm_runtime_get_sync failed\n");
+               dev_err(dev, "pm_runtime_resume_and_get failed\n");
                goto err_pm_disable;
        }