]> git.ipfire.org Git - thirdparty/linux.git/commitdiff
drm/bridge: imx8qxp-pixel-link: imx8qxp_pixel_link_find_next_bridge: return int,...
authorLuca Ceresoli <luca.ceresoli@bootlin.com>
Wed, 7 Jan 2026 09:56:28 +0000 (10:56 +0100)
committerLuca Ceresoli <luca.ceresoli@bootlin.com>
Thu, 29 Jan 2026 17:44:03 +0000 (18:44 +0100)
In preparation for using bridge->next_bridge, we need to ensure that it
will never contain anything but NULL or a valid bridge pointer. Current
code stores an ERR_PTR when imx8qxp_pixel_link_find_next_bridge() errors
out. Instead of fixing that after the facts in the caller, change the
function to internally set pl->next_bridge and just return an int error
value.

No functional changes.

Reviewed-by: Maxime Ripard <mripard@kernel.org>
Acked-by: Liu Ying <victor.liu@nxp.com>
Link: https://patch.msgid.link/20260107-drm-bridge-alloc-getput-drm_of_find_bridge-v4-3-a62b4399a6bf@bootlin.com
Signed-off-by: Luca Ceresoli <luca.ceresoli@bootlin.com>
drivers/gpu/drm/bridge/imx/imx8qxp-pixel-link.c

index 0c5ed06eee1b865e6e39ca7cce4a44993513410a..91e4f4d55469c27da9f48631ca4490b815406100 100644 (file)
@@ -256,8 +256,7 @@ static int imx8qxp_pixel_link_disable_all_controls(struct imx8qxp_pixel_link *pl
        return imx8qxp_pixel_link_disable_sync(pl);
 }
 
-static struct drm_bridge *
-imx8qxp_pixel_link_find_next_bridge(struct imx8qxp_pixel_link *pl)
+static int imx8qxp_pixel_link_find_next_bridge(struct imx8qxp_pixel_link *pl)
 {
        struct device_node *np = pl->dev->of_node;
        struct device_node *port;
@@ -282,7 +281,7 @@ imx8qxp_pixel_link_find_next_bridge(struct imx8qxp_pixel_link *pl)
 
        if (!found_port) {
                DRM_DEV_ERROR(pl->dev, "no available output port\n");
-               return ERR_PTR(-ENODEV);
+               return -ENODEV;
        }
 
        for (reg = 0; reg < PL_MAX_NEXT_BRIDGES; reg++) {
@@ -300,7 +299,7 @@ imx8qxp_pixel_link_find_next_bridge(struct imx8qxp_pixel_link *pl)
 
                struct drm_bridge *next_bridge = of_drm_find_bridge(remote);
                if (!next_bridge)
-                       return ERR_PTR(-EPROBE_DEFER);
+                       return -EPROBE_DEFER;
 
                /*
                 * Select the next bridge with companion PXL2DPI if
@@ -311,8 +310,9 @@ imx8qxp_pixel_link_find_next_bridge(struct imx8qxp_pixel_link *pl)
        }
 
        pl->mst_addr = port_id - 1;
+       pl->next_bridge = selected_bridge;
 
-       return selected_bridge;
+       return 0;
 }
 
 static int imx8qxp_pixel_link_bridge_probe(struct platform_device *pdev)
@@ -368,9 +368,9 @@ static int imx8qxp_pixel_link_bridge_probe(struct platform_device *pdev)
        if (ret)
                return ret;
 
-       pl->next_bridge = imx8qxp_pixel_link_find_next_bridge(pl);
-       if (IS_ERR(pl->next_bridge))
-               return PTR_ERR(pl->next_bridge);
+       ret = imx8qxp_pixel_link_find_next_bridge(pl);
+       if (ret)
+               return ret;
 
        platform_set_drvdata(pdev, pl);