From patchwork Tue Sep 29 11:00:39 2020 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Greg KH X-Patchwork-Id: 290858 Return-Path: X-Spam-Checker-Version: SpamAssassin 3.4.0 (2014-02-07) on aws-us-west-2-korg-lkml-1.web.codeaurora.org X-Spam-Level: X-Spam-Status: No, score=-13.5 required=3.0 tests=BAYES_00,DKIMWL_WL_HIGH, DKIM_SIGNED, DKIM_VALID, HEADER_FROM_DIFFERENT_DOMAINS, INCLUDES_PATCH, MAILING_LIST_MULTI, SIGNED_OFF_BY, SPF_HELO_NONE, SPF_PASS, URIBL_BLOCKED, USER_AGENT_GIT autolearn=ham autolearn_force=no version=3.4.0 Received: from mail.kernel.org (mail.kernel.org [198.145.29.99]) by smtp.lore.kernel.org (Postfix) with ESMTP id CB4C3C4727F for ; Tue, 29 Sep 2020 12:22:27 +0000 (UTC) Received: from vger.kernel.org (vger.kernel.org [23.128.96.18]) by mail.kernel.org (Postfix) with ESMTP id 818F22076B for ; Tue, 29 Sep 2020 12:22:27 +0000 (UTC) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/simple; d=kernel.org; s=default; t=1601382147; bh=casV5YDo5of5191kk54tT26Mx6z9poX2mhDvNHwzyZI=; h=From:To:Cc:Subject:Date:In-Reply-To:References:List-ID:From; b=INE0uOMyLvbkRiB8hqZ42sSKlKCpDP+bAsAgtPaTA6JJ1t8McEufbpI7OI5Qq0Yz0 lvSzAYLXhkMrxFv6VaGcsNWYWW/E07VbjL0JcfU/Ph7gGKH+qFBojjH7eU9WXVDCcs CLDc7dZGwBL+dunOU5UlXVJraEQBC/1tAv46rXIA= Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S1730223AbgI2MW0 (ORCPT ); Tue, 29 Sep 2020 08:22:26 -0400 Received: from mail.kernel.org ([198.145.29.99]:52840 "EHLO mail.kernel.org" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S1729798AbgI2LfL (ORCPT ); Tue, 29 Sep 2020 07:35:11 -0400 Received: from localhost (83-86-74-64.cable.dynamic.v4.ziggo.nl [83.86.74.64]) (using TLSv1.2 with cipher ECDHE-RSA-AES256-GCM-SHA384 (256/256 bits)) (No client certificate requested) by mail.kernel.org (Postfix) with ESMTPSA id 72A1F23C84; Tue, 29 Sep 2020 11:28:40 +0000 (UTC) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/simple; d=kernel.org; s=default; t=1601378921; bh=casV5YDo5of5191kk54tT26Mx6z9poX2mhDvNHwzyZI=; h=From:To:Cc:Subject:Date:In-Reply-To:References:From; b=OD8DYScpbOeXKAqTMP6pOJZQRuVgVPPOMQDETV0FAknp6ZFgXKdb7PL3f+MJVrANH SaX3QbtpR3MAitjyPQE003EFgh0iZerU/0pSGZfYmc9gJL6A/i5Ds3pHm9jMCnqaE4 akVj9Gy+OXg0fQOjrzKeFoCo6SOapxK0mEMibHEY= From: Greg Kroah-Hartman To: linux-kernel@vger.kernel.org Cc: Greg Kroah-Hartman , stable@vger.kernel.org, Dinghao Liu , Lorenzo Pieralisi , Thierry Reding , Sasha Levin Subject: [PATCH 4.19 188/245] PCI: tegra: Fix runtime PM imbalance on error Date: Tue, 29 Sep 2020 13:00:39 +0200 Message-Id: <20200929105956.124803857@linuxfoundation.org> X-Mailer: git-send-email 2.28.0 In-Reply-To: <20200929105946.978650816@linuxfoundation.org> References: <20200929105946.978650816@linuxfoundation.org> User-Agent: quilt/0.66 MIME-Version: 1.0 Precedence: bulk List-ID: X-Mailing-List: stable@vger.kernel.org From: Dinghao Liu [ Upstream commit fcee90cdf6f3a3a371add04d41528d5ba9c3b411 ] pm_runtime_get_sync() increments the runtime PM usage counter even when it returns an error code. Thus a pairing decrement is needed on the error handling path to keep the counter balanced. Also, call pm_runtime_disable() when pm_runtime_get_sync() returns an error code. Link: https://lore.kernel.org/r/20200521024709.2368-1-dinghao.liu@zju.edu.cn Signed-off-by: Dinghao Liu Signed-off-by: Lorenzo Pieralisi Acked-by: Thierry Reding Signed-off-by: Sasha Levin --- 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 6f86583605a46..097c02197ec8f 100644 --- a/drivers/pci/controller/pci-tegra.c +++ b/drivers/pci/controller/pci-tegra.c @@ -2400,7 +2400,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; } err = tegra_pcie_request_resources(pcie); @@ -2440,7 +2440,6 @@ free_resources: 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);