From: sashiko-bot@kernel.org
To: "Luca Ceresoli" <luca.ceresoli@bootlin.com>
Cc: dri-devel@lists.freedesktop.org, Frank.Li@kernel.org,
wsa+renesas@sang-engineering.com, imx@lists.linux.dev
Subject: Re: [PATCH 6/7] drm/vc4: dsi: stop using deprecated drmm_of_get_bridge()
Date: Tue, 29 Sep 2026 11:21:09 +0000 [thread overview]
Message-ID: <20260929112109.BAAA51F000FF@smtp.kernel.org> (raw)
In-Reply-To: <20260929-drm-fix-of_get_bridge-build-regression-v1-6-ccb7e602daad@bootlin.com>
Thank you for your contribution! Sashiko AI review found 1 potential issue(s) to consider:
- [High] drm/vc4: dsi: bridge reference leak on bind failure/retry
--
commit d1b5b987d3dbb5f94782b8b596d7895539b38c8d
Author: Luca Ceresoli <luca.ceresoli@bootlin.com>
drm/vc4: dsi: stop using deprecated drmm_of_get_bridge()
This commit replaces the deprecated devm_drm_of_get_bridge() with
of_drm_get_bridge_by_endpoint(), storing the refcounted bridge in
dsi->bridge.next_bridge. It also removes an unused include.
> 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);
[Severity: High]
Does this leak the bridge reference if a subsequent initialization step fails?
If a later call in vc4_dsi_bind() fails or returns -EPROBE_DEFER, the function
exits without putting the newly acquired bridge reference. For example, further
down in vc4_dsi_bind():
ret = drm_bridge_attach(encoder, &dsi->bridge, NULL, 0);
if (ret)
return ret;
Because the component framework tears down the drm_device and its actions
on failure, the drmm cleanup runs vc4_dsi_release_action() which drops the
dsi->bridge refcount. However, because the refcount does not reach 0,
__drm_bridge_free() is not called and the next_bridge pointer is never put
or cleared.
When the bind is retried, of_drm_get_bridge_by_endpoint() is called again,
overwriting dsi->bridge.next_bridge and permanently leaking the previous
reference.
Is there a missing drm_bridge_put() or cleanup path to ensure the reference
is dropped when vc4_dsi_bind() fails?
--
Sashiko AI review · https://sashiko.dev/#/patchset/20260929-drm-fix-of_get_bridge-build-regression-v1-0-ccb7e602daad@bootlin.com?part=6
next prev parent reply other threads:[~2026-09-29 11:21 UTC|newest]
Thread overview: 23+ messages / expand[flat|nested] mbox.gz Atom feed top
2026-09-29 10:36 [PATCH 0/7] drm: remove deprecated *_of_get_bridge() from non-OF drivers (fixes build regression) Luca Ceresoli
2026-09-29 10:36 ` [PATCH 1/7] drm/imx/lcdc: stop using deprecated devm_drm_of_get_bridge() Luca Ceresoli
2026-09-29 12:33 ` Maxime Ripard
2026-09-29 10:36 ` [PATCH 2/7] drm: verisilicon: " Luca Ceresoli
2026-09-29 10:47 ` Icenowy Zheng
2026-09-29 10:51 ` sashiko-bot
2026-09-29 12:33 ` Maxime Ripard
2026-09-29 10:36 ` [PATCH 3/7] drm/bridge: dw-mipi-dsi: " Luca Ceresoli
2026-09-29 11:00 ` sashiko-bot
2026-09-29 12:33 ` Maxime Ripard
2026-09-29 10:36 ` [PATCH 4/7] drm/bridge: dw-mipi-dsi2: " Luca Ceresoli
2026-09-29 11:07 ` sashiko-bot
2026-09-29 12:34 ` Maxime Ripard
2026-09-29 10:36 ` [PATCH 5/7] drm/vc4: dpi: stop using deprecated drmm_of_get_bridge() Luca Ceresoli
2026-09-29 12:35 ` Maxime Ripard
2026-09-29 10:36 ` [PATCH 6/7] drm/vc4: dsi: " Luca Ceresoli
2026-09-29 11:21 ` sashiko-bot [this message]
2026-09-29 12:36 ` Maxime Ripard
2026-09-29 10:36 ` [PATCH 7/7] drm: renesas: shmobile: stop using deprecated devm_drm_of_get_bridge() Luca Ceresoli
2026-09-29 12:36 ` Maxime Ripard
2026-09-29 10:46 ` [PATCH 0/7] drm: remove deprecated *_of_get_bridge() from non-OF drivers (fixes build regression) Icenowy Zheng
2026-09-29 13:22 ` Luca Ceresoli
2026-09-29 13:18 ` 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=20260929112109.BAAA51F000FF@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