[PATCH v1] drm/mipi-dsi: Use put_device() on device_add() failure
From: Yuho Choi
Date: Mon Jun 15 2026 - 15:36:11 EST
mipi_dsi_device_alloc() initializes the embedded struct device before
mipi_dsi_device_register_full() calls mipi_dsi_device_add(). If
device_add() fails, the code frees the DSI object directly with kfree(),
bypassing the device release callback.
Drop the initialized device reference with put_device() instead, so
mipi_dsi_dev_release() runs and releases resources owned by the device,
including the OF node reference.
Fixes: 068a00233969 ("drm: Add MIPI DSI bus support")
Signed-off-by: Yuho Choi <dbgh9129@xxxxxxxxx>
---
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 0390e14d3157..862d56eaf934 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.43.0