mirror of https://lore.kernel.org/lkml/
 help / color / mirror / Atom feed
* [PATCH v2 1/3] firmware: qcom: uefisecapp: Simplify mutex with guard
@ 2026-02-16  9:15 Krzysztof Kozlowski
  2026-02-16  9:15 ` [PATCH v2 2/3] firmware: qcom: uefisecapp: Annotate acquiring locks for context tracking Krzysztof Kozlowski
                   ` (3 more replies)
  0 siblings, 4 replies; 7+ messages in thread
From: Krzysztof Kozlowski @ 2026-02-16  9:15 UTC (permalink / raw)
  To: Maximilian Luz, Bjorn Andersson, Konrad Dybcio,
	Nathan Chancellor, Nick Desaulniers, Bill Wendling, Justin Stitt,
	linux-arm-msm, linux-kernel, llvm
  Cc: Krzysztof Kozlowski

Simplify error path unlocking mutex with the guard.

Signed-off-by: Krzysztof Kozlowski <krzysztof.kozlowski@oss.qualcomm.com>

---

Changes in v2:
None
---
 drivers/firmware/qcom/qcom_qseecom_uefisecapp.c | 7 ++-----
 1 file changed, 2 insertions(+), 5 deletions(-)

diff --git a/drivers/firmware/qcom/qcom_qseecom_uefisecapp.c b/drivers/firmware/qcom/qcom_qseecom_uefisecapp.c
index 98a463e9774b..21be447374aa 100644
--- a/drivers/firmware/qcom/qcom_qseecom_uefisecapp.c
+++ b/drivers/firmware/qcom/qcom_qseecom_uefisecapp.c
@@ -699,16 +699,13 @@ static DEFINE_MUTEX(__qcuefi_lock);
 
 static int qcuefi_set_reference(struct qcuefi_client *qcuefi)
 {
-	mutex_lock(&__qcuefi_lock);
+	guard(mutex)(&__qcuefi_lock);
 
-	if (qcuefi && __qcuefi) {
-		mutex_unlock(&__qcuefi_lock);
+	if (qcuefi && __qcuefi)
 		return -EEXIST;
-	}
 
 	__qcuefi = qcuefi;
 
-	mutex_unlock(&__qcuefi_lock);
 	return 0;
 }
 
-- 
2.51.0


^ permalink raw reply	[flat|nested] 7+ messages in thread

* [PATCH v2 2/3] firmware: qcom: uefisecapp: Annotate acquiring locks for context tracking
  2026-02-16  9:15 [PATCH v2 1/3] firmware: qcom: uefisecapp: Simplify mutex with guard Krzysztof Kozlowski
@ 2026-02-16  9:15 ` Krzysztof Kozlowski
  2026-02-16 11:11   ` Konrad Dybcio
  2026-02-16  9:15 ` [PATCH v2 3/3] firmware: qcom: scom: Simplify mutex with guard Krzysztof Kozlowski
                   ` (2 subsequent siblings)
  3 siblings, 1 reply; 7+ messages in thread
From: Krzysztof Kozlowski @ 2026-02-16  9:15 UTC (permalink / raw)
  To: Maximilian Luz, Bjorn Andersson, Konrad Dybcio,
	Nathan Chancellor, Nick Desaulniers, Bill Wendling, Justin Stitt,
	linux-arm-msm, linux-kernel, llvm
  Cc: Krzysztof Kozlowski

qcuefi_acquire() and qcuefi_release() end with mutex locked or unlocked
respectively, so annotate them so the lock usage will be tracked by
context tracking tools.

Note that mutex is tracked since commit 370f0a345a70 ("locking/mutex:
Support Clang's context analysis").

Signed-off-by: Krzysztof Kozlowski <krzysztof.kozlowski@oss.qualcomm.com>

---

Changes in v2:
Rephrase commit msg from sparse to context tracking.
---
 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);
 }
-- 
2.51.0


^ permalink raw reply	[flat|nested] 7+ messages in thread

