Skip to contentSkip to conversation

drm/msm/dsi: Fix missing put_device() call in dsi_get_phy

PATCH In review Miaoqian Lin 2 participants 2 messages Dec 30, 2021 – Jan 19, 2022

Subsystems (3)
lore
Share & tools
lore
#0 lore raw

PATCH 1/1 drm/msm/dsi: Fix missing put_device() call in dsi_get_phy

If of_find_device_by_node() succeeds, dsi_get_phy() doesn't a corresponding put_device(). Thus add put_device() to fix the exception handling.

Fixes ec31abf ("drm/msm/dsi: Separate PHY to another platform device")
---
 drivers/gpu/drm/msm/dsi/dsi.c | 7 ++++++-
 1 file changed, 6 insertions(+), 1 deletion(-)
drivers/gpu/drm/msm/dsi/dsi.c +6 -1
index 75ae3008b68f..35be526e907a 100644
@@ -40,7 +40,12 @@ static int dsi_get_phy(struct msm_dsi *msm_dsi)
 
 	of_node_put(phy_node);
 
-	if (!phy_pdev || !msm_dsi->phy) {
+	if (!phy_pdev) {
+		DRM_DEV_ERROR(&pdev->dev, "%s: phy driver is not ready\n", __func__);
+		return -EPROBE_DEFER;
+	}
+	if (!msm_dsi->phy) {
+		put_device(&phy_pdev->dev);
 		DRM_DEV_ERROR(&pdev->dev, "%s: phy driver is not ready\n", __func__);
 		return -EPROBE_DEFER;
 	}
Signature · 1 line
2.17.1
Reviewed-by on v1 1/1
#1 lore raw
Quoted 6 lines · Miaoqian Lin

If of_find_device_by_node() succeeds, dsi_get_phy() doesn't a corresponding put_device(). Thus add put_device() to fix the exception handling.

Fixes ec31abf ("drm/msm/dsi: Separate PHY to another platform device")
Quoted 22 lines
---
  drivers/gpu/drm/msm/dsi/dsi.c | 7 ++++++-
  1 file changed, 6 insertions(+), 1 deletion(-)
drivers/gpu/drm/msm/dsi/dsi.c +6 -1
index 75ae3008b68f..35be526e907a 100644
@@ -40,7 +40,12 @@ static int dsi_get_phy(struct msm_dsi *msm_dsi)
 
  	of_node_put(phy_node);
 
-	if (!phy_pdev || !msm_dsi->phy) {
+	if (!phy_pdev) {
+		DRM_DEV_ERROR(&pdev->dev, "%s: phy driver is not ready\n", __func__);
+		return -EPROBE_DEFER;
+	}
+	if (!msm_dsi->phy) {
+		put_device(&phy_pdev->dev);
  		DRM_DEV_ERROR(&pdev->dev, "%s: phy driver is not ready\n", __func__);
  		return -EPROBE_DEFER;
  	}
Signature · 2 lines
With best wishes
Dmitry