UPSTREAM: drm/msm/dsi: Use pm_runtime_resume_and_get to prevent refcnt leaks

[ Upstream commit 3d07a411b4faaf2b498760ccf12888f8de529de0 ]

This helper has been introduced to avoid programmer errors (missing
_put calls leading to dangling refcnt) when using pm_runtime_get, use it.

While at it, start checking the return value.

Signed-off-by: Konrad Dybcio <>
Reviewed-by: Dmitry Baryshkov <>
Fixes: 5c8290284402 ("drm/msm/dsi: Split PHY drivers to separate files")
Signed-off-by: Dmitry Baryshkov <>
Signed-off-by: Sasha Levin <>

Bug: 146449535
Change-Id: I13c0463e50475f3a432818108bc48dd6482c3c7c
Signed-off-by: Amit Pundir <>
diff --git a/drivers/gpu/drm/msm/dsi/phy/dsi_phy.c b/drivers/gpu/drm/msm/dsi/phy/dsi_phy.c
index 123b004..c0bcf02 100644
--- a/drivers/gpu/drm/msm/dsi/phy/dsi_phy.c
+++ b/drivers/gpu/drm/msm/dsi/phy/dsi_phy.c
@@ -512,7 +512,9 @@
 	struct device *dev = &phy->pdev->dev;
 	int ret;
-	pm_runtime_get_sync(dev);
+	ret = pm_runtime_resume_and_get(dev);
+	if (ret)
+		return ret;
 	ret = clk_prepare_enable(phy->ahb_clk);
 	if (ret) {