From patchwork Thu Jul 9 06:43:56 2020 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Dinghao Liu X-Patchwork-Id: 11653457 X-Patchwork-Delegate: geert@linux-m68k.org Return-Path: Received: from mail.kernel.org (pdx-korg-mail-1.web.codeaurora.org [172.30.200.123]) by pdx-korg-patchwork-2.web.codeaurora.org (Postfix) with ESMTP id 5D08D739 for ; Thu, 9 Jul 2020 06:44:33 +0000 (UTC) Received: from vger.kernel.org (vger.kernel.org [23.128.96.18]) by mail.kernel.org (Postfix) with ESMTP id 4F33F206C3 for ; Thu, 9 Jul 2020 06:44:33 +0000 (UTC) Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S1726203AbgGIGo3 (ORCPT ); Thu, 9 Jul 2020 02:44:29 -0400 Received: from spam.zju.edu.cn ([61.164.42.155]:63878 "EHLO zju.edu.cn" rhost-flags-OK-OK-OK-FAIL) by vger.kernel.org with ESMTP id S1726099AbgGIGo2 (ORCPT ); Thu, 9 Jul 2020 02:44:28 -0400 Received: from localhost.localdomain (unknown [210.32.144.65]) by mail-app2 (Coremail) with SMTP id by_KCgDn7+esvAZfYMwOAA--.34107S4; Thu, 09 Jul 2020 14:44:00 +0800 (CST) From: Dinghao Liu To: dinghao.liu@zju.edu.cn, kjlu@umn.edu Cc: Marek Vasut , Yoshihiro Shimoda , Lorenzo Pieralisi , Rob Herring , Bjorn Helgaas , Simon Horman , Geert Uytterhoeven , Hien Dang , linux-pci@vger.kernel.org, linux-renesas-soc@vger.kernel.org, linux-kernel@vger.kernel.org Subject: [PATCH] [v3] PCI: rcar: Fix runtime PM imbalance on error Date: Thu, 9 Jul 2020 14:43:56 +0800 Message-Id: <20200709064356.8800-1-dinghao.liu@zju.edu.cn> X-Mailer: git-send-email 2.17.1 X-CM-TRANSID: by_KCgDn7+esvAZfYMwOAA--.34107S4 X-Coremail-Antispam: 1UD129KBjvJXoW7tFyDGryUXF4UurW3ArWU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mxovvfxof0/1tbiAgwNBlZdtO+R4gAIsu Sender: linux-renesas-soc-owner@vger.kernel.org Precedence: bulk List-ID: X-Mailing-List: linux-renesas-soc@vger.kernel.org pm_runtime_get_sync() increments the runtime PM usage counter even the call returns an error code. Thus a corresponding decrement is needed on the error handling path to keep the counter balanced. Fixes: 0df6150e7ceb ("PCI: rcar: Use runtime PM to control controller clock") Signed-off-by: Dinghao Liu --- Changelog: v2: - Remove unnecessary 'err_pm_put' label. Refine commit message. v3: - Add Fixes tag. Rebase the patch on top of the latest kernel. --- drivers/pci/controller/pcie-rcar-host.c | 4 +--- 1 file changed, 1 insertion(+), 3 deletions(-) diff --git a/drivers/pci/controller/pcie-rcar-host.c b/drivers/pci/controller/pcie-rcar-host.c index d210a36561be..060c24f5221e 100644 --- a/drivers/pci/controller/pcie-rcar-host.c +++ b/drivers/pci/controller/pcie-rcar-host.c @@ -986,7 +986,7 @@ static int rcar_pcie_probe(struct platform_device *pdev) err = pm_runtime_get_sync(pcie->dev); if (err < 0) { dev_err(pcie->dev, "pm_runtime_get_sync failed\n"); - goto err_pm_disable; + goto err_pm_put; } err = rcar_pcie_get_resources(host); @@ -1057,8 +1057,6 @@ static int rcar_pcie_probe(struct platform_device *pdev) err_pm_put: pm_runtime_put(dev); - -err_pm_disable: pm_runtime_disable(dev); pci_free_resource_list(&host->resources);