From patchwork Wed May 20 08:40:12 2020 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Dinghao Liu X-Patchwork-Id: 11559781 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 9746E739 for ; Wed, 20 May 2020 08:40:30 +0000 (UTC) Received: from vger.kernel.org (vger.kernel.org [23.128.96.18]) by mail.kernel.org (Postfix) with ESMTP id 87D0D207D3 for ; Wed, 20 May 2020 08:40:30 +0000 (UTC) Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S1726546AbgETIk3 (ORCPT ); Wed, 20 May 2020 04:40:29 -0400 Received: from spam.zju.edu.cn ([61.164.42.155]:44466 "EHLO zju.edu.cn" rhost-flags-OK-OK-OK-FAIL) by vger.kernel.org with ESMTP id S1726486AbgETIk3 (ORCPT ); Wed, 20 May 2020 04:40:29 -0400 X-Greylist: delayed 1061 seconds by postgrey-1.27 at vger.kernel.org; Wed, 20 May 2020 04:40:28 EDT Received: from localhost.localdomain (unknown [222.205.77.158]) by mail-app4 (Coremail) with SMTP id cS_KCgAHXwnt7MRepjDXAQ--.26554S4; Wed, 20 May 2020 16:40:17 +0800 (CST) From: Dinghao Liu To: dinghao.liu@zju.edu.cn, kjlu@umn.edu Cc: Thierry Reding , Lorenzo Pieralisi , Rob Herring , Bjorn Helgaas , Jonathan Hunter , linux-tegra@vger.kernel.org, linux-pci@vger.kernel.org, linux-kernel@vger.kernel.org Subject: [PATCH] PCI: tegra: fix runtime pm imbalance on error Date: Wed, 20 May 2020 16:40:12 +0800 Message-Id: <20200520084012.30190-1-dinghao.liu@zju.edu.cn> X-Mailer: git-send-email 2.17.1 X-CM-TRANSID: cS_KCgAHXwnt7MRepjDXAQ--.26554S4 X-Coremail-Antispam: 1UD129KBjvJXoWrKrW5ZF15Jr17CrW7WFy3urg_yoW8JF13pF WD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.kernel.org Precedence: bulk List-ID: X-Mailing-List: linux-pci@vger.kernel.org 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. Also This driver forgets to call pm_runtime_disable() when pm_runtime_get_sync() returns an error code. Signed-off-by: Dinghao Liu Acked-by: Thierry Reding --- drivers/pci/controller/pci-tegra.c | 3 +-- 1 file changed, 1 insertion(+), 2 deletions(-) diff --git a/drivers/pci/controller/pci-tegra.c b/drivers/pci/controller/pci-tegra.c index 3e64ba6a36a8..00236dd65b5b 100644 --- a/drivers/pci/controller/pci-tegra.c +++ b/drivers/pci/controller/pci-tegra.c @@ -2712,7 +2712,7 @@ static int tegra_pcie_probe(struct platform_device *pdev) err = pm_runtime_get_sync(pcie->dev); if (err < 0) { dev_err(dev, "fail to enable pcie controller: %d\n", err); - goto teardown_msi; + goto pm_runtime_put; } host->busnr = bus->start; @@ -2746,7 +2746,6 @@ static int tegra_pcie_probe(struct platform_device *pdev) pm_runtime_put: pm_runtime_put_sync(pcie->dev); pm_runtime_disable(pcie->dev); -teardown_msi: tegra_pcie_msi_teardown(pcie); put_resources: tegra_pcie_put_resources(pcie);