Devicetree
 help / color / mirror / Atom feed
From: sashiko-bot@kernel.org
To: "Sebastian Reichel" <sebastian.reichel@collabora.com>
Cc: devicetree@vger.kernel.org, conor+dt@kernel.org, robh@kernel.org,
	dri-devel@lists.freedesktop.org
Subject: Re: [PATCH v3 03/10] drm/bridge: synopsys: dw-dp: Add follow-up bridge support
Date: Tue, 23 Jun 2026 19:49:21 +0000	[thread overview]
Message-ID: <20260623194922.4F4BD1F000E9@smtp.kernel.org> (raw)
In-Reply-To: <20260612-synopsys-dw-dp-improvements-v3-3-dc61e6352508@collabora.com>

Thank you for your contribution! Sashiko AI review found 4 potential issue(s) to consider:

New issues:
- [High] Memory leak of the follow-up bridge reference count.
- [High] Unconditional probe failure causing DT backward compatibility breakage.

Pre-existing issues:
- [High] Missing completion reinitialization causes race conditions with stale completion states during AUX transfers.
- [High] Premature registration and exposure of the DP AUX channel to userspace before hardware and IRQ initialization.
--

commit ceef3e5c9dcfb09773dad5a727e1e2147c87f8e5
Author: Sebastian Reichel <sebastian.reichel@collabora.com>

drm/bridge: synopsys: dw-dp: Add follow-up bridge support

Add support to use USB-C connectors with the DP altmode helper code on
devicetree based platforms. To get this working there must be a DRM bridge
chain from the DisplayPort controller to the USB-C connector.

