Thank you for your contribution! Sashiko AI review found 1 potential issue(s) 
to consider:
- [Medium] drm: bridge reference leak on dw_mipi_dsi_host_detach early return
--

commit b7207f37872ee6fe7eb2903e38f89975b930c392
Author: Luca Ceresoli <[email protected]>

drm/bridge: dw-mipi-dsi: stop using deprecated devm_drm_of_get_bridge()

This commit switches from the deprecated devm_drm_of_get_bridge() to
of_drm_get_bridge_by_endpoint() to resolve a build failure when CONFIG_OF
is disabled. Since of_drm_get_bridge_by_endpoint() returns a refcounted
bridge, it adds the necessary put operations to release the reference.

Link: https://lore.kernel.org/r/[email protected]
Link: https://lore.kernel.org/oe-kbuild-all/[email protected]/

> diff --git a/drivers/gpu/drm/bridge/synopsys/dw-mipi-dsi.c 
> b/drivers/gpu/drm/bridge/synopsys/dw-mipi-dsi.c
> index 5dd475fcaacf8..22d1b8cbe1d57 100644
> --- a/drivers/gpu/drm/bridge/synopsys/dw-mipi-dsi.c
> +++ b/drivers/gpu/drm/bridge/synopsys/dw-mipi-dsi.c
[ ... ]
> @@ -368,9 +368,8 @@ static int dw_mipi_dsi_host_detach(struct mipi_dsi_host 
> *host,
>                       return ret;

[Severity: Medium]
If pdata->host_ops->detach() returns a negative error code (e.g., during
device unbind or PHY teardown errors) and takes this early return, does this
leak the bridge reference acquired in the attach function?

Since the bridge is now dynamically refcounted and we skip the newly added
drm_bridge_clear_and_put(&dsi->bridge.next_bridge), it looks like the
reference count will not be properly decremented on this error path.

>       }
>  
> -     drm_of_panel_bridge_remove(host->dev->of_node, 1, 0);
> -
>       drm_bridge_remove(&dsi->bridge);
> +     drm_bridge_clear_and_put(&dsi->bridge.next_bridge);
>  
>       return 0;
>  }

-- 
Sashiko AI review ยท 
https://sashiko.dev/#/patchset/20260929-drm-fix-of_get_bridge-build-regression-v2-0-6da431d8f...@bootlin.com?part=3

Reply via email to