drm/mediatek: Fix PM reference leak in mtk_crtc_ddp_hw_init()
Subsystems (4)
PATCH 1/1 drm/mediatek: Fix PM reference leak in mtk_crtc_ddp_hw_init()
pm_runtime_get_sync will increment pm usage counter even it failed. Forgetting to putting operation will result in reference leak here. Fix it by replacing it with pm_runtime_resume_and_get to keep usage counter balanced.
--- drivers/gpu/drm/mediatek/mtk_drm_crtc.c | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-)
drivers/gpu/drm/mediatek/mtk_drm_crtc.c +1 -1
@@ -259,7 +259,7 @@ static int mtk_crtc_ddp_hw_init(struct mtk_drm_crtc *mtk_crtc)drm_connector_list_iter_end (&conn_iter); } - ret =pm_runtime_get_sync (crtc->dev->dev); + ret =pm_runtime_resume_and_get (crtc->dev->dev);if (ret <0 ) {DRM_ERROR ("Failed to enable power domain: %d\n" , ret);return ret;
Signature · 7 lines
2.17.1 _______________________________________________ Linux-mediatek mailing list [email protected] http://lists.infradead.org/mailman/listinfo/linux-mediatek
Hi, Wang:
Wang Li <[email protected]> 於 2021年4月10日 週六 上午11:31寫道:
Quoted 5 lines
pm_runtime_get_syncwill increment pm usage counter even it failed. Forgetting to putting operation will result in reference leak here. Fix it by replacing it withpm_runtime_resume_and_getto keep usage counter balanced.
Quoted 21 lines
Reported-by Hulk Robot <[email protected]>Signed-off-by Wang Li <[email protected]>--- drivers/gpu/drm/mediatek/mtk_drm_crtc.c | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-)drivers/gpu/drm/mediatek/mtk_drm_crtc.c +1
-2@@ -259,7 +259,7 @@ static int mtk_crtc_ddp_hw_init(struct mtk_drm_crtc *mtk_crtc)drm_connector_list_iter_end (&conn_iter); } - ret =pm_runtime_get_sync (crtc->dev->dev); + ret =pm_runtime_resume_and_get (crtc->dev->dev);if (ret <0 ) {DRM_ERROR ("Failed to enable power domain: %d\n" , ret);return ret; --
Quoted 2 lines
2.17.1
_______________________________________________
dri-devel mailing list
[email protected]
https://lists.freedesktop.org/mailman/listinfo/dri-devel
Hi, Wang:
Chun-Kuang Hu <[email protected]> 於 2021年4月12日 週一 下午11:32寫道:
Quoted 9 lines
Hi, Wang:
Wang Li <[email protected]> 於 2021年4月10日 週六 上午11:31寫道:
Quoted 5 lines
pm_runtime_get_syncwill increment pm usage counter even it failed. Forgetting to putting operation will result in reference leak here. Fix it by replacing it withpm_runtime_resume_and_getto keep usage counter balanced.
Applied to mediatek-drm-next [1], thanks.
[1] https://git.kernel.org/pub/scm/linux/kernel/git/chunkuang.hu/linux.git/log/?h=mediatek-drm-next
Regards,
Chun-Kuang.
Quoted 26 lines
Reviewed-by Chun-Kuang Hu <[email protected]>Quoted 23 lines
Reported-by Hulk Robot <[email protected]>Signed-off-by Wang Li <[email protected]>--- drivers/gpu/drm/mediatek/mtk_drm_crtc.c | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-)drivers/gpu/drm/mediatek/mtk_drm_crtc.c +1
-2@@ -259,7 +259,7 @@ static int mtk_crtc_ddp_hw_init(struct mtk_drm_crtc *mtk_crtc)drm_connector_list_iter_end (&conn_iter); } - ret =pm_runtime_get_sync (crtc->dev->dev); + ret =pm_runtime_resume_and_get (crtc->dev->dev);if (ret <0 ) {DRM_ERROR ("Failed to enable power domain: %d\n" , ret);return ret; --2.17.1