Skip to content

Commit

Permalink
HID: uhid: silence gcc warning
Browse files Browse the repository at this point in the history
gcc is giving me:

drivers/hid/uhid.c: In function ‘uhid_hid_get_raw’:
drivers/hid/uhid.c:157: warning: ‘len’ may be used uninitialized in this function

which is clearly bogus, as

- when used as memcpy() argument, it's initialized properly
- the code is structured in a way that either 'ret' or 'len'
  is always initialized, so the return statement always has
  an initialized value.

Signed-off-by: Jiri Kosina <jkosina@suse.cz>
  • Loading branch information
Jiri Kosina committed Jun 18, 2012
1 parent 0a09d3a commit 1a8b294
Showing 1 changed file with 1 addition and 1 deletion.
2 changes: 1 addition & 1 deletion drivers/hid/uhid.c
Original file line number Diff line number Diff line change
Expand Up @@ -154,7 +154,7 @@ static int uhid_hid_get_raw(struct hid_device *hid, unsigned char rnum,
struct uhid_event *ev;
unsigned long flags;
int ret;
size_t len;
size_t uninitialized_var(len);
struct uhid_feature_answer_req *req;

if (!uhid->running)
Expand Down

0 comments on commit 1a8b294

Please sign in to comment.