diff options
author | Zhang Qilong <zhangqilong3@huawei.com> | 2020-11-23 18:21:18 +0800 |
---|---|---|
committer | Greg Kroah-Hartman <gregkh@linuxfoundation.org> | 2021-03-04 10:26:12 +0100 |
commit | ab9de93d12c98044ba5d8a6f7c0be6b0017e08f7 (patch) | |
tree | a6c8057faafa2df20bb1fe0df8942c744c35d266 /drivers/memory | |
parent | 9ab4364ecd9908eda133e0df6a74c4083db59351 (diff) | |
download | linux-stable-ab9de93d12c98044ba5d8a6f7c0be6b0017e08f7.tar.gz linux-stable-ab9de93d12c98044ba5d8a6f7c0be6b0017e08f7.tar.bz2 linux-stable-ab9de93d12c98044ba5d8a6f7c0be6b0017e08f7.zip |
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@huawei.com>
Link: https://lore.kernel.org/r/20201123102118.3866195-1-zhangqilong3@huawei.com
Signed-off-by: Krzysztof Kozlowski <krzk@kernel.org>
Signed-off-by: Sasha Levin <sashal@kernel.org>
Diffstat (limited to 'drivers/memory')
-rw-r--r-- | drivers/memory/mtk-smi.c | 4 |
1 files changed, 2 insertions, 2 deletions
diff --git a/drivers/memory/mtk-smi.c b/drivers/memory/mtk-smi.c index a113e811faab..da1ce7fd4cf5 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; |