Linux Remote Processor Subsystem development
 help / color / mirror / Atom feed
* [PATCH RFT] hwspinlock: qcom: avoid uninitialized struct members
@ 2026-05-12  8:53 Wolfram Sang
  2026-05-12  9:12 ` Wolfram Sang
  0 siblings, 1 reply; 2+ messages in thread
From: Wolfram Sang @ 2026-05-12  8:53 UTC (permalink / raw)
  To: linux-remoteproc
  Cc: Wolfram Sang, Bjorn Andersson, Baolin Wang, Andy Gross,
	Ohad Ben-Cohen, Jeff Hugo, linux-arm-msm

The reg_field is allocated on stack, so using the REG_FIELD macro will
ensure that unused members do not have uninitialized values.

Fixes: 19a0f61224d2 ("hwspinlock: qcom: Add support for Qualcomm HW Mutex block")
Link: https://lore.kernel.org/r/https://sashiko.dev/#/patchset/20260319105947.6237-1-wsa%2Brenesas%40sang-engineering.com # review of patch 6
Signed-off-by: Wolfram Sang <wsa+renesas@sang-engineering.com>
---

Build tested only.

 drivers/hwspinlock/qcom_hwspinlock.c | 5 +----
 1 file changed, 1 insertion(+), 4 deletions(-)

diff --git a/drivers/hwspinlock/qcom_hwspinlock.c b/drivers/hwspinlock/qcom_hwspinlock.c
index 0390979fd765..712003a4640c 100644
--- a/drivers/hwspinlock/qcom_hwspinlock.c
+++ b/drivers/hwspinlock/qcom_hwspinlock.c
@@ -202,7 +202,6 @@ static struct regmap *qcom_hwspinlock_probe_mmio(struct platform_device *pdev,
 static int qcom_hwspinlock_probe(struct platform_device *pdev)
 {
 	struct hwspinlock_device *bank;
-	struct reg_field field;
 	struct regmap *regmap;
 	size_t array_size;
 	u32 stride;
@@ -224,9 +223,7 @@ static int qcom_hwspinlock_probe(struct platform_device *pdev)
 	platform_set_drvdata(pdev, bank);
 
 	for (i = 0; i < QCOM_MUTEX_NUM_LOCKS; i++) {
-		field.reg = base + i * stride;
-		field.lsb = 0;
-		field.msb = 31;
+		struct reg_field field = REG_FIELD(base + i * stride, 0, 31);
 
 		bank->lock[i].priv = devm_regmap_field_alloc(&pdev->dev,
 							     regmap, field);
-- 
2.47.3


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

* Re: [PATCH RFT] hwspinlock: qcom: avoid uninitialized struct members
  2026-05-12  8:53 [PATCH RFT] hwspinlock: qcom: avoid uninitialized struct members Wolfram Sang
@ 2026-05-12  9:12 ` Wolfram Sang
  0 siblings, 0 replies; 2+ messages in thread
From: Wolfram Sang @ 2026-05-12  9:12 UTC (permalink / raw)
  To: linux-remoteproc
  Cc: Bjorn Andersson, Baolin Wang, Andy Gross, Ohad Ben-Cohen,
	Jeff Hugo, linux-arm-msm

[-- Attachment #1: Type: text/plain, Size: 196 bytes --]


> Link: https://lore.kernel.org/r/https://sashiko.dev/#/patchset/20260319105947.6237-1-wsa%2Brenesas%40sang-engineering.com # review of patch 6

Bah, the tag is broken. I am sorry, will resend!


[-- Attachment #2: signature.asc --]
[-- Type: application/pgp-signature, Size: 833 bytes --]

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

end of thread, other threads:[~2026-05-12  9:12 UTC | newest]

Thread overview: 2+ messages (download: mbox.gz follow: Atom feed
-- links below jump to the message on this page --
2026-05-12  8:53 [PATCH RFT] hwspinlock: qcom: avoid uninitialized struct members Wolfram Sang
2026-05-12  9:12 ` Wolfram Sang

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