Received: by 2002:a05:6a10:22f:0:0:0:0 with SMTP id 15csp873621pxk; Thu, 17 Sep 2020 19:57:01 -0700 (PDT) X-Google-Smtp-Source: ABdhPJw2Lu+4qgTiWjlkOrbmU6bqFGF58Nb1dM54YjKYSIlb9QCzxqvxpmIhG6tgUR1MArljWoEy X-Received: by 2002:a50:99d6:: with SMTP id n22mr36930903edb.265.1600397820820; Thu, 17 Sep 2020 19:57:00 -0700 (PDT) ARC-Seal: i=1; a=rsa-sha256; t=1600397820; cv=none; d=google.com; s=arc-20160816; b=eQm53hQ2P+wNxH+0Owp2GQl6PU7BqpP48EETP8qgHoFZL8BqClPtpeUjdsFsRgJq0O WIv5/gblZJsQHYDI3NgEmeKJ9TP3e9WJIHmykBvfKVQdVUtTHBflNKUaW8PYUseA7jZ/ bcan/MolM1YYr7EaLr/Vu/MIxvjkRXO+gZwacVHqlDyHvYmo9hDXYy2d5GNQka5+BoaX 8fkXQhTVI0vsYwHc+hHMxZB+OGSrWdhhOcUcEmIcbjuPF/9qgVQ6uHwHlvvqQp3cnoLS 2iYNPbrcicAkKPzscct3jGGCjbwHtxU5MGk1vYviZz/b2JjmE+41Tgae9wrJkqi/LVon ykug== ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=google.com; s=arc-20160816; h=list-id:precedence:content-transfer-encoding:mime-version :references:in-reply-to:message-id:date:subject:cc:to:from :dkim-signature; bh=kFfyz4qVCLTVza29y+BuTlEJWsC/Ava31vs0WghNAnQ=; b=a5knb9COKL8FaWsjYzsVAmPgfBe9/KvcL/Zl/dpgvS/6lqUo/0WSodzpOop8qTahsi P0+rlKFKzNNvpy0abmQdux+QXAjaKfxVNbK1M0K+ZU6itQZD17dbHWvOSP5a9uXU1eZR TqSnmRhuTGzysVTrkC2a51fcksS11EltP+KIx/0dHj0DxJv2Z8hBc2lBLxHUuj5T1ufC Mjzodb+rOdv4X0F8aC5iEfsKeKoPqv7f/JZZJvER7L4PQ36Li+dEt3ylWptv+xv4MiaW HvAoOlSNXAFn52kDYvSqdqGuOXwJYacRBAq0Cti3hdGmyg9f9w+eMUXMHU8Kymsz9OY1 SyTg== ARC-Authentication-Results: i=1; mx.google.com; dkim=pass header.i=@kernel.org header.s=default header.b="2AYNV/ln"; spf=pass (google.com: domain of linux-kernel-owner@vger.kernel.org designates 23.128.96.18 as permitted sender) smtp.mailfrom=linux-kernel-owner@vger.kernel.org; dmarc=pass (p=NONE sp=NONE dis=NONE) header.from=kernel.org Return-Path: Received: from vger.kernel.org (vger.kernel.org. [23.128.96.18]) by mx.google.com with ESMTP id g11si1070172edy.476.2020.09.17.19.56.37; Thu, 17 Sep 2020 19:57:00 -0700 (PDT) Received-SPF: pass (google.com: domain of linux-kernel-owner@vger.kernel.org designates 23.128.96.18 as permitted sender) client-ip=23.128.96.18; Authentication-Results: mx.google.com; dkim=pass header.i=@kernel.org header.s=default header.b="2AYNV/ln"; spf=pass (google.com: domain of linux-kernel-owner@vger.kernel.org designates 23.128.96.18 as permitted sender) smtp.mailfrom=linux-kernel-owner@vger.kernel.org; dmarc=pass (p=NONE sp=NONE dis=NONE) header.from=kernel.org Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S1727935AbgIRCHa (ORCPT + 99 others); Thu, 17 Sep 2020 22:07:30 -0400 Received: from mail.kernel.org ([198.145.29.99]:57774 "EHLO mail.kernel.org" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S1726435AbgIRCH2 (ORCPT ); Thu, 17 Sep 2020 22:07:28 -0400 Received: from sasha-vm.mshome.net (c-73-47-72-35.hsd1.nh.comcast.net [73.47.72.35]) (using TLSv1.2 with cipher ECDHE-RSA-AES128-GCM-SHA256 (128/128 bits)) (No client certificate requested) by mail.kernel.org (Postfix) with ESMTPSA id 9AD5D2396E; Fri, 18 Sep 2020 02:07:26 +0000 (UTC) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/simple; d=kernel.org; s=default; t=1600394847; bh=iQRSWEEZRdZewVn4Y5tkepyTsJGklmDADSSzFdz+15Q=; h=From:To:Cc:Subject:Date:In-Reply-To:References:From; b=2AYNV/ln+PosvtKJ0Fy7M1eJ0FnYocMyaGjC+nKFx8bysBuBKYFd1RSl/gY5TfyDz F/2WATCn4L0iMRr3UuNvomFFMgg3FRQVCHz3h0zJbbjSjQuRckZlacvrjry6lMh5ZD E1CaEeXZjO3ZLOBGaokgJglCB7vLgpYC6SIK1Myg= From: Sasha Levin To: linux-kernel@vger.kernel.org, stable@vger.kernel.org Cc: Dinghao Liu , Lorenzo Pieralisi , Thierry Reding , Sasha Levin , linux-pci@vger.kernel.org, linux-tegra@vger.kernel.org Subject: [PATCH AUTOSEL 5.4 304/330] PCI: tegra: Fix runtime PM imbalance on error Date: Thu, 17 Sep 2020 22:00:44 -0400 Message-Id: <20200918020110.2063155-304-sashal@kernel.org> X-Mailer: git-send-email 2.25.1 In-Reply-To: <20200918020110.2063155-1-sashal@kernel.org> References: <20200918020110.2063155-1-sashal@kernel.org> MIME-Version: 1.0 X-stable: review X-Patchwork-Hint: Ignore Content-Transfer-Encoding: 8bit Precedence: bulk List-ID: X-Mailing-List: linux-kernel@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); -- 2.25.1