]> git.kernelconcepts.de Git - karo-tx-linux.git/commitdiff
HID: Fix uninitialized variable "size" in hid-wiimote-debug
authorSimon Que <sque@chromium.org>
Thu, 17 Jan 2013 21:02:52 +0000 (13:02 -0800)
committerJiri Kosina <jkosina@suse.cz>
Fri, 18 Jan 2013 09:59:24 +0000 (10:59 +0100)
This variable is initialized conditionally, based on whether a wiimote
call succeeds.  However, the logic is not obvious to the compiler so it
throws a warning.  Eliminate the warning by initializing "size" to 0.

The warning is:
files/drivers/hid/hid-wiimote-debug.c:69:18: warning: 'size' may be used
uninitialized in this function [-Wmaybe-uninitialized]

Signed-off-by: Simon Que <sque@chromium.org>
Signed-off-by: David Herrmann <dh.herrmann@googlemail.com>
Signed-off-by: Jiri Kosina <jkosina@suse.cz>
drivers/hid/hid-wiimote-debug.c

index eec329197c160e6739ccf1cbb0a24adc766b15ee..90124ffaa2a5211f3e7e11ec7c4a21aedd18b054 100644 (file)
@@ -31,7 +31,7 @@ static ssize_t wiidebug_eeprom_read(struct file *f, char __user *u, size_t s,
        unsigned long flags;
        ssize_t ret;
        char buf[16];
-       __u16 size;
+       __u16 size = 0;
 
        if (s == 0)
                return -EINVAL;