Linux Input/HID development
 help / color / mirror / Atom feed
From: Simon Que <sque@chromium.org>
To: jkosina@suse.cz, dh.herrmann@googlemail.com, linux-input@vger.kernel.org
Cc: msb@chromium.org, Simon Que <sque@chromium.org>
Subject: [PATCH v2] hid: Fix uninitialized variable "size" in hid-wiimote-debug
Date: Thu, 17 Jan 2013 13:02:52 -0800	[thread overview]
Message-ID: <1358456572-22851-1-git-send-email-sque@chromium.org> (raw)

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>
---
 drivers/hid/hid-wiimote-debug.c |    2 +-
 1 files changed, 1 insertions(+), 1 deletions(-)

diff --git a/drivers/hid/hid-wiimote-debug.c b/drivers/hid/hid-wiimote-debug.c
index eec3291..90124ff 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;
-- 
1.7.8.6


             reply	other threads:[~2013-01-17 21:03 UTC|newest]

Thread overview: 3+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2013-01-17 21:02 Simon Que [this message]
2013-01-17 21:07 ` [PATCH v2] hid: Fix uninitialized variable "size" in hid-wiimote-debug David Herrmann
2013-01-18  9:59   ` Jiri Kosina

Reply instructions:

You may reply publicly to this message via plain-text email
using any one of the following methods:

* Save the following mbox file, import it into your mail client,
  and reply-to-all from there: mbox

  Avoid top-posting and favor interleaved quoting:
  https://en.wikipedia.org/wiki/Posting_style#Interleaved_style

* Reply using the --to, --cc, and --in-reply-to
  switches of git-send-email(1):

  git send-email \
    --in-reply-to=1358456572-22851-1-git-send-email-sque@chromium.org \
    --to=sque@chromium.org \
    --cc=dh.herrmann@googlemail.com \
    --cc=jkosina@suse.cz \
    --cc=linux-input@vger.kernel.org \
    --cc=msb@chromium.org \
    /path/to/YOUR_REPLY

  https://kernel.org/pub/software/scm/git/docs/git-send-email.html

* If your mail client supports setting the In-Reply-To header
  via mailto: links, try the mailto: link
Be sure your reply has a Subject: header at the top and a blank line before the message body.
This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox