[PATCH] drm/kmb: Release the DSI device lookup reference
From: Alex Guo
Date: Sun Nov 15 2026 - 01:45:10 EST
of_find_device_by_node() takes a reference to the DSI platform device in
kmb_probe(). A failed probe leaves that reference behind. Each retry
while waiting for the bridge can take another reference.
Tie the lookup reference to the display device's managed resources. Drop
it on probe failure or driver removal. The separate references taken by
the DSI initialization code are outside the scope of this change.
A similar issue was fixed in commit 7c6daeaf0a72
("pinctrl: nomadik: fix possible object reference leak").
Fixes: 7f7b96a8a0a1 ("drm/kmb: Add support for KeemBay Display")
Signed-off-by: Alex Guo <alexguo1023@xxxxxxxxx>
---
Build-tested the affected driver object with Clang 18 for arm64.
No hardware test was performed.
drivers/gpu/drm/kmb/kmb_drv.c | 10 ++++++++++
1 file changed, 10 insertions(+)
diff --git a/drivers/gpu/drm/kmb/kmb_drv.c b/drivers/gpu/drm/kmb/kmb_drv.c
index 7c2eb1152fc2..f6d02893035d 100644
--- a/drivers/gpu/drm/kmb/kmb_drv.c
+++ b/drivers/gpu/drm/kmb/kmb_drv.c
@@ -477,6 +477,11 @@ static void kmb_remove(struct platform_device *pdev)
drm_atomic_helper_shutdown(drm);
}
+static void kmb_put_dsi_device(void *data)
+{
+ put_device(data);
+}
+
static int kmb_probe(struct platform_device *pdev)
{
struct device *dev = get_device(&pdev->dev);
@@ -515,6 +520,11 @@ static int kmb_probe(struct platform_device *pdev)
of_node_put(dsi_in);
of_node_put(dsi_node);
+
+ ret = devm_add_action_or_reset(dev, kmb_put_dsi_device, &dsi_pdev->dev);
+ if (ret)
+ return ret;
+
ret = kmb_dsi_host_bridge_init(get_device(&dsi_pdev->dev));
if (ret == -EPROBE_DEFER) {
--
2.43.0