dri-devel Archive on lore.kernel.org
 help / color / mirror / Atom feed
From: sashiko-bot@kernel.org
To: "Wentao Liang" <vulab@iscas.ac.cn>
Cc: dri-devel@lists.freedesktop.org
Subject: Re: [PATCH] drm/bridge: cdns-dsi: Fix runtime PM leak in cdns_dsi_bridge_atomic_pre_enable()
Date: Wed, 16 Sep 2026 10:13:05 +0000	[thread overview]
Message-ID: <20260916101305.90A1C1F000FF@smtp.kernel.org> (raw)
In-Reply-To: <20260916100405.2012604-1-vulab@iscas.ac.cn>

Thank you for your contribution! Sashiko AI review found 1 potential issue(s) to consider:
- [Medium] drm/cdns-dsi: double pm_runtime_put() causes usage counter underflow
--

commit 863c1242b6ff6841137bcc0956d0095317384036
Author: Wentao Liang <vulab@iscas.ac.cn>

drm/bridge: cdns-dsi: Fix runtime PM leak in cdns_dsi_bridge_atomic_pre_enable()

This commit attempts to fix a runtime PM leak when pm_runtime_get_sync() fails
by adding a call to pm_runtime_put_noidle(). The function then returns early.

> diff --git a/drivers/gpu/drm/bridge/cadence/cdns-dsi-core.c b/drivers/gpu/drm/bridge/cadence/cdns-dsi-core.c
> index c3e466ded84ab..dcf7d3e409815 100644
> --- a/drivers/gpu/drm/bridge/cadence/cdns-dsi-core.c
> +++ b/drivers/gpu/drm/bridge/cadence/cdns-dsi-core.c
> @@ -733,8 +733,10 @@ static void cdns_dsi_bridge_atomic_pre_enable(struct drm_bridge *bridge,
>  	 * enable their streams.
>  	 */
>  
> -	if (WARN_ON(pm_runtime_get_sync(dsi->base.dev) < 0))
> +	if (WARN_ON(pm_runtime_get_sync(dsi->base.dev) < 0)) {
> +		pm_runtime_put_noidle(dsi->base.dev);

[Severity: Medium]
Will this lead to a double-put of the runtime PM reference?

Since cdns_dsi_bridge_atomic_pre_enable() returns void, the DRM core is
unaware that the bridge failed to enable. The atomic commit continues normally,
and when the bridge is later disabled, cdns_dsi_bridge_atomic_post_disable()
is called unconditionally.

If we look at cdns_dsi_bridge_atomic_post_disable(), it executes a second put
during teardown:

static void cdns_dsi_bridge_atomic_post_disable(...)
{
	...
	pm_runtime_put(dsi->base.dev);
}

Wouldn't this decrement the usage count again and cause a runtime PM usage
counter underflow?

>  		return;
> +	}
>  
>  	new_bridge_state = drm_atomic_get_new_bridge_state(state, bridge);
>  	if (WARN_ON(!new_bridge_state))

-- 
Sashiko AI review · https://sashiko.dev/#/patchset/20260916100405.2012604-1-vulab@iscas.ac.cn?part=1

  reply	other threads:[~2026-09-16 10:13 UTC|newest]

Thread overview: 3+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2026-09-16 10:04 [PATCH] drm/bridge: cdns-dsi: Fix runtime PM leak in cdns_dsi_bridge_atomic_pre_enable() Wentao Liang
2026-09-16 10:13 ` sashiko-bot [this message]
2026-09-16 14:54 ` Laurent Pinchart

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=20260916101305.90A1C1F000FF@smtp.kernel.org \
    --to=sashiko-bot@kernel.org \
    --cc=dri-devel@lists.freedesktop.org \
    --cc=sashiko-reviews@lists.linux.dev \
    --cc=vulab@iscas.ac.cn \
    /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