On Wed Feb 4, 2026 at 10:21 AM CET, Chen Ni wrote:
> Return the value of devm_drm_bridge_add() in order to propagate the
> error properly, if it fails due to resource allocation failure or bridge
> registration failure.
>
> This ensures that the bind function fails safely rather than proceeding
> with a potentially incomplete bridge setup.
>
> Fixes: b726970486d8 ("drm/bridge: synopsys: dw-dp: add bridge before 
> attaching")
> Signed-off-by: Chen Ni <[email protected]>

Ah, good catch, thanks for the patch!

> ---
> Changes in v2:
> - Use ERR_PTR() instead of dev_err_ptr_probe().
> ---
>  drivers/gpu/drm/bridge/synopsys/dw-dp.c | 6 +++++-
>  1 file changed, 5 insertions(+), 1 deletion(-)
>
> diff --git a/drivers/gpu/drm/bridge/synopsys/dw-dp.c 
> b/drivers/gpu/drm/bridge/synopsys/dw-dp.c
> index 432342452484..29fcba7a47d3 100644
> --- a/drivers/gpu/drm/bridge/synopsys/dw-dp.c
> +++ b/drivers/gpu/drm/bridge/synopsys/dw-dp.c
> @@ -2049,7 +2049,11 @@ struct dw_dp *dw_dp_bind(struct device *dev, struct 
> drm_encoder *encoder,
>       bridge->type = DRM_MODE_CONNECTOR_DisplayPort;
>       bridge->ycbcr_420_allowed = true;
>
> -     devm_drm_bridge_add(dev, bridge);
> +     ret = devm_drm_bridge_add(dev, bridge);
> +     if (ret) {
> +             dev_err_probe(dev, ret, "failed to add bridge\n");
> +             return ERR_PTR(ret);
> +     }

Looks correct, but can be simpler:

        ret = devm_drm_bridge_add(dev, bridge);
        if (ret)
                return ERR_PTR(dev_err_probe(dev, ret, "failed to add 
bridge\n"));

Also, when sending a new iteration, it is common to _not_ send the patch as
a reply to the previous iteration. It can generate huge threads for long
series. Also I'd not be surprised if it confused some tools, even though I
just did a quick test with b4 and it seems to do the expected thing (take
v2, not v1).

Best regards,
Luca

--
Luca Ceresoli, Bootlin
Embedded Linux and Kernel engineering
https://bootlin.com

Reply via email to