Skip to contentSkip to conversation

thermal: armada: Fix -Wshift-negative-value

PATCH In review Nathan Huckleberry 5 participants 9 messages Jun 13, 2019 – Aug 29, 2019

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

PATCH 1/1 thermal: armada: Fix -Wshift-negative-value

Clang produces the following warning

drivers/thermal/armada_thermal.c:270:33: warning: shifting a negative signed value is undefined [-Wshift-negative-value]
1 warning reg &= ~CONTROL1_TSEN_AVG_MASK <<
CONTROL1_TSEN_AVG_SHIFT; generated
.

               ~~~~~~~~~~~~~~~~~~~~~~~ ^

CONTROL1_TSEN_AVG_SHIFT is defined to be zero.
Since shifting by zero does nothing this variable can be removed.

---
 drivers/thermal/armada_thermal.c | 5 ++---
 1 file changed, 2 insertions(+), 3 deletions(-)
drivers/thermal/armada_thermal.c +2 -3
index 8c07a393dc2e..709a22f455e9 100644
@@ -53,7 +53,6 @@
 #define CONTROL0_TSEN_MODE_EXTERNAL	0x2
 #define CONTROL0_TSEN_MODE_MASK		0x3
 
-#define CONTROL1_TSEN_AVG_SHIFT		0
 #define CONTROL1_TSEN_AVG_MASK		0x7
 #define CONTROL1_EXT_TSEN_SW_RESET	BIT(7)
 #define CONTROL1_EXT_TSEN_HW_RESETn	BIT(8)
@@ -267,8 +266,8 @@ static void armada_cp110_init(struct platform_device *pdev,
 
 	/* Average the output value over 2^1 = 2 samples */
 	regmap_read(priv->syscon, data->syscon_control1_off, &reg);
-	reg &= ~CONTROL1_TSEN_AVG_MASK << CONTROL1_TSEN_AVG_SHIFT;
-	reg |= 1 << CONTROL1_TSEN_AVG_SHIFT;
+	reg &= ~CONTROL1_TSEN_AVG_MASK;
+	reg |= 1;
 	regmap_write(priv->syscon, data->syscon_control1_off, reg);
 }
 
Signature · 1 line
2.22.0.rc2.383.gf4fbbf30c2-goog
Reviewed-by on v1 1/1
#1 lore raw
Quoted 7 lines · Nathan Huckleberry

Clang produces the following warning

drivers/thermal/armada_thermal.c:270:33: warning: shifting a negative signed value is undefined [-Wshift-negative-value]
1 warning reg &= ~CONTROL1_TSEN_AVG_MASK <<
CONTROL1_TSEN_AVG_SHIFT; generated
.

Quoted 8 lines
               ~~~~~~~~~~~~~~~~~~~~~~~ ^

CONTROL1_TSEN_AVG_SHIFT is defined to be zero.
Since shifting by zero does nothing this variable can be removed.

Quoted 28 lines
---
 drivers/thermal/armada_thermal.c | 5 ++---
 1 file changed, 2 insertions(+), 3 deletions(-)
drivers/thermal/armada_thermal.c +2 -3
index 8c07a393dc2e..709a22f455e9 100644
@@ -53,7 +53,6 @@
 #define CONTROL0_TSEN_MODE_EXTERNAL	0x2
 #define CONTROL0_TSEN_MODE_MASK		0x3
 
-#define CONTROL1_TSEN_AVG_SHIFT		0
 #define CONTROL1_TSEN_AVG_MASK		0x7
 #define CONTROL1_EXT_TSEN_SW_RESET	BIT(7)
 #define CONTROL1_EXT_TSEN_HW_RESETn	BIT(8)
@@ -267,8 +266,8 @@ static void armada_cp110_init(struct platform_device *pdev,
 
 	/* Average the output value over 2^1 = 2 samples */
 	regmap_read(priv->syscon, data->syscon_control1_off, &reg);
-	reg &= ~CONTROL1_TSEN_AVG_MASK << CONTROL1_TSEN_AVG_SHIFT;
-	reg |= 1 << CONTROL1_TSEN_AVG_SHIFT;
+	reg &= ~CONTROL1_TSEN_AVG_MASK;
+	reg |= 1;
 	regmap_write(priv->syscon, data->syscon_control1_off, reg);
 }
 
Signature · 5 lines
 <http://www.linaro.org/> Linaro.org │ Open source software for ARM SoCs

Follow Linaro:  <http://www.facebook.com/pages/Linaro> Facebook |
<http://twitter.com/#!/linaroorg> Twitter |
<http://www.linaro.org/linaro-blog/> Blog
#3 lore raw
Quoted 2 lines · Nathan Huckleberry' via Clang Built Linux

Following up to see if this patch is going to be accepted.

Miquel is listed as the maintainer of this file in MAINTAINERS. Miquel, can you please pick this up? Otherwise Zhang, Eduardo, and Daniel are listed as maintainers for drivers/thermal/.

Signature · 2 lines
Thanks,
~Nick Desaulniers
#4 lore raw
Quoted 8 lines · Nick Desaulniers
Quoted 2 lines · Nathan Huckleberry' via Clang Built Linux

Following up to see if this patch is going to be accepted.

