Devicetree
 help / color / mirror / Atom feed
From: sashiko-bot@kernel.org
To: "Damon Ding" <damon.ding@rock-chips.com>
Cc: robh@kernel.org, devicetree@vger.kernel.org, conor+dt@kernel.org,
	dri-devel@lists.freedesktop.org
Subject: Re: [PATCH v8 4/5] drm/bridge: analogix_dp: Add validation for samsung,lane-count property
Date: Fri, 28 Aug 2026 07:02:19 +0000	[thread overview]
Message-ID: <20260828070219.AAB0A1F00A3D@smtp.kernel.org> (raw)
In-Reply-To: <20260828065153.590802-5-damon.ding@rock-chips.com>

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

Pre-existing issues:
- [High] devm_drm_bridge_add() is used inside a component bind callback, causing devres leakage and double-add on re-bind.
- [High] Missing analogix_dp_unbind() and encoder cleanup in component bind error paths.
--

commit 3586f9db6c3c7447ea980ac18be62fa966e709ae
Author: Damon Ding <damon.ding@rock-chips.com>

drm/bridge: analogix_dp: Add validation for samsung,lane-count property

Add validity check for samsung,lane-count to ensure DT-provided
lane count values are specification-compliant.

> diff --git a/drivers/gpu/drm/bridge/analogix/analogix_dp_core.c b/drivers/gpu/drm/bridge/analogix/analogix_dp_core.c
> index 4213cd68d5a0d..ba12fde8accde 100644
> --- a/drivers/gpu/drm/bridge/analogix/analogix_dp_core.c
> +++ b/drivers/gpu/drm/bridge/analogix/analogix_dp_core.c

[ ... ]

This isn't a bug introduced by this patch, but I noticed an issue in the
analogix_dp_bind() component bind flow:

drivers/gpu/drm/bridge/analogix/analogix_dp_core.c:analogix_dp_bind() {
	...
	bridge->type = DRM_MODE_CONNECTOR_eDP;
	ret = devm_drm_bridge_add(dp->dev, &dp->bridge);
	if (ret)
		goto err_unregister_aux;
	...
}

[Severity: High]
Since devm_drm_bridge_add() is called in a component bind function, does it
tie the bridge registration lifetime to the platform device rather than the
component? 

If the master DRM device defers, unbinds, and later rebinds,
analogix_dp_bind() executes again. Because the devres actions are not
cleaned up during component unbind, would this trigger duplicate devres
additions, list corruption via double list_add_tail() in drm_bridge_add(),
and double initialization of the bridge's hpd_mutex?

This is also a pre-existing issue, but I noticed the error paths in the
component bind functions seem to be missing cleanup steps:

drivers/gpu/drm/rockchip/analogix_dp-rockchip.c:rockchip_dp_bind() {
	...
	connector = drm_bridge_connector_init(dp->drm_dev,
					      dp->plat_data.encoder);
	if (IS_ERR(connector)) {
		ret = PTR_ERR(connector);
		dev_err(dp->dev, "Failed to initialize bridge_connector\n");
		goto err_cleanup_encoder;
	}

	return 0;
err_cleanup_encoder:
	dp->encoder.encoder.funcs->destroy(&dp->encoder.encoder);
	return ret;
}

[Severity: High]
If drm_bridge_connector_init() fails, does this error path skip calling
analogix_dp_unbind()? 

This would leave the DP AUX device registered. If component binding is
retried, would drm_dp_aux_register() be called again on the same device,
causing a sysfs duplicate name error and preventing the display from ever
initializing?

A similar issue appears in exynos_dp.c:

drivers/gpu/drm/exynos/exynos_dp.c:exynos_dp_bind() {
	...
	connector = drm_bridge_connector_init(dp->drm_dev,
					      dp->plat_data.encoder);
	if (IS_ERR(connector)) {
		ret = PTR_ERR(connector);
		dev_err(dp->dev, "Failed to initialize bridge_connector\n");
		return ret;
	}

	return 0;
}

[Severity: High]
If drm_bridge_connector_init() fails here, does the error path miss cleaning
up the resources by skipping both analogix_dp_unbind() and the encoder
destruction?

-- 
Sashiko AI review · https://sashiko.dev/#/patchset/20260828065153.590802-1-damon.ding@rock-chips.com?part=4

  reply	other threads:[~2026-08-28  7:02 UTC|newest]

Thread overview: 8+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2026-08-28  6:51 [PATCH v8 0/5] Add eDP lane mapping support Damon Ding
2026-08-28  6:51 ` [PATCH v8 1/5] dt-bindings: display: bridge: analogix-dp: Add data-lanes support for endpoint Damon Ding
2026-08-28  6:51 ` [PATCH v8 2/5] drm/dp: Add helper to validate DP lane counts Damon Ding
2026-08-28  6:51 ` [PATCH v8 3/5] drm/bridge: analogix_dp: Restore mandatory samsung DP DT properties Damon Ding
2026-08-28  6:51 ` [PATCH v8 4/5] drm/bridge: analogix_dp: Add validation for samsung,lane-count property Damon Ding
2026-08-28  7:02   ` sashiko-bot [this message]
2026-08-28  6:51 ` [PATCH v8 5/5] drm/bridge: analogix_dp: Add support for optional data-lanes mapping Damon Ding
2026-08-28  7:02   ` 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=20260828070219.AAB0A1F00A3D@smtp.kernel.org \
    --to=sashiko-bot@kernel.org \
    --cc=conor+dt@kernel.org \
    --cc=damon.ding@rock-chips.com \
    --cc=devicetree@vger.kernel.org \
    --cc=dri-devel@lists.freedesktop.org \
    --cc=robh@kernel.org \
    --cc=sashiko-reviews@lists.linux.dev \
    /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