mirror of https://lore.kernel.org/lkml/
 help / color / mirror / Atom feed
From: "Ming Qian(OSS)" <ming.qian@oss.nxp.com>
To: Jiale Yao <yaojiale02@163.com>, Ming Qian <ming.qian@nxp.com>,
	Zhou Peng <eagle.zhou@nxp.com>,
	Mauro Carvalho Chehab <mchehab@kernel.org>,
	linux-media@vger.kernel.org, linux-kernel@vger.kernel.org
Subject: Re: [PATCH 1/2] media: amphion: handle core runtime resume failures
Date: Mon, 19 Oct 2026 17:54:41 +0800	[thread overview]
Message-ID: <7b3e3de6-ed2c-417d-b26e-efc582be0ddf@oss.nxp.com> (raw)
In-Reply-To: <20261019082754.1806443-2-yaojiale02@163.com>



On 10/19/2026 4:27 PM, Jiale Yao wrote:
> The core request and resume paths continue with VPU state and hardware
> access after pm_runtime_resume_and_get() fails. A failed runtime resume
> leaves the device unavailable, so those accesses can fail and the later
> runtime PM put does not match an acquired reference.
> 
> Check the runtime resume result before accessing the VPU. Release the
> core lock and return without touching the hardware when resume fails.
> 
> Signed-off-by: Jiale Yao <yaojiale02@163.com>

Reviewed-by: Ming Qian <ming.qian@oss.nxp.com>

> ---
>   drivers/media/platform/amphion/vpu_core.c | 13 +++++++++++--
>   1 file changed, 11 insertions(+), 2 deletions(-)
> 
> diff --git a/drivers/media/platform/amphion/vpu_core.c b/drivers/media/platform/amphion/vpu_core.c
> index ad54f014d8..3d71442807 100644
> --- a/drivers/media/platform/amphion/vpu_core.c
> +++ b/drivers/media/platform/amphion/vpu_core.c
> @@ -372,7 +372,12 @@ struct vpu_core *vpu_request_core(struct vpu_dev *vpu, enum vpu_core_type type)
>   		goto exit;
>   
>   	mutex_lock(&core->lock);
> -	pm_runtime_resume_and_get(core->dev);
> +	ret = pm_runtime_resume_and_get(core->dev);
> +	if (ret < 0) {
> +		mutex_unlock(&core->lock);
> +		core = NULL;
> +		goto exit;
> +	}
>   
>   	if (core->state == VPU_CORE_DEINIT) {
>   		if (vpu_iface_get_power_state(core))
> @@ -760,7 +765,11 @@ static int __maybe_unused vpu_core_resume(struct device *dev)
>   	int ret = 0;
>   
>   	mutex_lock(&core->lock);
> -	pm_runtime_resume_and_get(dev);
> +	ret = pm_runtime_resume_and_get(dev);
> +	if (ret < 0) {
> +		mutex_unlock(&core->lock);
> +		return ret;
> +	}
>   	vpu_core_get_vpu(core);
>   
>   	if (core->request_count) {


  parent reply	other threads:[~2026-10-19  9:54 UTC|newest]

Thread overview: 7+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2026-10-19  8:27 [PATCH 0/2] media: amphion: handle " Jiale Yao
2026-10-19  8:27 ` [PATCH 1/2] media: amphion: handle core " Jiale Yao
2026-10-19  8:31   ` jiale yao
2026-10-19  9:54   ` Ming Qian(OSS) [this message]
2026-10-19  8:27 ` [PATCH 2/2] media: amphion: handle debug runtime resume failure Jiale Yao
2026-10-19  8:31   ` jiale yao
2026-10-19  9:58   ` [PATCH " Ming Qian(OSS)

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=7b3e3de6-ed2c-417d-b26e-efc582be0ddf@oss.nxp.com \
    --to=ming.qian@oss.nxp.com \
    --cc=eagle.zhou@nxp.com \
    --cc=linux-kernel@vger.kernel.org \
    --cc=linux-media@vger.kernel.org \
    --cc=mchehab@kernel.org \
    --cc=ming.qian@nxp.com \
    --cc=yaojiale02@163.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

all inboxes | Powered by JetHome®