Received: by 2002:a25:e74b:0:0:0:0:0 with SMTP id e72csp212431ybh; Mon, 20 Jul 2020 14:44:16 -0700 (PDT) X-Google-Smtp-Source: ABdhPJyeUi22/r0tPJxL5f+5YDPfdBA2WE5qIv9DtPku8QZNBF0cpJg1Rf+VqMIKxjkpwTYTObtd X-Received: by 2002:a17:906:8d5:: with SMTP id o21mr5054580eje.155.1595281456216; Mon, 20 Jul 2020 14:44:16 -0700 (PDT) ARC-Seal: i=1; a=rsa-sha256; t=1595281456; cv=none; d=google.com; s=arc-20160816; b=zgbmuPc2BhfCfa++58QYMeAdbZ2eTHcTQSaGq/Dnw5GsTCITN/yJvfJoEMV2wfuScR sVwfrdxBA3z8ihQrMMIuQyjIt4tNHYZU2kt95VtmkI1w9RPV4FZatWayk+p1kJTrH8mi 2XmkgnPAtoPdrcZ/rqwKE+FoWzIHUig7ZjMj3LdKVkVZoiCJDsCSER+lBpVA2SDb/WFS BdDLdLGlDQ0NcdeGAxmUQikNOKc2Z9WVHBh8JPDbdXd3O7W82uccvgBPFNyKoWap8jyN Kd9sG8W2OxdKewIpARHRut+VAKKxaafHmkTdAVQmdV8CFzanP6KZW9CTC65kSQnaGufm kJpw== ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=google.com; s=arc-20160816; h=list-id:precedence:sender:content-transfer-encoding:mime-version :references:in-reply-to:message-id:date:subject:cc:to:from :dkim-signature; bh=H1Ghqf36dqkbBrtG5JHVTE0Q8sew3hfWG+qN4tq10SY=; b=v3Kr1KLeexIvFwdVMNME6aME3vNhB3G4PSwgOiYqfbOpKCUHvNEAqNl1d7ITnKSdO9 X9lhV5HUfQqLgeK4mG0oA6KJzGzbshBQwW8vX7wr4D6m8EysqtXD/u7XGb0WcGw4kVyP Uf8dfwKVT6mV4IUhJO4Q7XcOAvFEtNWFEfNS0h7w4/bnyg1sNJFLWsQMGCyjDRquvfFG mJ3vYZ5XyvfXiRp0sFig2aYEg5lWSjY+c+YEwO1OFfd9jVzWuDcC61UdIHbiP/BiDOYb 4vdHh1VmcGCrEWhiGbhcGoo6wze1AFhUyMPVeBheAVCHupdKDLVgt0p8aBZLfnT9WZVQ RVFQ== ARC-Authentication-Results: i=1; mx.google.com; dkim=pass header.i=@kernel.org header.s=default header.b=qtHsqAs2; 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 f14si11008400edm.269.2020.07.20.14.43.52; Mon, 20 Jul 2020 14:44:16 -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=qtHsqAs2; 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 S1728301AbgGTVma (ORCPT + 99 others); Mon, 20 Jul 2020 17:42:30 -0400 Received: from mail.kernel.org ([198.145.29.99]:57852 "EHLO mail.kernel.org" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S1728297AbgGTVi6 (ORCPT ); Mon, 20 Jul 2020 17:38:58 -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 C70B822D00; Mon, 20 Jul 2020 21:38:56 +0000 (UTC) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/simple; d=kernel.org; s=default; t=1595281137; bh=iEtFf7QMN19S5dmrOUJonugb+EIs3TYktwEmUKejVvI=; h=From:To:Cc:Subject:Date:In-Reply-To:References:From; b=qtHsqAs2U6ZJViVGhfZlos2Y967Mm0++q5seUJHJELvPkLDsaSo6WKMl57jBmzJc1 IB2fXqz0rwgRPcCnwtrdcFsaDSjuJEIEjob62K9ogN+6G2jPPX+eXV+l/uBFPtxenq iV4WiBBAKZr7s72r9/7cQNMSQaoG2TQIjqruRv+4= From: Sasha Levin To: linux-kernel@vger.kernel.org, stable@vger.kernel.org Cc: Dinghao Liu , Jon Hunter , Vinod Koul , Sasha Levin , dmaengine@vger.kernel.org, linux-tegra@vger.kernel.org Subject: [PATCH AUTOSEL 4.19 05/19] dmaengine: tegra210-adma: Fix runtime PM imbalance on error Date: Mon, 20 Jul 2020 17:38:36 -0400 Message-Id: <20200720213851.407715-5-sashal@kernel.org> X-Mailer: git-send-email 2.25.1 In-Reply-To: <20200720213851.407715-1-sashal@kernel.org> References: <20200720213851.407715-1-sashal@kernel.org> MIME-Version: 1.0 X-stable: review X-Patchwork-Hint: Ignore Content-Transfer-Encoding: 8bit Sender: linux-kernel-owner@vger.kernel.org Precedence: bulk List-ID: X-Mailing-List: linux-kernel@vger.kernel.org From: Dinghao Liu [ Upstream commit 5b78fac4b1ba731cf4177fdbc1e3a4661521bcd0 ] 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. Signed-off-by: Dinghao Liu Reviewed-by: Jon Hunter Link: https://lore.kernel.org/r/20200624064626.19855-1-dinghao.liu@zju.edu.cn Signed-off-by: Vinod Koul Signed-off-by: Sasha Levin --- drivers/dma/tegra210-adma.c | 5 ++++- 1 file changed, 4 insertions(+), 1 deletion(-) diff --git a/drivers/dma/tegra210-adma.c b/drivers/dma/tegra210-adma.c index 045351f3549c1..86b45198fb962 100644 --- a/drivers/dma/tegra210-adma.c +++ b/drivers/dma/tegra210-adma.c @@ -583,6 +583,7 @@ static int tegra_adma_alloc_chan_resources(struct dma_chan *dc) ret = pm_runtime_get_sync(tdc2dev(tdc)); if (ret < 0) { + pm_runtime_put_noidle(tdc2dev(tdc)); free_irq(tdc->irq, tdc); return ret; } @@ -764,8 +765,10 @@ static int tegra_adma_probe(struct platform_device *pdev) pm_runtime_enable(&pdev->dev); ret = pm_runtime_get_sync(&pdev->dev); - if (ret < 0) + if (ret < 0) { + pm_runtime_put_noidle(&pdev->dev); goto rpm_disable; + } ret = tegra_adma_init(tdma); if (ret) -- 2.25.1