Shut up compiler warning

Triggered with -O

../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@who-t.net>
Reviewed-by: Benjamin Tissoires <benjamin.tissoires@gmail.com>
This commit is contained in:
Peter Hutterer 2014-03-18 13:44:39 +10:00
parent b7bc345b40
commit ab4fdcc0d5

View file

@ -1078,7 +1078,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))