Linux kernel and device drivers for NXP i.MX platforms
 help / color / mirror / Atom feed
From: sashiko-bot@kernel.org
To: "Luca Ceresoli" <luca.ceresoli@bootlin.com>
Cc: imx@lists.linux.dev, dri-devel@lists.freedesktop.org,
	Frank.Li@kernel.org, wsa+renesas@sang-engineering.com
Subject: Re: [PATCH v2 6/7] drm/vc4: dsi: stop using deprecated drmm_of_get_bridge()
Date: Tue, 29 Sep 2026 13:54:31 +0000	[thread overview]
Message-ID: <20260929135431.6B6B21F000FF@smtp.kernel.org> (raw)
In-Reply-To: <20260929-drm-fix-of_get_bridge-build-regression-v2-6-6da431d8f180@bootlin.com>

Thank you for your contribution! Sashiko AI review found 1 potential issue(s) to consider:
- [Medium] drm/vc4: bridge reference leak on component bind failure or rebind
--

commit 583ab26f73be63066db6ca20da5c1de3ee1767ef
Author: Luca Ceresoli <luca.ceresoli@bootlin.com>

drm/vc4: dsi: stop using deprecated drmm_of_get_bridge()

This commit replaces the deprecated drmm_of_get_bridge() with
of_drm_get_bridge_by_endpoint() to acquire the DRM bridge. It assigns the
returned refcounted bridge to dsi->bridge.next_bridge to rely on automatic
cleanup upon destruction.

> diff --git a/drivers/gpu/drm/vc4/vc4_dsi.c b/drivers/gpu/drm/vc4/vc4_dsi.c
> index 0148f2befed14..30598738cfcf3 100644
> --- a/drivers/gpu/drm/vc4/vc4_dsi.c
> +++ b/drivers/gpu/drm/vc4/vc4_dsi.c

[ ... ]

> @@ -1749,9 +1747,9 @@ static int vc4_dsi_bind(struct device *dev, struct device *master, void *data)
>  		return ret;
>  	}
>  
> -	dsi->out_bridge = drmm_of_get_bridge(drm, dev->of_node, 0, 0);
> -	if (IS_ERR(dsi->out_bridge))
> -		return PTR_ERR(dsi->out_bridge);
> +	dsi->bridge.next_bridge = of_drm_get_bridge_by_endpoint(dev->of_node, 0, 0);
> +	if (IS_ERR(dsi->bridge.next_bridge))
> +		return PTR_ERR(dsi->bridge.next_bridge);
>  
>  	/* The esc clock rate is supposed to always be 100Mhz. */
>  	ret = clk_set_rate(dsi->escape_clock, 100 * 1000000);

[Severity: Medium]
Does this code leak the bridge reference if vc4_dsi_bind() fails here or in
subsequent initialization steps?

Since of_drm_get_bridge_by_endpoint() returns a refcounted pointer (unlike
the previous devm-managed drmm_of_get_bridge()), if clk_set_rate() fails
just below this hunk, the function returns without putting the newly
acquired reference.

If the aggregate DRM device defers probe and retries binding components,
vc4_dsi_bind() could run again, overwriting dsi->bridge.next_bridge and
permanently leaking the previous reference. The automatic cleanup of
next_bridge only happens when dsi->bridge is destroyed, which does not
occur during component bind failures or component unbinds.

-- 
Sashiko AI review · https://sashiko.dev/#/patchset/20260929-drm-fix-of_get_bridge-build-regression-v2-0-6da431d8f180@bootlin.com?part=6

  reply	other threads:[~2026-09-29 13:54 UTC|newest]

Thread overview: 23+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2026-09-29 13:39 [PATCH v2 0/7] drm: remove deprecated *_of_get_bridge() from non-OF drivers (fixes build regression) Luca Ceresoli
2026-09-29 13:39 ` [PATCH v2 1/7] drm/imx/lcdc: stop using deprecated devm_drm_of_get_bridge() Luca Ceresoli
2026-10-01  8:02   ` Paul Cercueil
2026-09-29 13:39 ` [PATCH v2 2/7] drm: verisilicon: " Luca Ceresoli
2026-09-29 14:42   ` Icenowy Zheng
2026-09-29 21:26     ` Luca Ceresoli
2026-10-01  8:04   ` Paul Cercueil
2026-09-29 13:39 ` [PATCH v2 3/7] drm/bridge: dw-mipi-dsi: " Luca Ceresoli
2026-09-29 13:55   ` sashiko-bot
2026-09-30 19:35     ` Luca Ceresoli
2026-10-01  8:07   ` Paul Cercueil
2026-09-29 13:39 ` [PATCH v2 4/7] drm/bridge: dw-mipi-dsi2: " Luca Ceresoli
2026-10-01  8:10   ` Paul Cercueil
2026-09-29 13:39 ` [PATCH v2 5/7] drm/vc4: dpi: stop using deprecated drmm_of_get_bridge() Luca Ceresoli
2026-10-01  8:22   ` Paul Cercueil
2026-10-01  8:31     ` Luca Ceresoli
2026-09-29 13:39 ` [PATCH v2 6/7] drm/vc4: dsi: " Luca Ceresoli
2026-09-29 13:54   ` sashiko-bot [this message]
2026-10-01  8:56   ` Paul Cercueil
2026-10-01  9:02     ` Paul Cercueil
2026-09-29 13:39 ` [PATCH v2 7/7] drm: renesas: shmobile: stop using deprecated devm_drm_of_get_bridge() Luca Ceresoli
2026-10-01  9:00   ` Paul Cercueil
2026-10-01 15:49 ` [PATCH v2 0/7] drm: remove deprecated *_of_get_bridge() from non-OF drivers (fixes build regression) 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=20260929135431.6B6B21F000FF@smtp.kernel.org \
    --to=sashiko-bot@kernel.org \
    --cc=Frank.Li@kernel.org \
    --cc=dri-devel@lists.freedesktop.org \
    --cc=imx@lists.linux.dev \
    --cc=luca.ceresoli@bootlin.com \
    --cc=sashiko-reviews@lists.linux.dev \
    --cc=wsa+renesas@sang-engineering.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