From patchwork Tue Sep 29 11:00:26 2020 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Greg KH X-Patchwork-Id: 291109 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 31384C4727C for ; Tue, 29 Sep 2020 11:42:26 +0000 (UTC) Received: from vger.kernel.org (vger.kernel.org [23.128.96.18]) by mail.kernel.org (Postfix) with ESMTP id E4D53206F7 for ; Tue, 29 Sep 2020 11:42:23 +0000 (UTC) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/simple; d=kernel.org; s=default; t=1601379746; bh=iQRSWEEZRdZewVn4Y5tkepyTsJGklmDADSSzFdz+15Q=; h=From:To:Cc:Subject:Date:In-Reply-To:References:List-ID:From; b=WHWv8RoQ9RFbYf0ST/Pv6hYUP0osOSa9HXM0Ao36bLgDudy+bw1SgZxQO1WstjZPL QLSPmztR1MGtSsRrI0Ce7QmdLR6KjA+GixZ90SGBJeRKjRv4rGvlMAez496BWDFpvd Wbq4/GR5HWl8hOYk4WlOJ7zAJcJem4/Yu+XkxxPM= Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S1730706AbgI2LmW (ORCPT ); Tue, 29 Sep 2020 07:42:22 -0400 Received: from mail.kernel.org ([198.145.29.99]:39508 "EHLO mail.kernel.org" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S1730426AbgI2LmO (ORCPT ); Tue, 29 Sep 2020 07:42:14 -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 EAF8C2065C; Tue, 29 Sep 2020 11:42:13 +0000 (UTC) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/simple; d=kernel.org; s=default; t=1601379734; bh=iQRSWEEZRdZewVn4Y5tkepyTsJGklmDADSSzFdz+15Q=; h=From:To:Cc:Subject:Date:In-Reply-To:References:From; b=yOMafnu06GIkSc6/klZv7S+XjXfCXPtJT5hCfX9ooKzYrvEdPGkoy0DpCEFVcUvrP k4WZzFyLNLSQgmEA9v31zOR3ZyW4ykm2fcyVTJRsELQf8RoRmTc43Kf+se+DIC8Osp 1K9juF3oEf0t+GJ8d+c83dfL2Th4E+m714nET3VI= 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 5.4 295/388] PCI: tegra: Fix runtime PM imbalance on error Date: Tue, 29 Sep 2020 13:00:26 +0200 Message-Id: <20200929110024.746330295@linuxfoundation.org> X-Mailer: git-send-email 2.28.0 In-Reply-To: <20200929110010.467764689@linuxfoundation.org> References: <20200929110010.467764689@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 b71e753419c2d..cfa3c83d6cc74 100644 --- a/drivers/pci/controller/pci-tegra.c +++ b/drivers/pci/controller/pci-tegra.c @@ -2768,7 +2768,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); @@ -2808,7 +2808,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);