[PATCH] drm: mipi-dsi: Fix an API misuse in mipi_dsi_device_register_full()

Haoxiang Li posted 1 patch 2 months, 3 weeks ago
There is a newer version of this series
drivers/gpu/drm/drm_mipi_dsi.c | 2 +-
1 file changed, 1 insertion(+), 1 deletion(-)
[PATCH] drm: mipi-dsi: Fix an API misuse in mipi_dsi_device_register_full()
Posted by Haoxiang Li 2 months, 3 weeks ago
mipi_dsi_device_alloc() calls device_initialize() to initialize value
"&dsi->dev". Thus "dsi" should be freed using put_device() in error
handling path.

Fixes: 068a00233969 ("drm: Add MIPI DSI bus support")
Cc: stable@vger.kernel.org
Signed-off-by: Haoxiang Li <haoxiang_li2024@163.com>
---
 drivers/gpu/drm/drm_mipi_dsi.c | 2 +-
 1 file changed, 1 insertion(+), 1 deletion(-)

diff --git a/drivers/gpu/drm/drm_mipi_dsi.c b/drivers/gpu/drm/drm_mipi_dsi.c
index 3a9b3278a6e3..21d9aa29ac34 100644
--- a/drivers/gpu/drm/drm_mipi_dsi.c
+++ b/drivers/gpu/drm/drm_mipi_dsi.c
@@ -233,7 +233,7 @@ mipi_dsi_device_register_full(struct mipi_dsi_host *host,
 	ret = mipi_dsi_device_add(dsi);
 	if (ret) {
 		dev_err(host->dev, "failed to add DSI device %d\n", ret);
-		kfree(dsi);
+		put_device(&dsi->dev);
 		return ERR_PTR(ret);
 	}
 
-- 
2.25.1
Re: [PATCH] drm: mipi-dsi: Fix an API misuse in mipi_dsi_device_register_full()
Posted by Dmitry Baryshkov 2 months, 3 weeks ago
On Fri, Sep 26, 2025 at 05:17:58PM +0800, Haoxiang Li wrote:
> mipi_dsi_device_alloc() calls device_initialize() to initialize value
> "&dsi->dev". Thus "dsi" should be freed using put_device() in error
> handling path.
> 
> Fixes: 068a00233969 ("drm: Add MIPI DSI bus support")
> Cc: stable@vger.kernel.org
> Signed-off-by: Haoxiang Li <haoxiang_li2024@163.com>
> ---
>  drivers/gpu/drm/drm_mipi_dsi.c | 2 +-
>  1 file changed, 1 insertion(+), 1 deletion(-)
> 

Reviewed-by: Dmitry Baryshkov <dmitry.baryshkov@oss.qualcomm.com>


-- 
With best wishes
Dmitry