RE: [PATCH] drm/renesas: rz-du: Fix MIPI DSI host leak on probe failure
From: Biju Das
Date: Fri Apr 24 2026 - 08:12:26 EST
Hi Myeonghun Pak,
Thanks for the patch.
> -----Original Message-----
> From: Myeonghun Pak <mhun512@xxxxxxxxx>
> Sent: 24 April 2026 12:59
> Subject: [PATCH] drm/renesas: rz-du: Fix MIPI DSI host leak on probe failure
>
> rzg2l_mipi_dsi_probe() registers the MIPI DSI host before allocating the DCS buffer. If
> dma_alloc_coherent() fails, probe returns -ENOMEM directly and leaves the host registered.
>
> The remove callback unregisters the host, but remove is only called after a successful probe. Add a
> local unwind path that unregisters the host before disabling runtime PM on the DCS buffer allocation
> failure path.
A similar patch [1] already posted
[1] https://lore.kernel.org/linux-renesas-soc/TY3PR01MB113464115454EB533EE670E81862B2@xxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxx/T/#m3c56399b78f8661ff2b5bfc2f2d8a1364a9ebf7d
Cheers,
Biju
>
> Signed-off-by: Myeonghun Pak <mhun512@xxxxxxxxx>
> ---
> drivers/gpu/drm/renesas/rz-du/rzg2l_mipi_dsi.c | 9 +++++++--
> 1 file changed, 7 insertions(+), 2 deletions(-)
>
> diff --git a/drivers/gpu/drm/renesas/rz-du/rzg2l_mipi_dsi.c b/drivers/gpu/drm/renesas/rz-
> du/rzg2l_mipi_dsi.c
> index 29f2b7d24f..309fae1459 100644
> --- a/drivers/gpu/drm/renesas/rz-du/rzg2l_mipi_dsi.c
> +++ b/drivers/gpu/drm/renesas/rz-du/rzg2l_mipi_dsi.c
> @@ -1476,14 +1476,19 @@ static int rzg2l_mipi_dsi_probe(struct platform_device *pdev)
>
> dsi->dcs_buf_virt = dma_alloc_coherent(dsi->host.dev, RZG2L_DCS_BUF_SIZE,
> &dsi->dcs_buf_phys, GFP_KERNEL);
> - if (!dsi->dcs_buf_virt)
> - return -ENOMEM;
> + if (!dsi->dcs_buf_virt) {
> + ret = -ENOMEM;
> + goto err_host_unregister;
> + }
>
> return 0;
>
> err_phy:
> dsi->info->dphy_exit(dsi);
> pm_runtime_put(dsi->dev);
> + goto err_pm_disable;
> +err_host_unregister:
> + mipi_dsi_host_unregister(&dsi->host);
> err_pm_disable:
> pm_runtime_disable(dsi->dev);
> return ret;
> --