Patch "x86/olpc: fix 'logical not is only applied to the left hand side'" has been added to the 5.18-stable tree

[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

 



This is a note to let you know that I've just added the patch titled

    x86/olpc: fix 'logical not is only applied to the left hand side'

to the 5.18-stable tree which can be found at:
    http://www.kernel.org/git/?p=linux/kernel/git/stable/stable-queue.git;a=summary

The filename of the patch is:
     x86-olpc-fix-logical-not-is-only-applied-to-the-left.patch
and it can be found in the queue-5.18 subdirectory.

If you, or anyone else, feels it should not be added to the stable tree,
please let <stable@xxxxxxxxxxxxxxx> know about it.



commit b63e4693e67826d5eb07e8254daed08277df7133
Author: Alexander Lobakin <alexandr.lobakin@xxxxxxxxx>
Date:   Fri Jul 15 17:15:36 2022 +0200

    x86/olpc: fix 'logical not is only applied to the left hand side'
    
    [ Upstream commit 3a2ba42cbd0b669ce3837ba400905f93dd06c79f ]
    
    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@xxxxxxxxxxxxxxx # 3.5+
    Reported-by: Guenter Roeck <linux@xxxxxxxxxxxx>
    Reported-by: kernel test robot <lkp@xxxxxxxxx>
    Reviewed-and-tested-by: Guenter Roeck <linux@xxxxxxxxxxxx>
    Signed-off-by: Alexander Lobakin <alexandr.lobakin@xxxxxxxxx>
    Signed-off-by: Yury Norov <yury.norov@xxxxxxxxx>
    Signed-off-by: Sasha Levin <sashal@xxxxxxxxxx>

diff --git a/arch/x86/platform/olpc/olpc-xo1-sci.c b/arch/x86/platform/olpc/olpc-xo1-sci.c
index f03a6883dcc6..89f25af4b3c3 100644
--- a/arch/x86/platform/olpc/olpc-xo1-sci.c
+++ b/arch/x86/platform/olpc/olpc-xo1-sci.c
@@ -80,7 +80,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);



[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]
[Index of Archives]     [Linux USB Devel]     [Linux Audio Users]     [Yosemite News]     [Linux Kernel]     [Linux SCSI]

  Powered by Linux