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: Frank.Li@kernel.org, imx@lists.linux.dev,
	dri-devel@lists.freedesktop.org,
	wsa+renesas@sang-engineering.com
Subject: Re: [PATCH 2/7] drm: verisilicon: stop using deprecated devm_drm_of_get_bridge()
Date: Tue, 29 Sep 2026 10:51:24 +0000	[thread overview]
Message-ID: <20260929105124.E59021F000FF@smtp.kernel.org> (raw)
In-Reply-To: <20260929-drm-fix-of_get_bridge-build-regression-v1-2-ccb7e602daad@bootlin.com>

Thank you for your contribution! Sashiko AI review found 1 potential issue(s) to consider:
- [Medium] drm/verisilicon: reference leak of next bridge when devm_drm_bridge_alloc fails
--

commit 49db4512b47fdbbe2150c6b5f4f559940d0929cd
Author: Luca Ceresoli <luca.ceresoli@bootlin.com>

drm: verisilicon: stop using deprecated devm_drm_of_get_bridge()

devm_drm_of_get_bridge() is deprecated, switch to
of_drm_get_bridge_by_endpoint(). As of_drm_get_bridge_by_endpoint() returns
a refcounted bridge, ensure it is put by using bridge.next_bridge.

Link: https://lore.kernel.org/r/20260928161605.2271412-1-arnd@kernel.org

> diff --git a/drivers/gpu/drm/verisilicon/vs_bridge.c b/drivers/gpu/drm/verisilicon/vs_bridge.c
> index dc7c85b07fe32..f1e8112f0ed25 100644
> --- a/drivers/gpu/drm/verisilicon/vs_bridge.c
> +++ b/drivers/gpu/drm/verisilicon/vs_bridge.c
[ ... ]
> @@ -303,8 +303,7 @@ struct vs_bridge *vs_bridge_init(struct drm_device *drm_dev,
>  		return NULL;
>  	}
>  
> -	next = devm_drm_of_get_bridge(drm_dev->dev, drm_dev->dev->of_node,
> -				      output, intf);
> +	next = of_drm_get_bridge_by_endpoint(drm_dev->dev->of_node, output, intf);
>  	if (IS_ERR(next)) {
>  		ret = PTR_ERR(next);
>  		if (ret != -EPROBE_DEFER)

[Severity: Medium]
Will this leak the refcounted bridge next on error paths?

Since of_drm_get_bridge_by_endpoint() returns a refcounted bridge, it
appears a reference leak will happen in vs_bridge_init() if the subsequent
allocation fails:

	bridge = devm_drm_bridge_alloc(drm_dev->dev, struct vs_bridge, base,
				       bridge_funcs);
	if (IS_ERR(bridge))
		return ERR_PTR(PTR_ERR(bridge));

Does this error path need a call to drm_bridge_put(next) to properly release
the reference before returning?

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

  parent reply	other threads:[~2026-09-29 10:51 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 [this message]
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
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=20260929105124.E59021F000FF@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