]> git.baikalelectronics.ru Git - kernel.git/commitdiff
dmaengine: shdma: Fix runtime PM imbalance on error
authorYongzhi Liu <lyz_cs@pku.edu.cn>
Sun, 16 Jan 2022 05:34:56 +0000 (21:34 -0800)
committerVinod Koul <vkoul@kernel.org>
Tue, 15 Feb 2022 05:34:16 +0000 (11:04 +0530)
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>
drivers/dma/sh/shdma-base.c

index 158e5e7defaeb0149ca8ffcaa34a30f21a98a42a..b26ed690f03c8e8e77ecd739fd70cc62e6c24433 100644 (file)
@@ -115,8 +115,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);