Symptom:
  ------------[ cut here ]------------
  WARNING: CPU: 1 PID: 963 at kernel/kthread.c:1430 
kthread_destroy_worker+0x84/0x98
  ...
  vdec 30210000.video-codec: Runtime PM usage count underflow!

Root cause:
  The driver calls pm_runtime_put_sync() unconditionally in remove, but
  the device may already be suspended due to autosuspend (5 second delay
  configured in probe). When autosuspend has already suspended the device,
  the usage count is 0, and pm_runtime_put_sync() decrements it to -1,
  causing the underflow warning.

Fix:
  Replace pm_runtime_put_sync() with pm_runtime_dont_use_autosuspend()
  which properly pairs with pm_runtime_use_autosuspend() from probe.
  This allows pm_runtime_disable() to handle reference count cleanup
  correctly regardless of current suspend state. The disable function
  internally handles the usage count properly without causing underflow.

Signed-off-by: Xulin Sun <[email protected]>
---
 drivers/media/platform/chips-media/wave5/wave5-vpu.c | 2 +-
 1 file changed, 1 insertion(+), 1 deletion(-)

diff --git a/drivers/media/platform/chips-media/wave5/wave5-vpu.c 
b/drivers/media/platform/chips-media/wave5/wave5-vpu.c
index efec4ed97c83..61f0b5468ac3 100644
--- a/drivers/media/platform/chips-media/wave5/wave5-vpu.c
+++ b/drivers/media/platform/chips-media/wave5/wave5-vpu.c
@@ -360,7 +360,7 @@ static void wave5_vpu_remove(struct platform_device *pdev)
                hrtimer_cancel(&dev->hrtimer);
        }
 
-       pm_runtime_put_sync(&pdev->dev);
+       pm_runtime_dont_use_autosuspend(&pdev->dev);
        pm_runtime_disable(&pdev->dev);
 
        mutex_destroy(&dev->dev_lock);
-- 
2.49.1

-=-=-=-=-=-=-=-=-=-=-=-
Links: You receive all messages sent to this group.
View/Reply Online (#16019): 
https://lists.yoctoproject.org/g/linux-yocto/message/16019
Mute This Topic: https://lists.yoctoproject.org/mt/116495599/21656
Group Owner: [email protected]
Unsubscribe: https://lists.yoctoproject.org/g/linux-yocto/unsub 
[[email protected]]
-=-=-=-=-=-=-=-=-=-=-=-

Reply via email to