Re:[PATCH 2/2] media: amphion: handle debug runtime resume failure
From: jiale yao
Date: Mon Oct 19 2026 - 04:32:02 EST
At 2026-10-19 16:27:54, "Jiale Yao" <yaojiale02@xxxxxxx> wrote:
>The debugfs core write handler reads the VPU power state after
>pm_runtime_resume_and_get() fails. The device may be unavailable after
>a failed runtime resume, and the final runtime PM put does not match an
>acquired reference.
>
>Return the resume error before taking the core lock or accessing VPU
>hardware.
>
Fixes: f445014a2291 ("media: amphion: fix an issue that using pm_runtime_get_sync incorrectly")
>Signed-off-by: Jiale Yao <yaojiale02@xxxxxxx>
>---
> drivers/media/platform/amphion/vpu_dbg.c | 6 +++++-
> 1 file changed, 5 insertions(+), 1 deletion(-)
>
>diff --git a/drivers/media/platform/amphion/vpu_dbg.c b/drivers/media/platform/amphion/vpu_dbg.c
>index 497ae4e8a2..fff4df4f45 100644
>--- a/drivers/media/platform/amphion/vpu_dbg.c
>+++ b/drivers/media/platform/amphion/vpu_dbg.c
>@@ -382,8 +382,12 @@ static ssize_t vpu_dbg_core_write(struct file *file,
> {
> struct seq_file *s = file->private_data;
> struct vpu_core *core = s->private;
>+ int ret;
>+
>+ ret = pm_runtime_resume_and_get(core->dev);
>+ if (ret < 0)
>+ return ret;
>
>- pm_runtime_resume_and_get(core->dev);
> mutex_lock(&core->lock);
> if (vpu_iface_get_power_state(core) && !core->request_count) {
> dev_info(core->dev, "reset\n");
>--
>2.34.1