* [PATCH v2 3/3] firmware: qcom: scom: Simplify mutex with guard
  2026-02-16  9:15 [PATCH v2 1/3] firmware: qcom: uefisecapp: Simplify mutex with guard Krzysztof Kozlowski
  2026-02-16  9:15 ` [PATCH v2 2/3] firmware: qcom: uefisecapp: Annotate acquiring locks for context tracking Krzysztof Kozlowski
@ 2026-02-16  9:15 ` Krzysztof Kozlowski
  2026-02-16 11:11   ` Konrad Dybcio
  2026-02-16 11:10 ` [PATCH v2 1/3] firmware: qcom: uefisecapp: " Konrad Dybcio
  2026-03-18 13:50 ` (subset) " Bjorn Andersson
  3 siblings, 1 reply; 7+ messages in thread
From: Krzysztof Kozlowski @ 2026-02-16  9:15 UTC (permalink / raw)
  To: Maximilian Luz, Bjorn Andersson, Konrad Dybcio,
	Nathan Chancellor, Nick Desaulniers, Bill Wendling, Justin Stitt,
	linux-arm-msm, linux-kernel, llvm
  Cc: Krzysztof Kozlowski

Simplify error path unlocking mutex with the guard.

Signed-off-by: Krzysztof Kozlowski <krzysztof.kozlowski@oss.qualcomm.com>

---

Changes in v2:
None
---
 drivers/firmware/qcom/qcom_scm.c | 9 ++++-----
 1 file changed, 4 insertions(+), 5 deletions(-)

diff --git a/drivers/firmware/qcom/qcom_scm.c b/drivers/firmware/qcom/qcom_scm.c
index 8fbc96693a55..f1947025d8b5 100644
--- a/drivers/firmware/qcom/qcom_scm.c
+++ b/drivers/firmware/qcom/qcom_scm.c
@@ -199,19 +199,18 @@ static int qcom_scm_bw_enable(void)
 	if (!__scm->path)
 		return 0;
 
-	mutex_lock(&__scm->scm_bw_lock);
+	guard(mutex)(&__scm->scm_bw_lock);
+
 	if (!__scm->scm_vote_count) {
 		ret = icc_set_bw(__scm->path, 0, UINT_MAX);
 		if (ret < 0) {
 			dev_err(__scm->dev, "failed to set bandwidth request\n");
-			goto err_bw;
+			return ret;
 		}
 	}
 	__scm->scm_vote_count++;
-err_bw:
-	mutex_unlock(&__scm->scm_bw_lock);
 
-	return ret;
+	return 0;
 }
 
 static void qcom_scm_bw_disable(void)
-- 
2.51.0


^ permalink raw reply	[flat|nested] 7+ messages in thread

* Re: [PATCH v2 1/3] firmware: qcom: uefisecapp: Simplify mutex with guard
  2026-02-16  9:15 [PATCH v2 1/3] firmware: qcom: uefisecapp: Simplify mutex with guard Krzysztof Kozlowski
  2026-02-16  9:15 ` [PATCH v2 2/3] firmware: qcom: uefisecapp: Annotate acquiring locks for context tracking Krzysztof Kozlowski
  2026-02-16  9:15 ` [PATCH v2 3/3] firmware: qcom: scom: Simplify mutex with guard Krzysztof Kozlowski
@ 2026-02-16 11:10 ` Konrad Dybcio
  2026-03-18 13:50 ` (subset) " Bjorn Andersson
  3 siblings, 0 replies; 7+ messages in thread
From: Konrad Dybcio @ 2026-02-16 11:10 UTC (permalink / raw)
  To: Krzysztof Kozlowski, Maximilian Luz, Bjorn Andersson,
	Konrad Dybcio, Nathan Chancellor, Nick Desaulniers,
	Bill Wendling, Justin Stitt, linux-arm-msm, linux-kernel, llvm

On 2/16/26 10:15 AM, Krzysztof Kozlowski wrote:
> Simplify error path unlocking mutex with the guard.
> 
> Signed-off-by: Krzysztof Kozlowski <krzysztof.kozlowski@oss.qualcomm.com>
> 
> ---
> 
> Changes in v2:
> None
> ---

Reviewed-by: Konrad Dybcio <konrad.dybcio@oss.qualcomm.com>

Konrad

^ permalink raw reply	[flat|nested] 7+ messages in thread

* Re: [PATCH v2 2/3] firmware: qcom: uefisecapp: Annotate acquiring locks for context tracking
  2026-02-16  9:15 ` [PATCH v2 2/3] firmware: qcom: uefisecapp: Annotate acquiring locks for context tracking Krzysztof Kozlowski
