Linux-ARM-Kernel Archive on lore.kernel.org
 help / color / mirror / Atom feed
* [PATCH] drm/rockchip: dsi: Fix second reference leak in dw_mipi_dsi_rockchip_bind()
@ 2026-09-16 18:10 Wentao Liang
  0 siblings, 0 replies; only message in thread
From: Wentao Liang @ 2026-09-16 18:10 UTC (permalink / raw)
  To: airlied
  Cc: andrzej.hajda, andy.yan, dri-devel, heiko, hjc, linux-arm-kernel,
	linux-kernel, linux-rockchip, maarten.lankhorst, mripard, simona,
	tzimmermann, Wentao Liang, stable

dw_mipi_dsi_rockchip_find_second() hands back the dual-DSI partner
device with a reference from of_find_device_by_node().  The bind path
only drops it after a successful master setup; the four early returns
(both/no clock-master, the slave shortcut and a missing slave drvdata)
leave the reference behind.  Drop it on all of them.

Fixes: cf6d100dd238 ("drm/rockchip: dsi: add dual mipi support")
Cc: stable@vger.kernel.org
Signed-off-by: Wentao Liang <vulab@iscas.ac.cn>
---
 drivers/gpu/drm/rockchip/dw-mipi-dsi-rockchip.c | 4 ++++
 1 file changed, 4 insertions(+)

diff --git a/drivers/gpu/drm/rockchip/dw-mipi-dsi-rockchip.c b/drivers/gpu/drm/rockchip/dw-mipi-dsi-rockchip.c
index 3547d91b25d3..4ab29410b2c0 100644
--- a/drivers/gpu/drm/rockchip/dw-mipi-dsi-rockchip.c
+++ b/drivers/gpu/drm/rockchip/dw-mipi-dsi-rockchip.c
@@ -933,23 +933,27 @@ static int dw_mipi_dsi_rockchip_bind(struct device *dev,
 
 		if (master1 && master2) {
 			DRM_DEV_ERROR(dsi->dev, "only one clock-master allowed\n");
+			put_device(second);
 			return -EINVAL;
 		}
 
 		if (!master1 && !master2) {
 			DRM_DEV_ERROR(dsi->dev, "no clock-master defined\n");
+			put_device(second);
 			return -EINVAL;
 		}
 
 		/* we are the slave in dual-DSI */
 		if (!master1) {
 			dsi->is_slave = true;
+			put_device(second);
 			return 0;
 		}
 
 		dsi->slave = dev_get_drvdata(second);
 		if (!dsi->slave) {
 			DRM_DEV_ERROR(dev, "could not get slaves data\n");
+			put_device(second);
 			return -ENODEV;
 		}
 
-- 
2.34.1



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

only message in thread, other threads:[~2026-09-16 18:11 UTC | newest]

Thread overview: (only message) (download: mbox.gz follow: Atom feed
-- links below jump to the message on this page --
2026-09-16 18:10 [PATCH] drm/rockchip: dsi: Fix second reference leak in dw_mipi_dsi_rockchip_bind() Wentao Liang

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