summaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
authorYongzhi Liu <lyz_cs@pku.edu.cn>2022-01-15 21:34:56 -0800
committerGreg Kroah-Hartman <gregkh@linuxfoundation.org>2022-03-08 19:00:57 +0100
commitc55b5ff16dc2e07e8f1d4ff3fa1e913bb03e0ed5 (patch)
tree5fbd9f93224dfc9f001bb61f764f41abfb1313df
parentda834d6c1147c7519a9e55b510a03b7055104749 (diff)
downloadlinux-stable-c55b5ff16dc2e07e8f1d4ff3fa1e913bb03e0ed5.tar.gz
linux-stable-c55b5ff16dc2e07e8f1d4ff3fa1e913bb03e0ed5.tar.bz2
linux-stable-c55b5ff16dc2e07e8f1d4ff3fa1e913bb03e0ed5.zip
dmaengine: shdma: Fix runtime PM imbalance on error
[ Upstream commit 455896c53d5b803733ddd84e1bf8a430644439b6 ] pm_runtime_get_() increments the runtime PM usage counter even when it returns an error code, thus a matching decrement is needed on the error handling path to keep the counter balanced. Signed-off-by: Yongzhi Liu <lyz_cs@pku.edu.cn> Link: https://lore.kernel.org/r/1642311296-87020-1-git-send-email-lyz_cs@pku.edu.cn Signed-off-by: Vinod Koul <vkoul@kernel.org> Signed-off-by: Sasha Levin <sashal@kernel.org>
-rw-r--r--drivers/dma/sh/shdma-base.c4
1 files changed, 3 insertions, 1 deletions
diff --git a/drivers/dma/sh/shdma-base.c b/drivers/dma/sh/shdma-base.c
index 12fa48e380cf..4f8dfe77da3c 100644
--- a/drivers/dma/sh/shdma-base.c
+++ b/drivers/dma/sh/shdma-base.c
@@ -118,8 +118,10 @@ static dma_cookie_t shdma_tx_submit(struct dma_async_tx_descriptor *tx)
ret = pm_runtime_get(schan->dev);
spin_unlock_irq(&schan->chan_lock);
- if (ret < 0)
+ if (ret < 0) {
dev_err(schan->dev, "%s(): GET = %d\n", __func__, ret);
+ pm_runtime_put(schan->dev);
+ }
pm_runtime_barrier(schan->dev);