mirror of
https://git.kernel.org/pub/scm/linux/kernel/git/torvalds/linux.git
synced 2026-05-16 16:01:44 -04:00
drm/bridge: imx8qxp-pixel-link: imx8qxp_pixel_link_find_next_bridge: return int, not ERR_PTR
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>
This commit is contained in:
@@ -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);
|
||||
|
||||
|
||||
Reference in New Issue
Block a user