[PATCH libevdev 12/13] Fix some compiler warnings about maybe uninitialized values
Benjamin Tissoires
benjamin.tissoires at gmail.com
Wed Aug 28 02:05:19 PDT 2013
On Mon, Aug 26, 2013 at 1:27 AM, Peter Hutterer
<peter.hutterer at who-t.net> wrote:
> These are just to shut the compiler up, in all three cases we only access
> the respective values if they're defined.
>
> Signed-off-by: Peter Hutterer <peter.hutterer at who-t.net>
> ---
This one was tricky to check :)
Reviewed-by: Benjamin Tissoires <benjamin.tissoires at gmail.com>
I'd still be curious to see if the static analyzer clang would
complain about it without the patch...
Cheers,
Benjamin
> libevdev/libevdev.c | 6 +++---
> 1 file changed, 3 insertions(+), 3 deletions(-)
>
> diff --git a/libevdev/libevdev.c b/libevdev/libevdev.c
> index db6f950..0a3081e 100644
> --- a/libevdev/libevdev.c
> +++ b/libevdev/libevdev.c
> @@ -426,7 +426,7 @@ sync_state(struct libevdev *dev)
> */
>
> for (i = queue_num_elements(dev) - 1; i >= 0; i--) {
> - struct input_event e;
> + struct input_event e = {{0,0}, 0, 0, 0};
> queue_peek(dev, i, &e);
> if (e.type == EV_SYN)
> break;
> @@ -895,7 +895,7 @@ libevdev_enable_event_code(struct libevdev *dev, unsigned int type,
> unsigned int code, const void *data)
> {
> unsigned int max;
> - unsigned long *mask;
> + unsigned long *mask = NULL;
>
> if (libevdev_enable_event_type(dev, type))
> return -1;
> @@ -936,7 +936,7 @@ int
> libevdev_disable_event_code(struct libevdev *dev, unsigned int type, unsigned int code)
> {
> unsigned int max;
> - unsigned long *mask;
> + unsigned long *mask = NULL;
>
> if (type > EV_MAX)
> return -1;
> --
> 1.8.2.1
>
> _______________________________________________
> Input-tools mailing list
> Input-tools at lists.freedesktop.org
> http://lists.freedesktop.org/mailman/listinfo/input-tools
More information about the Input-tools
mailing list