[PATCH] drm/kmb: Fix dsi_pdev reference leak in kmb_probe()

From: Wentao Liang

Date: Wed Sep 16 2026 - 13:48:51 EST


The reference taken by of_find_device_by_node() is dropped on none of
kmb_probe()'s error paths: the -EPROBE_DEFER retry, the DSI host bridge
init failure, the drm device allocation failure and the later cleanup
labels. Drop the reference on each of them.

Fixes: 7f7b96a8a0a1 ("drm/kmb: Add support for KeemBay Display")
Cc: stable@xxxxxxxxxxxxxxx
Signed-off-by: Wentao Liang <vulab@xxxxxxxxxxx>
---
drivers/gpu/drm/kmb/kmb_drv.c | 7 ++++++-
1 file changed, 6 insertions(+), 1 deletion(-)

diff --git a/drivers/gpu/drm/kmb/kmb_drv.c b/drivers/gpu/drm/kmb/kmb_drv.c
index 7c2eb1152fc2..65df630bf888 100644
--- a/drivers/gpu/drm/kmb/kmb_drv.c
+++ b/drivers/gpu/drm/kmb/kmb_drv.c
@@ -518,17 +518,21 @@ static int kmb_probe(struct platform_device *pdev)
ret = kmb_dsi_host_bridge_init(get_device(&dsi_pdev->dev));

if (ret == -EPROBE_DEFER) {
+ put_device(&dsi_pdev->dev);
return -EPROBE_DEFER;
} else if (ret) {
DRM_ERROR("probe failed to initialize DSI host bridge\n");
+ put_device(&dsi_pdev->dev);
return ret;
}

/* Create DRM device */
kmb = devm_drm_dev_alloc(dev, &kmb_driver,
struct kmb_drm_private, drm);
- if (IS_ERR(kmb))
+ if (IS_ERR(kmb)) {
+ put_device(&dsi_pdev->dev);
return PTR_ERR(kmb);
+ }

dev_set_drvdata(dev, &kmb->drm);

@@ -577,6 +581,7 @@ static int kmb_probe(struct platform_device *pdev)
err_free1:
dev_set_drvdata(dev, NULL);
kmb_dsi_host_unregister(kmb->kmb_dsi);
+ put_device(&dsi_pdev->dev);

return ret;
}
--
2.34.1