On 09.01.2026 08:31, Luca Ceresoli wrote:
> In preparation to handle refcounting of the out_bridge, we need to ensure
> the out_bridge pointer contains either a valid bridge pointer or NULL, not
> an ERR_PTR. Otherwise calls such as drm_bridge_get/put() would try to
> redeference an ERR_PTR.
>
> Stop using IS_ERR(next_bridge) as an indication of an error, and instead
> use the 'ret' integer.
>
> No functional change.
>
> Acked-by: Maxime Ripard <[email protected]>
> Signed-off-by: Luca Ceresoli <[email protected]>
Tested-by: Marek Szyprowski <[email protected]>
> ---
>   drivers/gpu/drm/bridge/samsung-dsim.c | 9 +++++----
>   1 file changed, 5 insertions(+), 4 deletions(-)
>
> diff --git a/drivers/gpu/drm/bridge/samsung-dsim.c 
> b/drivers/gpu/drm/bridge/samsung-dsim.c
> index 8dd058124e93..afaa63c4d3f7 100644
> --- a/drivers/gpu/drm/bridge/samsung-dsim.c
> +++ b/drivers/gpu/drm/bridge/samsung-dsim.c
> @@ -1891,7 +1891,7 @@ static int samsung_dsim_host_attach(struct 
> mipi_dsi_host *host,
>       struct device_node *np = dev->of_node;
>       struct device_node *remote;
>       struct drm_panel *panel;
> -     int ret;
> +     int ret = 0;
>   
>       /*
>        * Devices can also be child nodes when we also control that device
> @@ -1926,16 +1926,17 @@ static int samsung_dsim_host_attach(struct 
> mipi_dsi_host *host,
>       panel = of_drm_find_panel(remote);
>       if (!IS_ERR(panel)) {
>               next_bridge = devm_drm_panel_bridge_add(dev, panel);
> +             if (IS_ERR(next_bridge))
> +                     ret = PTR_ERR(next_bridge);
>       } else {
>               next_bridge = of_drm_find_bridge(remote);
>               if (!next_bridge)
> -                     next_bridge = ERR_PTR(-EINVAL);
> +                     ret = -EINVAL;
>       }
>   
>       of_node_put(remote);
>   
> -     if (IS_ERR(next_bridge)) {
> -             ret = PTR_ERR(next_bridge);
> +     if (ret) {
>               DRM_DEV_ERROR(dev, "failed to find the bridge: %d\n", ret);
>               return ret;
>       }
>
Best regards
-- 
Marek Szyprowski, PhD
Samsung R&D Institute Poland

Reply via email to