Re: [PATCH] media: mediatek: vcodec: Initialize context lock before firmware setup
From: Runyu Xiao
Date: Sun Oct 04 2026 - 08:39:48 EST
Hi Nicolas,
On Sun, 4 Oct 2026 07:17:43 -0400, Nicolas Dufresne wrote:
> The very first place the lock will be taken is in _open() and that cannot
> happen before video_register_device(), which is kept last. Please
> demonstrate what the issue you are suggesting if you'd like to see this
> merged.
The normal encoder open path is as you describe. On VPU-backed systems,
firmware setup registers the encoder reset callback before dev_ctx_lock is
initialized. A timeout on the shared VPU while another client is active
queues reset work, which invokes registered callbacks. If that work runs
before spin_lock_init(), the callback takes the uninitialized lock. The
context list is initialized but empty during probe, so I cannot claim list
corruption or a user-visible failure. With CONFIG_DEBUG_SPINLOCK, the
zeroed lock fails the magic check.
Thanks,
Runyu