mirror of
https://github.com/tbsdtv/linux_media.git
synced 2025-07-23 12:43:29 +02:00
memory: mtk-smi: Fix PM usage counter unbalance in mtk_smi ops
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: 4f0a1a1ae3
("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>
This commit is contained in:
committed by
Krzysztof Kozlowski
parent
5c8fe583cc
commit
a2d522ff0f
@@ -130,7 +130,7 @@ static void mtk_smi_clk_disable(const struct mtk_smi *smi)
|
|||||||
|
|
||||||
int mtk_smi_larb_get(struct device *larbdev)
|
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;
|
return (ret < 0) ? ret : 0;
|
||||||
}
|
}
|
||||||
@@ -374,7 +374,7 @@ static int __maybe_unused mtk_smi_larb_resume(struct device *dev)
|
|||||||
int ret;
|
int ret;
|
||||||
|
|
||||||
/* Power on smi-common. */
|
/* 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) {
|
if (ret < 0) {
|
||||||
dev_err(dev, "Failed to pm get for smi-common(%d).\n", ret);
|
dev_err(dev, "Failed to pm get for smi-common(%d).\n", ret);
|
||||||
return ret;
|
return ret;
|
||||||
|
Reference in New Issue
Block a user