[PATCH libevdev 1/4] Shut up compiler warning
Peter Hutterer
peter.hutterer at who-t.net
Mon Mar 17 21:20:59 PDT 2014
Triggered with -O2
../libevdev/libevdev.c: In function ‘libevdev_has_event_code’:
../libevdev/libevdev-util.h:58:20: warning: ‘mask’ may be used uninitialized
in this function [-Wmaybe-uninitialized]
Optimisation clearly shuffles things around here: in the code, if no max is
found, we return -1 and bail out before we access mask.
Signed-off-by: Peter Hutterer <peter.hutterer at who-t.net>
---
libevdev/libevdev.c | 2 +-
1 file changed, 1 insertion(+), 1 deletion(-)
diff --git a/libevdev/libevdev.c b/libevdev/libevdev.c
index 84d9195..b73c5f0 100644
--- a/libevdev/libevdev.c
+++ b/libevdev/libevdev.c
@@ -1089,7 +1089,7 @@ libevdev_has_event_type(const struct libevdev *dev, unsigned int type)
LIBEVDEV_EXPORT int
libevdev_has_event_code(const struct libevdev *dev, unsigned int type, unsigned int code)
{
- const unsigned long *mask;
+ const unsigned long *mask = NULL;
int max;
if (!libevdev_has_event_type(dev, type))
--
1.8.5.3
More information about the Input-tools
mailing list