Skip to contentSkip to conversation

drm/mipi-dsi: Fix error handling in mipi_dsi_device_register_full

PATCH RESEND In review Miaoqian Lin 2 participants 2 messages Jun 1, 2022 – Jun 2, 2022

Subsystems (2)
lore
Share & tools
lore
#0 lore raw

PATCH RESEND 1/1 drm/mipi-dsi: Fix error handling in mipi_dsi_device_register_full

In mipi_dsi_device_alloc(), it calls device_initialize(&dsi->dev); We need to use put_device() instead freeing directly.

Fixes 068a002 ("drm: Add MIPI DSI bus support")
---
 drivers/gpu/drm/drm_mipi_dsi.c | 2 +-
 1 file changed, 1 insertion(+), 1 deletion(-)
drivers/gpu/drm/drm_mipi_dsi.c +1 -1
index c40bde96cfdf..8cc8deca006f 100644
@@ -228,7 +228,7 @@ mipi_dsi_device_register_full(struct mipi_dsi_host *host,
 	ret = mipi_dsi_device_add(dsi);
 	if (ret) {
 		drm_err(host, "failed to add DSI device %d\n", ret);
-		kfree(dsi);
+		put_device(&dsi->dev);
 		return ERR_PTR(ret);
 	}
 
Signature · 1 line
2.25.1
Reviewed-by on v1 1/1
#1 lore raw
Quoted 5 lines · Miaoqian Lin

In mipi_dsi_device_alloc(), it calls device_initialize(&dsi->dev); We need to use put_device() instead freeing directly.

Fixes 068a002 ("drm: Add MIPI DSI bus support")

Looks correct.

Regards
Andrzej

Quoted 17 lines
---
  drivers/gpu/drm/drm_mipi_dsi.c | 2 +-
  1 file changed, 1 insertion(+), 1 deletion(-)
drivers/gpu/drm/drm_mipi_dsi.c +1 -1
index c40bde96cfdf..8cc8deca006f 100644
@@ -228,7 +228,7 @@ mipi_dsi_device_register_full(struct mipi_dsi_host *host,
  	ret = mipi_dsi_device_add(dsi);
  	if (ret) {
  		drm_err(host, "failed to add DSI device %d\n", ret);
-		kfree(dsi);
+		put_device(&dsi->dev);
  		return ERR_PTR(ret);
  	}