mirror of https://lore.kernel.org/lkml/
 help / color / mirror / Atom feed
From: "Luca Ceresoli" <luca.ceresoli@bootlin.com>
To: "Chen Ni" <nichen@iscas.ac.cn>, <andyshrk@163.com>,
	<Laurent.pinchart@ideasonboard.com>, <airlied@gmail.com>,
	<andrzej.hajda@intel.com>, <andy.yan@rock-chips.com>,
	<jernej.skrabec@gmail.com>, <jonas@kwiboo.se>,
	<maarten.lankhorst@linux.intel.com>, <mripard@kernel.org>,
	<neil.armstrong@linaro.org>, <rfoss@kernel.org>,
	<rgallaispou@gmail.com>, <simona@ffwll.ch>, <tzimmermann@suse.de>
Cc: <dri-devel@lists.freedesktop.org>, <linux-kernel@vger.kernel.org>
Subject: Re: [PATCH v2] drm/bridge: synopsys: dw-dp: Check return value of devm_drm_bridge_add() in dw_dp_bind()
Date: Thu, 05 Feb 2026 10:06:09 +0100	[thread overview]
Message-ID: <DG6WQ5F88DOH.1ITTFO6WDJ4AS@bootlin.com> (raw)
In-Reply-To: <20260204092148.2309681-1-nichen@iscas.ac.cn>

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 <nichen@iscas.ac.cn>

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

  parent reply	other threads:[~2026-02-05  9:06 UTC|newest]

Thread overview: 6+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2026-02-04  7:53 [PATCH] " Chen Ni
2026-02-04  8:14 ` Andy Yan
2026-02-04  9:21   ` [PATCH v2] " Chen Ni
2026-02-04  9:42     ` Andy Yan
2026-02-05  9:06     ` Luca Ceresoli [this message]
2026-02-05  9:21       ` [PATCH " Luca Ceresoli

Reply instructions:

You may reply publicly to this message via plain-text email
using any one of the following methods:

* Save the following mbox file, import it into your mail client,
  and reply-to-all from there: mbox

  Avoid top-posting and favor interleaved quoting:
  https://en.wikipedia.org/wiki/Posting_style#Interleaved_style

* Reply using the --to, --cc, and --in-reply-to
  switches of git-send-email(1):

  git send-email \
    --in-reply-to=DG6WQ5F88DOH.1ITTFO6WDJ4AS@bootlin.com \
    --to=luca.ceresoli@bootlin.com \
    --cc=Laurent.pinchart@ideasonboard.com \
    --cc=airlied@gmail.com \
    --cc=andrzej.hajda@intel.com \
    --cc=andy.yan@rock-chips.com \
    --cc=andyshrk@163.com \
    --cc=dri-devel@lists.freedesktop.org \
    --cc=jernej.skrabec@gmail.com \
    --cc=jonas@kwiboo.se \
    --cc=linux-kernel@vger.kernel.org \
    --cc=maarten.lankhorst@linux.intel.com \
    --cc=mripard@kernel.org \
    --cc=neil.armstrong@linaro.org \
    --cc=nichen@iscas.ac.cn \
    --cc=rfoss@kernel.org \
    --cc=rgallaispou@gmail.com \
    --cc=simona@ffwll.ch \
    --cc=tzimmermann@suse.de \
    /path/to/YOUR_REPLY

  https://kernel.org/pub/software/scm/git/docs/git-send-email.html

* If your mail client supports setting the In-Reply-To header
  via mailto: links, try the mailto: link
Be sure your reply has a Subject: header at the top and a blank line before the message body.
This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox

all inboxes | Powered by JetHome®