From: Simon Que Date: Thu, 17 Jan 2013 19:44:47 +0000 (-0800) Subject: BACKPORT: hid: Fix uninitialized variable "size" in hid-wiimote-debug X-Git-Url: http://xenbits.xensource.com/gitweb?a=commitdiff_plain;h=492c02f27c6c917178b63d53592eb071ba5af6ab;p=people%2Faperard%2Flinux-chromebook.git BACKPORT: 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] BUG=chromium-os:5542 TEST=emerge-daisy chromeos-kernel, make sure this warning doesn't appear Change-Id: I63896a2dd9e08cfd25b25b81d447c7fe9baeae2f Signed-off-by: Simon Que Reviewed-on: https://gerrit.chromium.org/gerrit/41558 Reviewed-by: Mandeep Singh Baines --- diff --git a/drivers/hid/hid-wiimote-debug.c b/drivers/hid/hid-wiimote-debug.c index eec329197c160..90124ffaa2a52 100644 --- a/drivers/hid/hid-wiimote-debug.c +++ b/drivers/hid/hid-wiimote-debug.c @@ -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;