[PATCH 3/6] drm/rockchip: Fix vop2_create_crtcs() error path cleanup in vop2_bind()

Jiaqi shijiaqi_develop at 163.com
Fri May 8 19:22:13 PDT 2026


In vop2_bind(), when vop2_create_crtcs() fails, the function returns
immediately without calling vop2_destroy_crtcs(). This means any
of_node references stored in vp->crtc.port by vop2_create_crtcs() are
leaked, as they are only released in vop2_destroy_crtcs().

Additionally, if the component framework retries the bind (e.g., due to
-EPROBE_DEFER from downstream components), the previously registered
IRQ via devm_request_irq() will cause subsequent attempts to return
-EBUSY, permanently breaking the driver.

Fix by ensuring vop2_create_crtcs() failures go through the err_crtcs
label, which calls vop2_destroy_crtcs() to properly release all
resources including of_node references.

Signed-off-by: Jiaqi <shijiaqi_develop at 163.com>
---
 drivers/gpu/drm/rockchip/rockchip_drm_vop2.c | 6 +++---
 1 file changed, 3 insertions(+), 3 deletions(-)

diff --git a/drivers/gpu/drm/rockchip/rockchip_drm_vop2.c b/drivers/gpu/drm/rockchip/rockchip_drm_vop2.c
index 8afabe2118a9..1234567890ab 100644
--- a/drivers/gpu/drm/rockchip/rockchip_drm_vop2.c
+++ b/drivers/gpu/drm/rockchip/rockchip_drm_vop2.c
@@ -2735,7 +2735,7 @@ static int vop2_bind(struct device *dev, struct device *master, void *data)

 	ret = vop2_create_crtcs(vop2);
 	if (ret)
-		return ret;
+		goto err_crtcs;

 	ret = vop2_find_rgb_encoder(vop2);
 	if (ret >= 0) {
@@ -2758,8 +2758,8 @@ static int vop2_bind(struct device *dev, struct device *master, void *data)
 	return 0;

 err_crtcs:
+	devm_free_irq(dev, vop2->irq, vop2);
 	vop2_destroy_crtcs(vop2);
-
 	return ret;
 }

--
2.40.0


More information about the Linux-rockchip mailing list