]> git.ipfire.org Git - thirdparty/kernel/stable-queue.git/commitdiff
5.10-stable patches
authorGreg Kroah-Hartman <gregkh@linuxfoundation.org>
Mon, 20 Dec 2021 11:06:10 +0000 (12:06 +0100)
committerGreg Kroah-Hartman <gregkh@linuxfoundation.org>
Mon, 20 Dec 2021 11:06:10 +0000 (12:06 +0100)
added patches:
input-touchscreen-avoid-bitwise-vs-logical-or-warning.patch

queue-5.10/input-touchscreen-avoid-bitwise-vs-logical-or-warning.patch [new file with mode: 0644]
queue-5.10/series

diff --git a/queue-5.10/input-touchscreen-avoid-bitwise-vs-logical-or-warning.patch b/queue-5.10/input-touchscreen-avoid-bitwise-vs-logical-or-warning.patch
new file mode 100644 (file)
index 0000000..7821c52
--- /dev/null
@@ -0,0 +1,100 @@
+From a02dcde595f7cbd240ccd64de96034ad91cffc40 Mon Sep 17 00:00:00 2001
+From: Nathan Chancellor <nathan@kernel.org>
+Date: Fri, 15 Oct 2021 13:13:06 -0700
+Subject: Input: touchscreen - avoid bitwise vs logical OR warning
+
+From: Nathan Chancellor <nathan@kernel.org>
+
+commit a02dcde595f7cbd240ccd64de96034ad91cffc40 upstream.
+
+A new warning in clang points out a few places in this driver where a
+bitwise OR is being used with boolean types:
+
+drivers/input/touchscreen.c:81:17: warning: use of bitwise '|' with boolean operands [-Wbitwise-instead-of-logical]
+        data_present = touchscreen_get_prop_u32(dev, "touchscreen-min-x",
+                       ^~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
+
+This use of a bitwise OR is intentional, as bitwise operations do not
+short circuit, which allows all the calls to touchscreen_get_prop_u32()
+to happen so that the last parameter is initialized while coalescing the
+results of the calls to make a decision after they are all evaluated.
+
+To make this clearer to the compiler, use the '|=' operator to assign
+the result of each touchscreen_get_prop_u32() call to data_present,
+which keeps the meaning of the code the same but makes it obvious that
+every one of these calls is expected to happen.
+
+Signed-off-by: Nathan Chancellor <nathan@kernel.org>
+Reported-by: Nick Desaulniers <ndesaulniers@google.com>
+Reviewed-by: Nick Desaulniers <ndesaulniers@google.com>
+Link: https://lore.kernel.org/r/20211014205757.3474635-1-nathan@kernel.org
+Signed-off-by: Dmitry Torokhov <dmitry.torokhov@gmail.com>
+Signed-off-by: Anders Roxell <anders.roxell@linaro.org>
+Signed-off-by: Greg Kroah-Hartman <gregkh@linuxfoundation.org>
+---
+ drivers/input/touchscreen/of_touchscreen.c |   42 ++++++++++++++---------------
+ 1 file changed, 21 insertions(+), 21 deletions(-)
+
+--- a/drivers/input/touchscreen/of_touchscreen.c
++++ b/drivers/input/touchscreen/of_touchscreen.c
+@@ -79,27 +79,27 @@ void touchscreen_parse_properties(struct
+       data_present = touchscreen_get_prop_u32(dev, "touchscreen-min-x",
+                                               input_abs_get_min(input, axis_x),
+-                                              &minimum) |
+-                     touchscreen_get_prop_u32(dev, "touchscreen-size-x",
+-                                              input_abs_get_max(input,
+-                                                                axis_x) + 1,
+-                                              &maximum) |
+-                     touchscreen_get_prop_u32(dev, "touchscreen-fuzz-x",
+-                                              input_abs_get_fuzz(input, axis_x),
+-                                              &fuzz);
++                                              &minimum);
++      data_present |= touchscreen_get_prop_u32(dev, "touchscreen-size-x",
++                                               input_abs_get_max(input,
++                                                                 axis_x) + 1,
++                                               &maximum);
++      data_present |= touchscreen_get_prop_u32(dev, "touchscreen-fuzz-x",
++                                               input_abs_get_fuzz(input, axis_x),
++                                               &fuzz);
+       if (data_present)
+               touchscreen_set_params(input, axis_x, minimum, maximum - 1, fuzz);
+       data_present = touchscreen_get_prop_u32(dev, "touchscreen-min-y",
+                                               input_abs_get_min(input, axis_y),
+-                                              &minimum) |
+-                     touchscreen_get_prop_u32(dev, "touchscreen-size-y",
+-                                              input_abs_get_max(input,
+-                                                                axis_y) + 1,
+-                                              &maximum) |
+-                     touchscreen_get_prop_u32(dev, "touchscreen-fuzz-y",
+-                                              input_abs_get_fuzz(input, axis_y),
+-                                              &fuzz);
++                                              &minimum);
++      data_present |= touchscreen_get_prop_u32(dev, "touchscreen-size-y",
++                                               input_abs_get_max(input,
++                                                                 axis_y) + 1,
++                                               &maximum);
++      data_present |= touchscreen_get_prop_u32(dev, "touchscreen-fuzz-y",
++                                               input_abs_get_fuzz(input, axis_y),
++                                               &fuzz);
+       if (data_present)
+               touchscreen_set_params(input, axis_y, minimum, maximum - 1, fuzz);
+@@ -107,11 +107,11 @@ void touchscreen_parse_properties(struct
+       data_present = touchscreen_get_prop_u32(dev,
+                                               "touchscreen-max-pressure",
+                                               input_abs_get_max(input, axis),
+-                                              &maximum) |
+-                     touchscreen_get_prop_u32(dev,
+-                                              "touchscreen-fuzz-pressure",
+-                                              input_abs_get_fuzz(input, axis),
+-                                              &fuzz);
++                                              &maximum);
++      data_present |= touchscreen_get_prop_u32(dev,
++                                               "touchscreen-fuzz-pressure",
++                                               input_abs_get_fuzz(input, axis),
++                                               &fuzz);
+       if (data_present)
+               touchscreen_set_params(input, axis, 0, maximum, fuzz);
index b0411f4547a05fffb328aaf8c14ba87c03ef863e..788949720c4e3c0bd70794fde24c117ed78559ea 100644 (file)
@@ -80,3 +80,4 @@ serial-8250_fintek-fix-garbled-text-for-console.patch
 timekeeping-really-make-sure-wall_to_monotonic-isn-t-positive.patch
 libata-if-t_length-is-zero-dma-direction-should-be-dma_none.patch
 drm-amdgpu-correct-register-access-for-rlc_jump_table_restore.patch
+input-touchscreen-avoid-bitwise-vs-logical-or-warning.patch