Linux kernel mirror (for testing) git.kernel.org/pub/scm/linux/kernel/git/torvalds/linux.git
kernel os linux
1
fork

Configure Feed

Select the types of activity you want to include in your feed.

drm/bridge: imx8qxp-pxl2dpi: imx8qxp_pxl2dpi_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_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>

+12 -18
+12 -18
drivers/gpu/drm/bridge/imx/imx8qxp-pxl2dpi.c
··· 255 255 return ep; 256 256 } 257 257 258 - static struct drm_bridge * 259 - imx8qxp_pxl2dpi_find_next_bridge(struct imx8qxp_pxl2dpi *p2d) 258 + static int imx8qxp_pxl2dpi_find_next_bridge(struct imx8qxp_pxl2dpi *p2d) 260 259 { 261 - struct drm_bridge *next_bridge; 262 - int ret; 263 - 264 260 struct device_node *ep __free(device_node) = 265 261 imx8qxp_pxl2dpi_get_available_ep_from_port(p2d, 1); 266 - if (IS_ERR(ep)) { 267 - ret = PTR_ERR(ep); 268 - return ERR_PTR(ret); 269 - } 262 + if (IS_ERR(ep)) 263 + return PTR_ERR(ep); 270 264 271 265 struct device_node *remote __free(device_node) = of_graph_get_remote_port_parent(ep); 272 266 if (!remote || !of_device_is_available(remote)) { 273 267 DRM_DEV_ERROR(p2d->dev, "no available remote\n"); 274 - return ERR_PTR(-ENODEV); 268 + return -ENODEV; 275 269 } else if (!of_device_is_available(remote->parent)) { 276 270 DRM_DEV_ERROR(p2d->dev, "remote parent is not available\n"); 277 - return ERR_PTR(-ENODEV); 271 + return -ENODEV; 278 272 } 279 273 280 - next_bridge = of_drm_find_bridge(remote); 281 - if (!next_bridge) 282 - return ERR_PTR(-EPROBE_DEFER); 274 + p2d->next_bridge = of_drm_find_bridge(remote); 275 + if (!p2d->next_bridge) 276 + return -EPROBE_DEFER; 283 277 284 - return next_bridge; 278 + return 0; 285 279 } 286 280 287 281 static int imx8qxp_pxl2dpi_set_pixel_link_sel(struct imx8qxp_pxl2dpi *p2d) ··· 408 414 return ret; 409 415 } 410 416 411 - p2d->next_bridge = imx8qxp_pxl2dpi_find_next_bridge(p2d); 412 - if (IS_ERR(p2d->next_bridge)) 413 - return PTR_ERR(p2d->next_bridge); 417 + ret = imx8qxp_pxl2dpi_find_next_bridge(p2d); 418 + if (ret) 419 + return ret; 414 420 415 421 ret = imx8qxp_pxl2dpi_set_pixel_link_sel(p2d); 416 422 if (ret)