hid: Fix uninitialized variable "size" in hid-wiimote-debug
Subsystems (2)
PATCH v2 1/1 hid: Fix uninitialized variable "size" in hid-wiimote-debug
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]
--- drivers/hid/hid-wiimote-debug.c | 2 +- 1 files changed, 1 insertions(+), 1 deletions(-)
drivers/hid/hid-wiimote-debug.c +1 -1
@@ -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 ;
Signature · 1 line
1.7.8.6
Hi Simon
Quoted 7 lines · Simon Que
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]
Thanks!
Quoted 21 lines
Signed-off-by Simon Que <[email protected]>--- drivers/hid/hid-wiimote-debug.c | 2 +- 1 files changed, 1 insertions(+), 1 deletions(-)drivers/hid/hid-wiimote-debug.c +1
-2@@ -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 ; --1.7.8.6
Jiri Kosina
AppliedQuoted 11 lines · David Herrmann
Quoted 7 lines
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]Thanks!
Signed-off-by David Herrmann <[email protected]>
Applied, thanks!
Signature · 2 lines
Jiri Kosina SUSE Labs