Patch "memory: mtk-smi: Fix PM usage counter unbalance in mtk_smi ops" has been added to the 5.4-stable tree

[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

 



This is a note to let you know that I've just added the patch titled

    memory: mtk-smi: Fix PM usage counter unbalance in mtk_smi ops

to the 5.4-stable tree which can be found at:
    http://www.kernel.org/git/?p=linux/kernel/git/stable/stable-queue.git;a=summary

The filename of the patch is:
     memory-mtk-smi-fix-pm-usage-counter-unbalance-in-mtk.patch
and it can be found in the queue-5.4 subdirectory.

If you, or anyone else, feels it should not be added to the stable tree,
please let <stable@xxxxxxxxxxxxxxx> know about it.



commit 91f78d7d8edbd3b256ddd917de698e66d28241e5
Author: Zhang Qilong <zhangqilong3@xxxxxxxxxx>
Date:   Mon Nov 23 18:21:18 2020 +0800

    memory: mtk-smi: Fix PM usage counter unbalance in mtk_smi ops
    
    [ Upstream commit a2d522ff0f5cc26915c4ccee9457fd4b4e1edc48 ]
    
    pm_runtime_get_sync will increment pm usage counter
    even it failed. Forgetting to putting operation will
    result in reference leak here. We fix it by replacing
    it with pm_runtime_resume_and_get to keep usage counter
    balanced.
    
    Fixes: 4f0a1a1ae3519 ("memory: mtk-smi: Invoke pm runtime_callback to enable clocks")
    Signed-off-by: Zhang Qilong <zhangqilong3@xxxxxxxxxx>
    Link: https://lore.kernel.org/r/20201123102118.3866195-1-zhangqilong3@xxxxxxxxxx
    Signed-off-by: Krzysztof Kozlowski <krzk@xxxxxxxxxx>
    Signed-off-by: Sasha Levin <sashal@xxxxxxxxxx>

diff --git a/drivers/memory/mtk-smi.c b/drivers/memory/mtk-smi.c
index a113e811faabe..da1ce7fd4cf5c 100644
--- a/drivers/memory/mtk-smi.c
+++ b/drivers/memory/mtk-smi.c
@@ -127,7 +127,7 @@ static void mtk_smi_clk_disable(const struct mtk_smi *smi)
 
 int mtk_smi_larb_get(struct device *larbdev)
 {
-	int ret = pm_runtime_get_sync(larbdev);
+	int ret = pm_runtime_resume_and_get(larbdev);
 
 	return (ret < 0) ? ret : 0;
 }
@@ -336,7 +336,7 @@ static int __maybe_unused mtk_smi_larb_resume(struct device *dev)
 	int ret;
 
 	/* Power on smi-common. */
-	ret = pm_runtime_get_sync(larb->smi_common_dev);
+	ret = pm_runtime_resume_and_get(larb->smi_common_dev);
 	if (ret < 0) {
 		dev_err(dev, "Failed to pm get for smi-common(%d).\n", ret);
 		return ret;



[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]
[Index of Archives]     [Linux USB Devel]     [Linux Audio Users]     [Yosemite News]     [Linux Kernel]     [Linux SCSI]

  Powered by Linux