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

Nilay Shroff nilay at linux.ibm.com
Wed Jun 10 21:39:23 PDT 2026


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



More information about the Linux-nvme mailing list