Linux Media Controller development
 help / color / mirror / Atom feed
From: sashiko-bot@kernel.org
To: "Hungyu Lin" <dennylin0707@gmail.com>
Cc: linux-media@vger.kernel.org
Subject: Re: [PATCH v5 1/2] media: qcom: iris: fix runtime PM reference leaks
Date: Mon, 08 Jun 2026 08:28:11 +0000	[thread overview]
Message-ID: <20260608082811.ED1481F00893@smtp.kernel.org> (raw)
In-Reply-To: <20260608081721.82846-2-dennylin0707@gmail.com>

Thank you for your contribution! Sashiko AI review found 1 potential issue(s) to consider:
- [Low] `iris_disable_power_domains()` incorrectly propagates `1` on success when the device is already suspended.
--

commit 7b8fb44887231870efc4a92ebbb558afa99135b1
Author: Hungyu Lin <dennylin0707@gmail.com>

media: qcom: iris: fix runtime PM reference leaks

This commit uses pm_runtime_resume_and_get() in iris_enable_power_domains()
to prevent reference leaks on failure. It also updates
iris_disable_power_domains() to always call pm_runtime_put_sync() and capture
its result.

> diff --git a/drivers/media/platform/qcom/iris/iris_resources.c b/drivers/media/platform/qcom/iris/iris_resources.c
> --- a/drivers/media/platform/qcom/iris/iris_resources.c
> +++ b/drivers/media/platform/qcom/iris/iris_resources.c

[ ... ]

>  int iris_disable_power_domains(struct iris_core *core, struct device *pd_dev)
>  {
>  	int ret;
> +	int pm_ret;
>  
>  	ret = iris_opp_set_rate(core->dev, 0);
> -	if (ret)
> -		return ret;
>  
> -	pm_runtime_put_sync(pd_dev);
> +	pm_ret = pm_runtime_put_sync(pd_dev);
> +	if (!ret)
> +		ret = pm_ret;
>  
> -	return 0;
> +	return ret;
>  }

[Severity: Low]
Is it intentional to propagate a positive return value here?

According to the runtime PM API, pm_runtime_put_sync() returns 1 as a success
case when the device usage count drops to zero but it is already in the
RPM_SUSPENDED state.

By capturing and returning this value directly from
iris_disable_power_domains(), the function will return 1 instead of 0 on a
successful suspend. While current callers may ignore the return value, future
callers checking if (ret) could incorrectly treat this normal success case as
a failure.

Would it be safer to normalize positive return values to 0?

-- 
Sashiko AI review · https://sashiko.dev/#/patchset/20260608081721.82846-1-dennylin0707@gmail.com?part=1

  reply	other threads:[~2026-06-08  8:28 UTC|newest]

Thread overview: 4+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2026-06-08  8:17 [PATCH v5 0/2] media: qcom: iris: fix runtime PM error handling Hungyu Lin
2026-06-08  8:17 ` [PATCH v5 1/2] media: qcom: iris: fix runtime PM reference leaks Hungyu Lin
2026-06-08  8:28   ` sashiko-bot [this message]
2026-06-08  8:17 ` [PATCH v5 2/2] media: qcom: iris: rollback OPP vote on PM resume failure Hungyu Lin

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=20260608082811.ED1481F00893@smtp.kernel.org \
    --to=sashiko-bot@kernel.org \
    --cc=dennylin0707@gmail.com \
    --cc=linux-media@vger.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