]> git.ipfire.org Git - thirdparty/linux.git/commitdiff
drm/mcde: dsi: mcde_dsi_bind: break when a panel or bridge is found
authorLuca Ceresoli <luca.ceresoli@bootlin.com>
Sat, 31 Jan 2026 15:58:35 +0000 (16:58 +0100)
committerLuca Ceresoli <luca.ceresoli@bootlin.com>
Mon, 23 Feb 2026 09:10:34 +0000 (10:10 +0100)
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.

There seem to be no real reason for looking for multiple panels, so just
break as soon as a match is found.

Reviewed-by: Linus Walleij <linusw@kernel.org>
Link: https://patch.msgid.link/20260131-drm-bridge-alloc-getput-drm_of_find_bridge-4-v2-3-e081bcdc1467@bootlin.com
Signed-off-by: Luca Ceresoli <luca.ceresoli@bootlin.com>
drivers/gpu/drm/mcde/mcde_dsi.c

index a3423459dd7ac8395b77d0479a02ebb3a9ba259c..5893fd2681b32331e328b905673a016dc0b5d011 100644 (file)
@@ -1116,6 +1116,11 @@ static int mcde_dsi_bind(struct device *dev, struct device *master,
                                return -EINVAL;
                        }
                }
+
+               if (panel || bridge) {
+                       of_node_put(child);
+                       break;
+               }
        }
        if (panel) {
                bridge = drm_panel_bridge_add_typed(panel,