[PATCH libevdev 12/13] Fix some compiler warnings about maybe uninitialized values

Peter Hutterer peter.hutterer at who-t.net
Sun Aug 25 16:27:32 PDT 2013


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>
---
 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



More information about the Input-tools mailing list