Skip to contentSkip to conversation

V4L/DVB: ir-core: fix gcc-7 warning on bool arithmetic

PATCH New Arnd Bergmann 1 participant 1 message May 11, 2017

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

PATCH 1/1 V4L/DVB: ir-core: fix gcc-7 warning on bool arithmetic

gcc-7 suggests that an expression using a bitwise not and a bitmask on a 'bool' variable is better written using boolean logic:

drivers/media/rc/imon.c: In function 'imon_incoming_scancode':
drivers/media/rc/imon.c:1725:22: error: '~' on a boolean expression [-Werror=bool-operation]

    ictx->pad_mouse = ~(ictx->pad_mouse) & 0x1;
                      ^

drivers/media/rc/imon.c:1725:22: note: did you mean to use logical not?

I agree.

Fixes 21677cfc562a ("V4L/DVB: ir-core: add imon driver")
---
 drivers/media/rc/imon.c | 2 +-
 1 file changed, 1 insertion(+), 1 deletion(-)
drivers/media/rc/imon.c +1 -1
index 3489010601b5..bd76534a2749 100644
@@ -1722,7 +1722,7 @@ static void imon_incoming_scancode(struct imon_context *ictx,
 	if (kc == KEY_KEYBOARD && !ictx->release_code) {
 		ictx->last_keycode = kc;
 		if (!nomouse) {
-			ictx->pad_mouse = ~(ictx->pad_mouse) & 0x1;
+			ictx->pad_mouse = !ictx->pad_mouse;
 			dev_dbg(dev, "toggling to %s mode\n",
 				ictx->pad_mouse ? "mouse" : "keyboard");
 			spin_unlock_irqrestore(&ictx->kc_lock, flags);
Signature · 1 line
2.9.0