mirror of https://lore.kernel.org/lkml/
 help / color / mirror / Atom feed
* [PATCH v1] drm/mipi-dsi: Use put_device() on device_add() failure
@ 2026-06-15 19:35 Yuho Choi
  0 siblings, 0 replies; only message in thread
From: Yuho Choi @ 2026-06-15 19:35 UTC (permalink / raw)
  To: Maarten Lankhorst, Maxime Ripard, Thomas Zimmermann,
	David Airlie, Simona Vetter
  Cc: dri-devel, linux-kernel, Yuho Choi

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@gmail.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 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


^ permalink raw reply	[flat|nested] only message in thread

only message in thread, other threads:[~2026-06-15 19:36 UTC | newest]

Thread overview: (only message) (download: mbox.gz / follow: Atom feed)
-- links below jump to the message on this page --
2026-06-15 19:35 [PATCH v1] drm/mipi-dsi: Use put_device() on device_add() failure Yuho Choi

This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox

all inboxes | Powered by JetHome®