Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

-Wshift-negative-value in drivers/thermal/armada_thermal.c #532

Open
Nathan-Huckleberry opened this issue Jun 12, 2019 · 2 comments

Comments

@Nathan-Huckleberry
Copy link

commented Jun 12, 2019

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
.
               ~~~~~~~~~~~~~~~~~~~~~~~ ^

Shifting left by zero. Shift can probably be safely removed.

#define CONTROL1_TSEN_AVG_SHIFT		0
@Nathan-Huckleberry

This comment has been minimized.

Copy link
Author

commented Jun 13, 2019

@nickdesaulniers

This comment has been minimized.

Copy link
Member

commented Aug 28, 2019

Rui (the thermal maintainer) said this was accepted, I expect it to show up in https://git.kernel.org/pub/scm/linux/kernel/git/rzhang/linux.git/log/?h=next.

ColinIanKing pushed a commit to ColinIanKing/linux-next-mirror that referenced this issue Sep 2, 2019
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.

Cc: clang-built-linux@googlegroups.com
Link: ClangBuiltLinux/linux#532
Signed-off-by: Nathan Huckleberry <nhuck@google.com>
Reviewed-by: Daniel Lezcano <daniel.lezcano@linaro.org>
Acked-by: Miquel Raynal <miquel.raynal@bootlin.com>
Signed-off-by: Zhang Rui <rui.zhang@intel.com>
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Projects
None yet
2 participants
You can’t perform that action at this time.