On Tue Sep 29, 2026 at 3:55 PM CEST, sashiko-bot wrote: > 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.
The issue was there already for drm_of_panel_bridge_remove() (here deleted) and drm_bridge_remove(). Id say it's orthogonal, and most likely nobody has this issue in real life. So I took a note to fix this soon, and I'd let this patch be applied as is because it fixes an issue bothering people. Luca -- Luca Ceresoli, Bootlin Embedded Linux and Kernel engineering https://bootlin.com
