Re: [PATCH 2/3] firmware: qcom: uefisecapp: Annotate acquiring locks for sparse
From: Krzysztof Kozlowski
Date: Mon Feb 16 2026 - 03:14:25 EST
On 16/02/2026 09:00, Johan Hovold wrote:
> On Sun, Feb 15, 2026 at 12:05:50PM +0100, Krzysztof Kozlowski wrote:
>> qcuefi_acquire() and qcuefi_release() end with mutex locked or unlocked
>> respectively, so annotate them so the lock usage will be tracked by
>> sparse.
>>
>> Signed-off-by: Krzysztof Kozlowski <krzysztof.kozlowski@xxxxxxxxxxxxxxxx>
>> ---
>> drivers/firmware/qcom/qcom_qseecom_uefisecapp.c | 2 ++
>> 1 file changed, 2 insertions(+)
>>
>> diff --git a/drivers/firmware/qcom/qcom_qseecom_uefisecapp.c b/drivers/firmware/qcom/qcom_qseecom_uefisecapp.c
>> index 21be447374aa..befa68d1dcaf 100644
>> --- a/drivers/firmware/qcom/qcom_qseecom_uefisecapp.c
>> +++ b/drivers/firmware/qcom/qcom_qseecom_uefisecapp.c
>> @@ -710,6 +710,7 @@ static int qcuefi_set_reference(struct qcuefi_client *qcuefi)
>> }
>>
>> static struct qcuefi_client *qcuefi_acquire(void)
>> + __acquires(__qcuefi_lock)
>> {
>> mutex_lock(&__qcuefi_lock);
>> if (!__qcuefi) {
>> @@ -720,6 +721,7 @@ static struct qcuefi_client *qcuefi_acquire(void)
>> }
>>
>> static void qcuefi_release(void)
>> + __releases(__qcuefi_lock)
>> {
>> mutex_unlock(&__qcuefi_lock);
>> }
>
> The mutex implementation does not use sparse annotation so this actually
> introduces sparse warnings (unless something changed very recently).
>
> See
>
> https://lore.kernel.org/all/ZJ11H8btBhvCx9gD@xxxxxxxxxxxxxxxxxxxx/
>
> for what his looks like for the code in question.
>
I checked with sparse and there were no warnings. More importantly,
mutex uses __acquires, so this apparently changed:
https://web.git.kernel.org/pub/scm/linux/kernel/git/torvalds/linux.git/tree/include/linux/mutex.h#n214
Also clang v22 has context tracking, which I should probably mention as
well, and it supports mutex:
https://web.git.kernel.org/pub/scm/linux/kernel/git/torvalds/linux.git/tree/Documentation/dev-tools/context-analysis.rst
(this I could not test, too old LLVM, I need to set up containerized builds)
Best regards,
Krzysztof