HID: uhid: silence gcc warning
authorJiri Kosina <jkosina@suse.cz>
Mon, 18 Jun 2012 15:08:08 +0000 (17:08 +0200)
committerJiri Kosina <jkosina@suse.cz>
Mon, 18 Jun 2012 15:08:30 +0000 (17:08 +0200)
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>
drivers/hid/uhid.c

index ea560bfa033d2a101db20102f104e01368a16eef..119b7e6405beebdac4516b700e63b43048c1d7cc 100644 (file)
@@ -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)