@ 2026-02-16 11:11   ` Konrad Dybcio
  0 siblings, 0 replies; 7+ messages in thread
From: Konrad Dybcio @ 2026-02-16 11:11 UTC (permalink / raw)
  To: Krzysztof Kozlowski, Maximilian Luz, Bjorn Andersson,
	Konrad Dybcio, Nathan Chancellor, Nick Desaulniers,
	Bill Wendling, Justin Stitt, linux-arm-msm, linux-kernel, llvm

On 2/16/26 10:15 AM, 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
> context tracking tools.
> 
> Note that mutex is tracked since commit 370f0a345a70 ("locking/mutex:
> Support Clang's context analysis").
> 
> Signed-off-by: Krzysztof Kozlowski <krzysztof.kozlowski@oss.qualcomm.com>
> 
> ---

Reviewed-by: Konrad Dybcio <konrad.dybcio@oss.qualcomm.com>

Konrad

^ permalink raw reply	[flat|nested] 7+ messages in thread

* Re: [PATCH v2 3/3] firmware: qcom: scom: Simplify mutex with guard
  2026-02-16  9:15 ` [PATCH v2 3/3] firmware: qcom: scom: Simplify mutex with guard Krzysztof Kozlowski
@ 2026-02-16 11:11   ` Konrad Dybcio
  0 siblings, 0 replies; 7+ messages in thread
From: Konrad Dybcio @ 2026-02-16 11:11 UTC (permalink / raw)
  To: Krzysztof Kozlowski, Maximilian Luz, Bjorn Andersson,
	Konrad Dybcio, Nathan Chancellor, Nick Desaulniers,
	Bill Wendling, Justin Stitt, linux-arm-msm, linux-kernel, llvm

On 2/16/26 10:15 AM, Krzysztof Kozlowski wrote:
> Simplify error path unlocking mutex with the guard.
> 
> Signed-off-by: Krzysztof Kozlowski <krzysztof.kozlowski@oss.qualcomm.com>
> 
> ---

Reviewed-by: Konrad Dybcio <konrad.dybcio@oss.qualcomm.com>

Konrad

^ permalink raw reply	[flat|nested] 7+ messages in thread

* Re: (subset) [PATCH v2 1/3] firmware: qcom: uefisecapp: Simplify mutex with guard
  2026-02-16  9:15 [PATCH v2 1/3] firmware: qcom: uefisecapp: Simplify mutex with guard Krzysztof Kozlowski
                   ` (2 preceding siblings ...)
  2026-02-16 11:10 ` [PATCH v2 1/3] firmware: qcom: uefisecapp: " Konrad Dybcio
@ 2026-03-18 13:50 ` Bjorn Andersson
  3 siblings, 0 replies; 7+ messages in thread
From: Bjorn Andersson @ 2026-03-18 13:50 UTC (permalink / raw)
  To: Maximilian Luz, Konrad Dybcio, Nathan Chancellor,
	Nick Desaulniers, Bill Wendling, Justin Stitt, linux-arm-msm,
	linux-kernel, llvm, Krzysztof Kozlowski


On Mon, 16 Feb 2026 10:15:26 +0100, Krzysztof Kozlowski wrote:
> Simplify error path unlocking mutex with the guard.
> 
> 

Applied, thanks!

[1/3] firmware: qcom: uefisecapp: Simplify mutex with guard
      commit: 055d79affa436d83a6e0d3ca6d054f11a7e3d4c1
[2/3] firmware: qcom: uefisecapp: Annotate acquiring locks for context tracking
      commit: 4bfb0ec11e20b9354beabf1b9f3e70e926c407bd
[3/3] firmware: qcom: scom: Simplify mutex with guard
      commit: d98b978446d249df1a662b4fef4c0bbfa1d650b8

Best regards,
-- 
Bjorn Andersson <andersson@kernel.org>

^ permalink raw reply	[flat|nested] 7+ messages in thread

end of thread, other threads:[~2026-03-18 13:50 UTC | newest]

Thread overview: 7+ messages (download: mbox.gz / follow: Atom feed)
-- links below jump to the message on this page --
2026-02-16  9:15 [PATCH v2 1/3] firmware: qcom: uefisecapp: Simplify mutex with guard Krzysztof Kozlowski
2026-02-16  9:15 ` [PATCH v2 2/3] firmware: qcom: uefisecapp: Annotate acquiring locks for context tracking Krzysztof Kozlowski
2026-02-16 11:11   ` Konrad Dybcio
2026-02-16  9:15 ` [PATCH v2 3/3] firmware: qcom: scom: Simplify mutex with guard Krzysztof Kozlowski
2026-02-16 11:11   ` Konrad Dybcio
2026-02-16 11:10 ` [PATCH v2 1/3] firmware: qcom: uefisecapp: " Konrad Dybcio
2026-03-18 13:50 ` (subset) " Bjorn Andersson

This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox

all inboxes | Powered by JetHome®