Skip to contentSkip to conversation

dmaengine: owl: fix register access functions

PATCH Applied Arnd Bergmann 4 participants 4 messages Mar 22, 2024 – Mar 28, 2024

Subsystems (2)
lore
Share & tools
lore
#0 lore raw

PATCH 1/1 dmaengine: owl: fix register access functions

From: Arnd Bergmann <[email protected]>

When building with 'make W=1', clang notices that the computed register values are never actually written back but instead the wrong variable is set:

drivers/dma/owl-dma.c:244:6: error: variable 'regval' set but not used [-Werror,-Wunused-but-set-variable]
244 | u32 regval;
| ^
drivers/dma/owl-dma.c:268:6: error: variable 'regval' set but not used [-Werror,-Wunused-but-set-variable]
268 | u32 regval;
| ^

Change these to what was most likely intended.

Fixes 47e20577c24d ("dmaengine: Add Actions Semi Owl family S900 DMA driver")
---
 drivers/dma/owl-dma.c | 4 ++--
 1 file changed, 2 insertions(+), 2 deletions(-)
drivers/dma/owl-dma.c +2 -2
index 4e76c4ec2d39..e001f4f7aa64 100644
@@ -250,7 +250,7 @@ static void pchan_update(struct owl_dma_pchan *pchan, u32 reg,
 	else
 		regval &= ~val;
 
-	writel(val, pchan->base + reg);
+	writel(regval, pchan->base + reg);
 }
 
 static void pchan_writel(struct owl_dma_pchan *pchan, u32 reg, u32 data)
@@ -274,7 +274,7 @@ static void dma_update(struct owl_dma *od, u32 reg, u32 val, bool state)
 	else
 		regval &= ~val;
 
-	writel(val, od->base + reg);
+	writel(regval, od->base + reg);
 }
 
 static void dma_writel(struct owl_dma *od, u32 reg, u32 data)
Signature · 1 line
2.39.2
Reviewed-by on v1 1/1
#1 lore raw
Quoted 14 lines
Quoted 1 line
Quoted 1 line
Quoted 1 line
Quoted 1 line

"Arnd" == Arnd Bergmann <[email protected]> writes:

From: Arnd Bergmann <[email protected]>
When building with 'make W=1', clang notices that the computed register values are never actually written back but instead the wrong variable is set:

drivers/dma/owl-dma.c:244:6: error: variable 'regval' set but not used [-Werror,-Wunused-but-set-variable]
244 | u32 regval;
| ^
drivers/dma/owl-dma.c:268:6: error: variable 'regval' set but not used [-Werror,-Wunused-but-set-variable]
268 | u32 regval;
| ^

Quoted 4 lines

Change these to what was most likely intended.

Fixes 47e20577c24d ("dmaengine: Add Actions Semi Owl family S900 DMA driver")

Good catch!

Signature · 1 line
Bye, Peter Korsgaard
Reviewed-by on v1 1/1
#2 lore raw
In reply to Arnd Bergmann
Quoted 6 lines · Arnd Bergmann

From: Arnd Bergmann <[email protected]>

When building with 'make W=1', clang notices that the computed register values are never actually written back but instead the wrong variable is set:

Quoted 9 lines

drivers/dma/owl-dma.c:244:6: error: variable 'regval' set but not used [-Werror,-Wunused-but-set-variable]
244 | u32 regval;
| ^
drivers/dma/owl-dma.c:268:6: error: variable 'regval' set but not used [-Werror,-Wunused-but-set-variable]
268 | u32 regval;
| ^

Change these to what was most likely intended.

Wow... Thanks for spotting. Well thanks to Clang also ;)

Quoted 2 lines
Fixes 47e20577c24d ("dmaengine: Add Actions Semi Owl family S900 DMA driver")

- Mani

Quoted 29 lines
---
 drivers/dma/owl-dma.c | 4 ++--
 1 file changed, 2 insertions(+), 2 deletions(-)
drivers/dma/owl-dma.c +2 -2
index 4e76c4ec2d39..e001f4f7aa64 100644
@@ -250,7 +250,7 @@ static void pchan_update(struct owl_dma_pchan *pchan, u32 reg,
 	else
 		regval &= ~val;
 
-	writel(val, pchan->base + reg);
+	writel(regval, pchan->base + reg);
 }
 
 static void pchan_writel(struct owl_dma_pchan *pchan, u32 reg, u32 data)
@@ -274,7 +274,7 @@ static void dma_update(struct owl_dma *od, u32 reg, u32 val, bool state)
 	else
 		regval &= ~val;
 
-	writel(val, od->base + reg);
+	writel(regval, od->base + reg);
 }
 
 static void dma_writel(struct owl_dma *od, u32 reg, u32 data)
Signature · 1 line
2.39.2
Signature · 1 line
மணிவண்ணன் சதாசிவம்
maintainer Applied
#3 lore raw
In reply to Arnd Bergmann
Quoted 4 lines · Arnd Bergmann

When building with 'make W=1', clang notices that the computed register values are never actually written back but instead the wrong variable is set:

Quoted 8 lines

drivers/dma/owl-dma.c:244:6: error: variable 'regval' set but not used [-Werror,-Wunused-but-set-variable]
244 | u32 regval;
| ^
drivers/dma/owl-dma.c:268:6: error: variable 'regval' set but not used [-Werror,-Wunused-but-set-variable]
268 | u32 regval;
| ^

[...]

Applied, thanks!

[1/1] dmaengine: owl: fix register access functions

      commit: 43c633ef93a5d293c96ebcedb40130df13128428

Best regards,

Signature · 1 line
~Vinod