* [PATCH] input: appletouch: shut up -Wmaybe-uninitialized warning
@ 2020-01-07 20:42 Arnd Bergmann
2020-01-17 21:45 ` Dmitry Torokhov
0 siblings, 1 reply; 2+ messages in thread
From: Arnd Bergmann @ 2020-01-07 20:42 UTC (permalink / raw)
To: Dmitry Torokhov
Cc: Oleksandr Natalenko, Arnd Bergmann, Richard Fontana, linux-input,
linux-kernel
Building with -O3 introduces a false-positive warning in this file:
In file included from include/linux/compiler_types.h:68,
from <command-line>:
drivers/input/mouse/appletouch.c: In function 'atp_complete_geyser_3_4':
include/linux/compiler-gcc.h:71:45: error: 'x_z' may be used uninitialized in this function [-Werror=maybe-uninitialized]
#define __UNIQUE_ID(prefix) __PASTE(__PASTE(__UNIQUE_ID_, prefix), __COUNTER__)
^~~~~~~~~~~~
drivers/input/mouse/appletouch.c:657:12: note: 'x_z' was declared here
int x, y, x_z, y_z, x_f, y_f;
^~~
In file included from include/linux/compiler_types.h:68,
from <command-line>:
drivers/input/mouse/appletouch.c: In function 'atp_complete_geyser_1_2':
include/linux/compiler-gcc.h:71:45: error: 'x_z' may be used uninitialized in this function [-Werror=maybe-uninitialized]
#define __UNIQUE_ID(prefix) __PASTE(__PASTE(__UNIQUE_ID_, prefix), __COUNTER__)
^~~~~~~~~~~~
drivers/input/mouse/appletouch.c:517:12: note: 'x_z' was declared here
int x, y, x_z, y_z, x_f, y_f;
^~~
The variables are not actually used here since the only usage
happens when both 'x' and 'y' are non-zero, but this is something
that gcc fails to track.
Fixes: mmtom ("init/Kconfig: enable -O3 for all arches")
Signed-off-by: Arnd Bergmann <arnd@arndb.de>
---
drivers/input/mouse/appletouch.c | 2 +-
1 file changed, 1 insertion(+), 1 deletion(-)
diff --git a/drivers/input/mouse/appletouch.c b/drivers/input/mouse/appletouch.c
index 3f06e8a495d8..ec2139c43fcd 100644
--- a/drivers/input/mouse/appletouch.c
+++ b/drivers/input/mouse/appletouch.c
@@ -330,7 +330,7 @@ static void atp_reinit(struct work_struct *work)
retval);
}
-static int atp_calculate_abs(struct atp *dev, int offset, int nb_sensors,
+static noinline int atp_calculate_abs(struct atp *dev, int offset, int nb_sensors,
int fact, int *z, int *fingers)
{
int i, pass;
--
2.20.0
^ permalink raw reply related [flat|nested] 2+ messages in thread* Re: [PATCH] input: appletouch: shut up -Wmaybe-uninitialized warning
2020-01-07 20:42 [PATCH] input: appletouch: shut up -Wmaybe-uninitialized warning Arnd Bergmann
@ 2020-01-17 21:45 ` Dmitry Torokhov
0 siblings, 0 replies; 2+ messages in thread
From: Dmitry Torokhov @ 2020-01-17 21:45 UTC (permalink / raw)
To: Arnd Bergmann
Cc: Oleksandr Natalenko, Richard Fontana, linux-input, linux-kernel
Hi Arnd,
On Tue, Jan 07, 2020 at 09:42:45PM +0100, Arnd Bergmann wrote:
> Building with -O3 introduces a false-positive warning in this file:
>
> In file included from include/linux/compiler_types.h:68,
> from <command-line>:
> drivers/input/mouse/appletouch.c: In function 'atp_complete_geyser_3_4':
> include/linux/compiler-gcc.h:71:45: error: 'x_z' may be used uninitialized in this function [-Werror=maybe-uninitialized]
> #define __UNIQUE_ID(prefix) __PASTE(__PASTE(__UNIQUE_ID_, prefix), __COUNTER__)
> ^~~~~~~~~~~~
> drivers/input/mouse/appletouch.c:657:12: note: 'x_z' was declared here
> int x, y, x_z, y_z, x_f, y_f;
> ^~~
> In file included from include/linux/compiler_types.h:68,
> from <command-line>:
> drivers/input/mouse/appletouch.c: In function 'atp_complete_geyser_1_2':
> include/linux/compiler-gcc.h:71:45: error: 'x_z' may be used uninitialized in this function [-Werror=maybe-uninitialized]
> #define __UNIQUE_ID(prefix) __PASTE(__PASTE(__UNIQUE_ID_, prefix), __COUNTER__)
> ^~~~~~~~~~~~
> drivers/input/mouse/appletouch.c:517:12: note: 'x_z' was declared here
> int x, y, x_z, y_z, x_f, y_f;
> ^~~
>
> The variables are not actually used here since the only usage
> happens when both 'x' and 'y' are non-zero, but this is something
> that gcc fails to track.
>
> Fixes: mmtom ("init/Kconfig: enable -O3 for all arches")
> Signed-off-by: Arnd Bergmann <arnd@arndb.de>
> ---
> drivers/input/mouse/appletouch.c | 2 +-
> 1 file changed, 1 insertion(+), 1 deletion(-)
>
> diff --git a/drivers/input/mouse/appletouch.c b/drivers/input/mouse/appletouch.c
> index 3f06e8a495d8..ec2139c43fcd 100644
> --- a/drivers/input/mouse/appletouch.c
> +++ b/drivers/input/mouse/appletouch.c
> @@ -330,7 +330,7 @@ static void atp_reinit(struct work_struct *work)
> retval);
> }
>
> -static int atp_calculate_abs(struct atp *dev, int offset, int nb_sensors,
> +static noinline int atp_calculate_abs(struct atp *dev, int offset, int nb_sensors,
> int fact, int *z, int *fingers)
I wonder if instead of nolinine we can have "*fingers = *z = 0;" in this
function...
I feel noinline has to be reserved for exceptional cases...
Thanks.
--
Dmitry
^ permalink raw reply [flat|nested] 2+ messages in thread
end of thread, other threads:[~2020-01-17 21:45 UTC | newest]
Thread overview: 2+ messages (download: mbox.gz follow: Atom feed
-- links below jump to the message on this page --
2020-01-07 20:42 [PATCH] input: appletouch: shut up -Wmaybe-uninitialized warning Arnd Bergmann
2020-01-17 21:45 ` Dmitry Torokhov
This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox