Przeglądaj źródła

HID: uhid: silence gcc warning

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>
Jiri Kosina 13 lat temu
rodzic
commit
1a8b294ce6
1 zmienionych plików z 1 dodań i 1 usunięć
  1. 1 1
      drivers/hid/uhid.c

+ 1 - 1
drivers/hid/uhid.c

@@ -154,7 +154,7 @@ static int uhid_hid_get_raw(struct hid_device *hid, unsigned char rnum,
 	struct uhid_event *ev;
 	struct uhid_event *ev;
 	unsigned long flags;
 	unsigned long flags;
 	int ret;
 	int ret;
-	size_t len;
+	size_t uninitialized_var(len);
 	struct uhid_feature_answer_req *req;
 	struct uhid_feature_answer_req *req;
 
 
 	if (!uhid->running)
 	if (!uhid->running)