Skip to content

Commit 4187bf3

Browse files
nathanchancegregkh
authored andcommitted
platform/x86: thinkpad_acpi: Fix bitwise vs. logical warning
[ Upstream commit fd96e35 ] A new warning in clang points out a use of bitwise OR with boolean expressions in this driver: drivers/platform/x86/thinkpad_acpi.c:9061:11: error: use of bitwise '|' with boolean operands [-Werror,-Wbitwise-instead-of-logical] else if ((strlencmp(cmd, "level disengaged") == 0) | ^~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~ || drivers/platform/x86/thinkpad_acpi.c:9061:11: note: cast one or both operands to int to silence this warning 1 error generated. This should clearly be a logical OR so change it to fix the warning. Fixes: fe98a52 ("ACPI: thinkpad-acpi: add sysfs support to fan subdriver") Link: ClangBuiltLinux/linux#1476 Reported-by: Tor Vic <torvic9@mailbox.org> Signed-off-by: Nathan Chancellor <nathan@kernel.org> Reviewed-by: Nick Desaulniers <ndesaulniers@google.com> Link: https://lore.kernel.org/r/20211018182537.2316800-1-nathan@kernel.org Reviewed-by: Hans de Goede <hdegoede@redhat.com> Signed-off-by: Hans de Goede <hdegoede@redhat.com> Signed-off-by: Sasha Levin <sashal@kernel.org>
1 parent 25c032c commit 4187bf3

1 file changed

Lines changed: 1 addition & 1 deletion

File tree

‎drivers/platform/x86/thinkpad_acpi.c‎

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -9097,7 +9097,7 @@ static int fan_write_cmd_level(const char *cmd, int *rc)
90979097

90989098
if (strlencmp(cmd, "level auto") == 0)
90999099
level = TP_EC_FAN_AUTO;
9100-
else if ((strlencmp(cmd, "level disengaged") == 0) |
9100+
else if ((strlencmp(cmd, "level disengaged") == 0) ||
91019101
(strlencmp(cmd, "level full-speed") == 0))
91029102
level = TP_EC_FAN_FULLSPEED;
91039103
else if (sscanf(cmd, "level %d", &level) != 1)

0 commit comments

Comments
 (0)