From: Greg Kroah-Hartman Date: Sun, 14 Aug 2022 10:23:45 +0000 (+0200) Subject: 4.9-stable patches X-Git-Tag: v5.15.61~119 X-Git-Url: http://git.ipfire.org/cgi-bin/gitweb.cgi?a=commitdiff_plain;h=e808357549149bee8666f986da7bd9f8bce14eb2;p=thirdparty%2Fkernel%2Fstable-queue.git 4.9-stable patches added patches: x86-olpc-fix-logical-not-is-only-applied-to-the-left-hand-side.patch --- diff --git a/queue-4.9/series b/queue-4.9/series index 4124e910efc..e55b0578d50 100644 --- a/queue-4.9/series +++ b/queue-4.9/series @@ -46,3 +46,4 @@ usb-hcd-fix-urb-giveback-issue-in-tasklet-function.patch usb-gadget-fix-use-after-free-read-in-usb_udc_uevent.patch netfilter-nf_tables-fix-null-deref-due-to-zeroed-list-head.patch scsi-zfcp-fix-missing-auto-port-scan-and-thus-missing-target-ports.patch +x86-olpc-fix-logical-not-is-only-applied-to-the-left-hand-side.patch diff --git a/queue-4.9/x86-olpc-fix-logical-not-is-only-applied-to-the-left-hand-side.patch b/queue-4.9/x86-olpc-fix-logical-not-is-only-applied-to-the-left-hand-side.patch new file mode 100644 index 00000000000..0923db590be --- /dev/null +++ b/queue-4.9/x86-olpc-fix-logical-not-is-only-applied-to-the-left-hand-side.patch @@ -0,0 +1,49 @@ +From 3a2ba42cbd0b669ce3837ba400905f93dd06c79f Mon Sep 17 00:00:00 2001 +From: Alexander Lobakin +Date: Fri, 15 Jul 2022 17:15:36 +0200 +Subject: x86/olpc: fix 'logical not is only applied to the left hand side' + +From: Alexander Lobakin + +commit 3a2ba42cbd0b669ce3837ba400905f93dd06c79f upstream. + +The bitops compile-time optimization series revealed one more +problem in olpc-xo1-sci.c:send_ebook_state(), resulted in GCC +warnings: + +arch/x86/platform/olpc/olpc-xo1-sci.c: In function 'send_ebook_state': +arch/x86/platform/olpc/olpc-xo1-sci.c:83:63: warning: logical not is only applied to the left hand side of comparison [-Wlogical-not-parentheses] + 83 | if (!!test_bit(SW_TABLET_MODE, ebook_switch_idev->sw) == state) + | ^~ +arch/x86/platform/olpc/olpc-xo1-sci.c:83:13: note: add parentheses around left hand side expression to silence this warning + +Despite this code working as intended, this redundant double +negation of boolean value, together with comparing to `char` +with no explicit conversion to bool, makes compilers think +the author made some unintentional logical mistakes here. +Make it the other way around and negate the char instead +to silence the warnings. + +Fixes: d2aa37411b8e ("x86/olpc/xo1/sci: Produce wakeup events for buttons and switches") +Cc: stable@vger.kernel.org # 3.5+ +Reported-by: Guenter Roeck +Reported-by: kernel test robot +Reviewed-and-tested-by: Guenter Roeck +Signed-off-by: Alexander Lobakin +Signed-off-by: Yury Norov +Signed-off-by: Greg Kroah-Hartman +--- + arch/x86/platform/olpc/olpc-xo1-sci.c | 2 +- + 1 file changed, 1 insertion(+), 1 deletion(-) + +--- a/arch/x86/platform/olpc/olpc-xo1-sci.c ++++ b/arch/x86/platform/olpc/olpc-xo1-sci.c +@@ -85,7 +85,7 @@ static void send_ebook_state(void) + return; + } + +- if (!!test_bit(SW_TABLET_MODE, ebook_switch_idev->sw) == state) ++ if (test_bit(SW_TABLET_MODE, ebook_switch_idev->sw) == !!state) + return; /* Nothing new to report. */ + + input_report_switch(ebook_switch_idev, SW_TABLET_MODE, state);