Miquel is listed as the maintainer of this file in MAINTAINERS. Miquel, can you please pick this up? Otherwise Zhang, Eduardo, and Daniel are listed as maintainers for drivers/thermal/.

I'm listed as reviewer, it is up to Zhang or Eduardo to take the patches.

Signature · 5 lines
 <http://www.linaro.org/> Linaro.org │ Open source software for ARM SoCs

Follow Linaro:  <http://www.facebook.com/pages/Linaro> Facebook |
<http://twitter.com/#!/linaroorg> Twitter |
<http://www.linaro.org/linaro-blog/> Blog
maintainer Acked-by
#5 lore raw

Hello,

Daniel Lezcano <[email protected]> wrote on Thu, 15 Aug 2019 01:06:21 +0200:

Quoted 13 lines · Nick Desaulniers
Quoted 8 lines
Quoted 2 lines · Nathan Huckleberry' via Clang Built Linux

Following up to see if this patch is going to be accepted.

Miquel is listed as the maintainer of this file in MAINTAINERS. Miquel, can you please pick this up? Otherwise Zhang, Eduardo, and Daniel are listed as maintainers for drivers/thermal/.

I'm listed as reviewer, it is up to Zhang or Eduardo to take the patches.

Sorry for the delay, I don't manage a tree for this driver, I'll let Zhang or Eduardo take the patch with my

Thanks,
Miquèl

reviewer
#6 lore raw
Quoted 22 lines · Miquel Raynal

Hello,

Daniel Lezcano <[email protected]> wrote on Thu, 15 Aug 2019 01:06:21 +0200:

Quoted 7 lines · Nick Desaulniers
Quoted 6 lines
Quoted 2 lines · Nathan Huckleberry' via Clang Built Linux

Following up to see if this patch is going to be accepted.

Quoted 9 lines
Quoted 4 lines

Miquel is listed as the maintainer of this file in MAINTAINERS. Miquel, can you please pick this up? Otherwise Zhang, Eduardo, and
Daniel are listed as maintainers for drivers/thermal/.

I'm listed as reviewer, it is up to Zhang or Eduardo to take the patches.

Quoted 5 lines

Sorry for the delay, I don't manage a tree for this driver, I'll let Zhang or Eduardo take the patch with my

Patch applied.

thanks,
rui

Quoted 3 lines

Thanks,
Miquèl

#7 lore raw
Quoted 27 lines · Zhang Rui
Quoted 25 lines · Miquel Raynal

Hello,

Daniel Lezcano <[email protected]> wrote on Thu, 15 Aug 2019 01:06:21 +0200:

Quoted 7 lines · Nick Desaulniers
Quoted 6 lines
Quoted 2 lines · Nathan Huckleberry' via Clang Built Linux

Following up to see if this patch is going to be accepted.

Quoted 9 lines
Quoted 4 lines

Miquel is listed as the maintainer of this file in MAINTAINERS. Miquel, can you please pick this up? Otherwise Zhang, Eduardo, and
Daniel are listed as maintainers for drivers/thermal/.

I'm listed as reviewer, it is up to Zhang or Eduardo to take the patches.

Sorry for the delay, I don't manage a tree for this driver, I'll let Zhang or Eduardo take the patch with my

Quoted 7 lines
Quoted 2 lines

Patch applied.

thanks,
rui

Thanks Rui, did you push the branch? I guess I would have expected it in https://git.kernel.org/pub/scm/linux/kernel/git/rzhang/linux.git/log/?h=next?
I'm trying to track where this lands in
https://github.com/ClangBuiltLinux/linux/issues/532.

Signature · 2 lines
Thanks,
~Nick Desaulniers
reviewer
#8 lore raw
Quoted 43 lines · Nick Desaulniers
Quoted 33 lines · Zhang Rui
Quoted 31 lines · Miquel Raynal

Hello,

Daniel Lezcano <[email protected]> wrote on Thu, 15 Aug 2019
01:06:21 +0200:

Quoted 15 lines · Nick Desaulniers
Quoted 5 lines

On Tue, Aug 13, 2019 at 10:28 AM 'Nathan Huckleberry' via Clang
Built

Quoted 1 line · Linux
Quoted 8 lines
Quoted 1 line

Following up to see if this patch is going to be accepted.

Miquel is listed as the maintainer of this file in MAINTAINERS.
Miquel, can you please pick this up? Otherwise Zhang, Eduardo,
and
Daniel are listed as maintainers for drivers/thermal/.

Quoted 5 lines

I'm listed as reviewer, it is up to Zhang or Eduardo to take the
patches.

Sorry for the delay, I don't manage a tree for this driver, I'll let
Zhang or Eduardo take the patch with my

Quoted 7 lines
Quoted 2 lines

Patch applied.

thanks,
rui

Quoted 7 lines

Thanks Rui, did you push the branch? I guess I would have expected it
in
https://git.kernel.org/pub/scm/linux/kernel/git/rzhang/linux.git/log/?h=next
?
I'm trying to track where this lands in
https://github.com/ClangBuiltLinux/linux/issues/532.

Not yet. I will push it to kernel.org after I finish my internal build test.

thanks,
rui

Quoted 1 line