Skip to content

Commit

Permalink
HID: Fix uninitialized variable "size" in hid-wiimote-debug
Browse files Browse the repository at this point in the history
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>
  • Loading branch information
Simon Que authored and Jiri Kosina committed Jan 18, 2013
1 parent aaca9cc commit b77a989
Showing 1 changed file with 1 addition and 1 deletion.
2 changes: 1 addition & 1 deletion drivers/hid/hid-wiimote-debug.c
Original file line number Diff line number Diff line change
Expand Up @@ -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;
Expand Down

0 comments on commit b77a989

Please sign in to comment.