]> git.ipfire.org Git - thirdparty/kernel/linux.git/commitdiff
drm/bridge: imx8qxp-pxl2dpi: imx8qxp_pxl2dpi_find_next_bridge: return int, not ERR_PTR
authorLuca Ceresoli <luca.ceresoli@bootlin.com>
Tue, 16 Dec 2025 17:58:48 +0000 (18:58 +0100)
committerLuca Ceresoli <luca.ceresoli@bootlin.com>
Tue, 30 Dec 2025 09:11:33 +0000 (10:11 +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_pxl2dpi_find_next_bridge() errors
out. Instead of fixing that after the facts in the caller, change the
function to internally set the next_pointer and just return an int error
value.

No functional changes.

Reviewed-by: Maxime Ripard <mripard@kernel.org>
Link: https://patch.msgid.link/20251216-drm-bridge-alloc-getput-drm_of_find_bridge-v3-15-b5165fab8058@bootlin.com
Signed-off-by: Luca Ceresoli <luca.ceresoli@bootlin.com>
drivers/gpu/drm/bridge/imx/imx8qxp-pxl2dpi.c

index e03a411cb9db4d9a315f9924cfaca8213e03efa9..2e66b003386e9d8fb96417e77e6eb4e6acb8d084 100644 (file)
@@ -255,33 +255,27 @@ out:
        return ep;
 }
 
-static struct drm_bridge *
-imx8qxp_pxl2dpi_find_next_bridge(struct imx8qxp_pxl2dpi *p2d)
+static int imx8qxp_pxl2dpi_find_next_bridge(struct imx8qxp_pxl2dpi *p2d)
 {
-       struct drm_bridge *next_bridge;
-       int ret;
-
        struct device_node *ep __free(device_node) =
                imx8qxp_pxl2dpi_get_available_ep_from_port(p2d, 1);
-       if (IS_ERR(ep)) {
-               ret = PTR_ERR(ep);
-               return ERR_PTR(ret);
-       }
+       if (IS_ERR(ep))
+               return PTR_ERR(ep);
 
        struct device_node *remote __free(device_node) = of_graph_get_remote_port_parent(ep);
        if (!remote || !of_device_is_available(remote)) {
                DRM_DEV_ERROR(p2d->dev, "no available remote\n");
-               return ERR_PTR(-ENODEV);
+               return -ENODEV;
        } else if (!of_device_is_available(remote->parent)) {
                DRM_DEV_ERROR(p2d->dev, "remote parent is not available\n");
-               return ERR_PTR(-ENODEV);
+               return -ENODEV;
        }
 
-       next_bridge = of_drm_find_bridge(remote);
-       if (!next_bridge)
-               return ERR_PTR(-EPROBE_DEFER);
+       p2d->next_bridge = of_drm_find_bridge(remote);
+       if (!p2d->next_bridge)
+               return -EPROBE_DEFER;
 
-       return next_bridge;
+       return 0;
 }
 
 static int imx8qxp_pxl2dpi_set_pixel_link_sel(struct imx8qxp_pxl2dpi *p2d)
@@ -414,9 +408,9 @@ static int imx8qxp_pxl2dpi_bridge_probe(struct platform_device *pdev)
                return ret;
        }
 
-       p2d->next_bridge = imx8qxp_pxl2dpi_find_next_bridge(p2d);
-       if (IS_ERR(p2d->next_bridge))
-               return PTR_ERR(p2d->next_bridge);
+       ret = imx8qxp_pxl2dpi_find_next_bridge(p2d);
+       if (ret)
+               return ret;
 
        ret = imx8qxp_pxl2dpi_set_pixel_link_sel(p2d);
        if (ret)