Skip to contentSkip to conversation

drm/msm/dsi: add missing put_device()

PATCH In review [email protected] 2 participants 2 messages Jul 18, 2023 1 message not in the archive

Subsystems (3)
lore
Share & tools
lore

A message that is not in the archive (sent off-list or not yet received): [email protected]

#1 lore raw

PATCH 1/1 drm/msm/dsi: add missing put_device()

The of_find_device_by_node() takes a reference to the underlying device structure, we should release that reference.

Detected by coccinelle with the following ERROR:
./drivers/gpu/drm/msm/dsi/dsi.c:50:1-7: ERROR: missing put_device; call of_find_device_by_node on line 32, but without a corresponding object release within this function.

---
 drivers/gpu/drm/msm/dsi/dsi.c | 2 +-
 1 file changed, 1 insertion(+), 1 deletion(-)
drivers/gpu/drm/msm/dsi/dsi.c +0 -0
index baab79ab6e74..81461e8852a7 100644
@@ -46,7 +46,7 @@ static int dsi_get_phy(struct msm_dsi *msm_dsi)
         DRM_DEV_ERROR(&pdev->dev, "%s: phy driver is not ready\n", 
__func__);
         return -EPROBE_DEFER;
     }
-
+    put_device(&pdev->dev);
     return 0;

}

#2 lore raw
Quoted 18 lines · On 18/07/2023 11:13, [email protected] wrote:

The of_find_device_by_node() takes a reference to the underlying device structure, we should release that reference.

Detected by coccinelle with the following ERROR:
./drivers/gpu/drm/msm/dsi/dsi.c:50:1-7: ERROR: missing put_device; call of_find_device_by_node on line 32, but without a corresponding object release within this function.

---
  drivers/gpu/drm/msm/dsi/dsi.c | 2 +-
  1 file changed, 1 insertion(+), 1 deletion(-)
drivers/gpu/drm/msm/dsi/dsi.c +0 -0
index baab79ab6e74..81461e8852a7 100644

drivers/gpu/drm/msm/dsi/dsi.c static int dsi_get_phy(struct msm_dsi *msm_dsi) · line 50

Quoted 6 lines
drivers/gpu/drm/msm/dsi/dsi.c +1 -1
@@ -46,7 +46,7 @@ static int dsi_get_phy(struct msm_dsi *msm_dsi)
          DRM_DEV_ERROR(&pdev->dev, "%s: phy driver is not ready\n", 
 __func__);
          return -EPROBE_DEFER;
      }
-
+    put_device(&pdev->dev);

NAK. First, you are putting pdev instead of phy_pdev. Next, the reference to the phy dev is correctly stored and then put in dsi_destroy(). Please do not make blind patches when reviewing static analyser warnings.

Quoted 2 lines
drivers/gpu/drm/msm/dsi/dsi.c +0 -0
      return 0;
  }
Signature · 2 lines
With best wishes
Dmitry