From: Arun Iyengar via B4 Relay <devnull+aiyengar1990.gmail.com@kernel.org>
To: "Sandy Huang" <hjc@rock-chips.com>,
"Heiko Stübner" <heiko@sntech.de>, "Andy Yan" <andyshrk@163.com>,
"Maarten Lankhorst" <maarten.lankhorst@linux.intel.com>,
"Maxime Ripard" <mripard@kernel.org>,
"Thomas Zimmermann" <tzimmermann@suse.de>,
"David Airlie" <airlied@gmail.com>,
"Simona Vetter" <simona@ffwll.ch>,
"Sascha Hauer" <s.hauer@pengutronix.de>,
"Rob Herring" <robh@kernel.org>
Cc: dri-devel@lists.freedesktop.org,
linux-rockchip@lists.infradead.org,
linux-arm-kernel@lists.infradead.org,
linux-kernel@vger.kernel.org,
Chaoyi Chen <chaoyi.chen@rock-chips.com>,
Damon Ding <damon.ding@rock-chips.com>,
Cristian Ciocaltea <cristian.ciocaltea@collabora.com>,
Arun Iyengar <aiyengar1990@gmail.com>
Subject: [PATCH v2 1/2] drm/rockchip: vop2: Clean up after a failed vop2_create_crtcs()
Date: Tue, 01 Dec 2026 10:28:05 +0000 [thread overview]
Message-ID: <20261201-vop2-axi-primary-v2-1-e111a8c05883@gmail.com> (raw)
In-Reply-To: <20261201-vop2-axi-primary-v2-0-e111a8c05883@gmail.com>
From: Arun Iyengar <aiyengar1990@gmail.com>
vop2_create_crtcs() returns errors without dropping the port nodes or
the planes and CRTCs it registered. component_bind() then frees struct
vop2 and rockchip_drm_bind() unwinds through drm_mode_config_cleanup()
on the freed planes and CRTCs. The RK3576 interrupt setup after it does
the same.
Call vop2_destroy_crtcs() on these errors and drop every port node
there, not only those of initialised CRTCs.
Fixes: 604be85547ce ("drm/rockchip: Add VOP2 driver")
Reported-by: Sashiko <sashiko-bot@kernel.org>
Closes: https://lore.kernel.org/all/sashiko-outbox-226823@kernel.org/
Signed-off-by: Arun Iyengar <aiyengar1990@gmail.com>
---
drivers/gpu/drm/rockchip/rockchip_drm_vop2.c | 24 +++++++++++++++---------
1 file changed, 15 insertions(+), 9 deletions(-)
diff --git a/drivers/gpu/drm/rockchip/rockchip_drm_vop2.c b/drivers/gpu/drm/rockchip/rockchip_drm_vop2.c
index 76d151b8bc52b..bbe86aecf9039 100644
--- a/drivers/gpu/drm/rockchip/rockchip_drm_vop2.c
+++ b/drivers/gpu/drm/rockchip/rockchip_drm_vop2.c
@@ -2757,18 +2757,20 @@ static void vop2_destroy_crtcs(struct vop2 *vop2)
struct list_head *plane_list = &drm->mode_config.plane_list;
struct drm_crtc *crtc, *tmpc;
struct drm_plane *plane, *tmpp;
+ int i;
list_for_each_entry_safe(plane, tmpp, plane_list, head)
drm_plane_cleanup(plane);
+ for (i = 0; i < vop2->data->nr_vps; i++)
+ of_node_put(vop2->vps[i].crtc.port);
+
/*
* Destroy CRTC after vop2_plane_destroy() since vop2_disable_plane()
* references the CRTC.
*/
- list_for_each_entry_safe(crtc, tmpc, crtc_list, head) {
- of_node_put(crtc->port);
+ list_for_each_entry_safe(crtc, tmpc, crtc_list, head)
drm_crtc_cleanup(crtc);
- }
}
static int vop2_find_rgb_encoder(struct vop2 *vop2)
@@ -3000,7 +3002,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;
if (vop2->version >= VOP_VERSION_RK3576) {
struct drm_crtc *crtc;
@@ -3010,13 +3012,17 @@ static int vop2_bind(struct device *dev, struct device *master, void *data)
int vp_irq;
const char *irq_name = devm_kasprintf(dev, GFP_KERNEL, "vp%d", vp->id);
- if (!irq_name)
- return -ENOMEM;
+ if (!irq_name) {
+ ret = -ENOMEM;
+ goto err_crtcs;
+ }
vp_irq = platform_get_irq_byname(pdev, irq_name);
- if (vp_irq < 0)
- return dev_err_probe(drm->dev, vp_irq,
- "cannot find irq for vop2 vp%d\n", vp->id);
+ if (vp_irq < 0) {
+ ret = dev_err_probe(drm->dev, vp_irq,
+ "cannot find irq for vop2 vp%d\n", vp->id);
+ goto err_crtcs;
+ }
ret = devm_request_irq(dev, vp_irq, rk3576_vp_isr, IRQF_SHARED, irq_name,
vp);
--
2.55.0
next prev parent reply other threads:[~2026-12-01 10:28 UTC|newest]
Thread overview: 3+ messages / expand[flat|nested] mbox.gz Atom feed top
2026-12-01 10:28 [PATCH v2 0/2] drm/rockchip: vop2: Give each RK3588 video port its own cluster Arun Iyengar via B4 Relay
2026-12-01 10:28 ` Arun Iyengar via B4 Relay [this message]
2026-12-01 10:28 ` [PATCH v2 2/2] " Arun Iyengar via B4 Relay
Reply instructions:
You may reply publicly to this message via plain-text email
using any one of the following methods:
* Save the following mbox file, import it into your mail client,
and reply-to-all from there: mbox
Avoid top-posting and favor interleaved quoting:
https://en.wikipedia.org/wiki/Posting_style#Interleaved_style
* Reply using the --to, --cc, and --in-reply-to
switches of git-send-email(1):
git send-email \
--in-reply-to=20261201-vop2-axi-primary-v2-1-e111a8c05883@gmail.com \
--to=devnull+aiyengar1990.gmail.com@kernel.org \
--cc=airlied@gmail.com \
--cc=aiyengar1990@gmail.com \
--cc=andyshrk@163.com \
--cc=chaoyi.chen@rock-chips.com \
--cc=cristian.ciocaltea@collabora.com \
--cc=damon.ding@rock-chips.com \
--cc=dri-devel@lists.freedesktop.org \
--cc=heiko@sntech.de \
--cc=hjc@rock-chips.com \
--cc=linux-arm-kernel@lists.infradead.org \
--cc=linux-kernel@vger.kernel.org \
--cc=linux-rockchip@lists.infradead.org \
--cc=maarten.lankhorst@linux.intel.com \
--cc=mripard@kernel.org \
--cc=robh@kernel.org \
--cc=s.hauer@pengutronix.de \
--cc=simona@ffwll.ch \
--cc=tzimmermann@suse.de \
/path/to/YOUR_REPLY
https://kernel.org/pub/software/scm/git/docs/git-send-email.html
* If your mail client supports setting the In-Reply-To header
via mailto: links, try the mailto: link
Be sure your reply has a Subject: header at the top and a blank line
before the message body.
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®