> diff --git a/drivers/gpu/drm/bridge/synopsys/dw-dp.c b/drivers/gpu/drm/bridge/synopsys/dw-dp.c
> index ac7779e42bb24..98cff435dfb87 100644
> --- a/drivers/gpu/drm/bridge/synopsys/dw-dp.c
> +++ b/drivers/gpu/drm/bridge/synopsys/dw-dp.c
> @@ -1970,7 +1970,7 @@ struct dw_dp *dw_dp_bind(struct device *dev, struct drm_encoder *encoder,
>  {
>  	struct platform_device *pdev = to_platform_device(dev);
>  	struct dw_dp *dp;
> -	struct drm_bridge *bridge;
> +	struct drm_bridge *bridge, *next_bridge;
>  	void __iomem *res;
>  	int ret;
>  
> @@ -2064,6 +2064,20 @@ struct dw_dp *dw_dp_bind(struct device *dev, struct drm_encoder *encoder,
>  		goto unregister_aux;
>  	}
>  
> +	next_bridge = of_drm_get_bridge_by_endpoint(dev->of_node, 1, 0);
> +	if (IS_ERR(next_bridge)) {

[Severity: High]
Can this unconditional check break device tree backward compatibility?

By making the absence of a follow-up bridge a fatal error instead of an
optional configuration, this appears to cause the display driver to
completely fail to probe on existing platforms that do not define a downstream
bridge endpoint in their device tree.

> +		ret = PTR_ERR(next_bridge);
> +		dev_err_probe(dev, ret, "failed to get follow-up bridge.\n");
> +		goto unregister_aux;
> +	}
> +
> +	ret = drm_bridge_attach(encoder, next_bridge, bridge,
> +				DRM_BRIDGE_ATTACH_NO_CONNECTOR);

[Severity: High]
Does this code leak the next_bridge reference?

Calling of_drm_get_bridge_by_endpoint() increments the reference count of the
returned bridge, but there doesn't seem to be a corresponding drm_bridge_put()
on either the success or error paths to release it.

> +	if (ret) {
> +		dev_err_probe(dev, ret, "Failed to attach next bridge\n");
> +		goto unregister_aux;
> +	}
> +
>  	dw_dp_init_hw(dp);
>  

[Severity: High]
This is a pre-existing issue, but does registering the AUX channel early
expose uninitialized hardware to userspace?

Looking earlier in dw_dp_bind():

	ret = drm_dp_aux_register(&dp->aux);
	if (ret) {
		dev_err_probe(dev, ret, "Aux register failed\n");
		return ERR_PTR(ret);
	}

And then later:

	dw_dp_init_hw(dp);

	ret = phy_init(dp->phy);

If a userspace process opens the AUX character device and initiates a
transaction before dw_dp_init_hw() and the IRQ setup are called, the hardware
may enter an invalid state and miss completion interrupts.

>  	ret = phy_init(dp->phy);

[Severity: High]
This is a pre-existing issue, but can the lack of completion reinitialization
cause race conditions?

Looking at dw_dp_aux_transfer() in the same file:

	regmap_write(dp->regmap, DW_DP_AUX_CMD, value);

	status = wait_for_completion_timeout(&dp->complete, timeout);

If a previous AUX transfer timed out but the hardware eventually triggered a
late interrupt, the completion object will remain in a done state. The next
AUX transfer will see this stale state, causing wait_for_completion_timeout()
to return immediately before the new transfer has actually completed.

-- 
Sashiko AI review · https://sashiko.dev/#/patchset/20260612-synopsys-dw-dp-improvements-v3-0-dc61e6352508@collabora.com?part=3

  reply	other threads:[~2026-06-23 19:49 UTC|newest]

Thread overview: 18+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2026-06-12 18:00 [PATCH v3 00/10] Synopsys DisplayPort Controller improvements for Rockchip platforms Sebastian Reichel
2026-06-12 18:00 ` [PATCH v3 01/10] drm/bridge: synopsys: dw-dp: Simplify driver data setting Sebastian Reichel
2026-06-12 18:00 ` [PATCH v3 02/10] drm/bridge: synopsys: dw-dp: Support MEDIA_BUS_FMT_FIXED Sebastian Reichel
2026-06-12 18:00 ` [PATCH v3 03/10] drm/bridge: synopsys: dw-dp: Add follow-up bridge support Sebastian Reichel
2026-06-23 19:49   ` sashiko-bot [this message]
2026-06-12 18:00 ` [PATCH v3 04/10] drm/bridge: Add out-of-band HPD notify handler Sebastian Reichel
2026-06-12 18:00 ` [PATCH v3 05/10] drm/bridge: synopsys: dw-dp: Support software triggered OOB HPD Sebastian Reichel
2026-06-23 20:11   ` sashiko-bot
2026-06-12 18:00 ` [PATCH v3 06/10] drm/rockchip: dw_dp: Implement out-of-band HPD handling Sebastian Reichel
2026-06-23 20:20   ` sashiko-bot
2026-06-12 18:00 ` [PATCH v3 07/10] drm/bridge: synopsys: dw-dp: Add Runtime PM support Sebastian Reichel
2026-06-23 20:31   ` sashiko-bot
2026-06-12 18:00 ` [PATCH v3 08/10] drm/rockchip: dw_dp: Add runtime " Sebastian Reichel
2026-06-23 20:40   ` sashiko-bot
2026-06-12 18:00 ` [PATCH RFC v3 09/10] dt-bindings: display: rockchip: dw-dp: fix sound DAI cells Sebastian Reichel
2026-06-23 20:51   ` sashiko-bot
2026-06-12 18:00 ` [PATCH v3 10/10] drm/bridge: synopsys: dw-dp: Add audio support Sebastian Reichel
2026-06-23 21:00   ` sashiko-bot

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=20260623194922.4F4BD1F000E9@smtp.kernel.org \
    --to=sashiko-bot@kernel.org \
    --cc=conor+dt@kernel.org \
    --cc=devicetree@vger.kernel.org \
    --cc=dri-devel@lists.freedesktop.org \
    --cc=robh@kernel.org \
    --cc=sashiko-reviews@lists.linux.dev \
    --cc=sebastian.reichel@collabora.com \
    /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