[<prev] [next>] [<thread-prev] [thread-next>] [day] [month] [year] [list]
Message-Id: <20260116-drm-bridge-alloc-getput-drm_of_find_bridge-4-v1-3-e34b38f50d27@bootlin.com>
Date: Fri, 16 Jan 2026 18:32:38 +0100
From: Luca Ceresoli <luca.ceresoli@...tlin.com>
To: Biju Das <biju.das.jz@...renesas.com>,
Maarten Lankhorst <maarten.lankhorst@...ux.intel.com>,
Maxime Ripard <mripard@...nel.org>, Thomas Zimmermann <tzimmermann@...e.de>,
David Airlie <airlied@...il.com>, Simona Vetter <simona@...ll.ch>,
Anitha Chrisanthus <anitha.chrisanthus@...el.com>,
Edmund Dea <edmund.j.dea@...el.com>, Linus Walleij <linusw@...nel.org>,
Laurent Pinchart <laurent.pinchart+renesas@...asonboard.com>,
Tomi Valkeinen <tomi.valkeinen+renesas@...asonboard.com>,
Kieran Bingham <kieran.bingham+renesas@...asonboard.com>,
Geert Uytterhoeven <geert+renesas@...der.be>,
Magnus Damm <magnus.damm@...il.com>,
Tomi Valkeinen <tomi.valkeinen@...asonboard.com>
Cc: Hui Pu <Hui.Pu@...ealthcare.com>, Ian Ray <ian.ray@...ealthcare.com>,
Thomas Petazzoni <thomas.petazzoni@...tlin.com>,
dri-devel@...ts.freedesktop.org, linux-renesas-soc@...r.kernel.org,
linux-kernel@...r.kernel.org, Luca Ceresoli <luca.ceresoli@...tlin.com>
Subject: [PATCH 3/6] drm/mcde: dsi: warn in case of multiple subnodes
mcde_dsi_bind() has a loop over all subnodes looking for a panel, but does
not exit when a match is found and only stores the last match. However this
will be problematic when introducing refcounting on the struct drm_device
pointer in a following commit, because of_drm_find_and_get_bridge() would
get a reference to multiple bridges.
Assuming there is no real reason for looking for multiple panels, add a
warning so it gets noticed in case the assumption is wrong.
Signed-off-by: Luca Ceresoli <luca.ceresoli@...tlin.com>
---
I think the correct thing to do would be adding a break statement when
there is a match. However I don't have knowledge of this driver and the
hardware, thus this patch is a prudential alternative, not changing the
behaviour.
---
drivers/gpu/drm/mcde/mcde_dsi.c | 3 +++
1 file changed, 3 insertions(+)
diff --git a/drivers/gpu/drm/mcde/mcde_dsi.c b/drivers/gpu/drm/mcde/mcde_dsi.c
index a3423459dd7a..3faebe571fc2 100644
--- a/drivers/gpu/drm/mcde/mcde_dsi.c
+++ b/drivers/gpu/drm/mcde/mcde_dsi.c
@@ -1103,6 +1103,9 @@ static int mcde_dsi_bind(struct device *dev, struct device *master,
/* Look for a panel as a child to this node */
for_each_available_child_of_node(dev->of_node, child) {
+ /* There should be only one panel subnode */
+ WARN_ON(panel || bridge);
+
panel = of_drm_find_panel(child);
if (IS_ERR(panel)) {
dev_err(dev, "failed to find panel try bridge (%ld)\n",
--
2.52.0
Powered by blists - more mailing lists