Re: [PATCH 09/15] nvme: add Clang context annotations for nvme_subsystems_lock

From: Nilay Shroff

Date: Thu Jun 11 2026 - 00:43:04 EST


On 6/10/26 10:00 PM, Bart Van Assche wrote:
On 6/10/26 7:27 AM, Nilay Shroff wrote:
-    INIT_LIST_HEAD(&subsys->ctrls);
+    /*
+     * Initializing subsys->ctrls list doesn't need to be protected
+     * using @nvme_subsystems_lock. So suppress the Clang's warning
+     * declaring context_unsafe.
+     */
+    context_unsafe(INIT_LIST_HEAD(&subsys->ctrls));

Why context_unsafe() instead of scoped_guard(mutex_init, ...)?

Well, in this case the subsys->ctrls is protected using a mutex
which is defined statically: DEFINE_MUTEX(nvme_subsystems_lock).
So to suppress the compiler warning, used context_unsafe.

Thanks,
--Nilay