Skip to content

Commit 0b66fb3

Browse files
arndbJiri Kosina
authored andcommitted
HID: intel-ish-hid: avoid bogus uninitialized-variable warning
Older compilers like gcc-4.8 don't see that the variable is initialized when it is used: In file included from include/linux/compiler_types.h:68:0, from <command-line>:0: drivers/hid/intel-ish-hid/ishtp-fw-loader.c: In function 'load_fw_from_host': include/linux/compiler-gcc.h:75:45: warning: 'fw_info.ldr_capability.max_dma_buf_size' may be used uninitialized in this function [-Wmaybe-uninitialized] #define __UNIQUE_ID(prefix) __PASTE(__PASTE(__UNIQUE_ID_, prefix), __COUNTER__) ^ drivers/hid/intel-ish-hid/ishtp-fw-loader.c:770:22: note: 'fw_info.ldr_capability.max_dma_buf_size' was declared here struct shim_fw_info fw_info; ^ Make sure to initialize it before returning an error from ish_query_loader_prop(). Fixes: 91b2281 ("HID: intel-ish-hid: ISH firmware loader client driver") Signed-off-by: Arnd Bergmann <[email protected]> Acked-by: Srinivas Pandruvada <[email protected]> Signed-off-by: Jiri Kosina <[email protected]>
1 parent 47cf1b4 commit 0b66fb3

File tree

1 file changed

+2
-0
lines changed

1 file changed

+2
-0
lines changed

drivers/hid/intel-ish-hid/ishtp-fw-loader.c

Lines changed: 2 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -480,6 +480,7 @@ static int ish_query_loader_prop(struct ishtp_cl_data *client_data,
480480
sizeof(ldr_xfer_query_resp));
481481
if (rv < 0) {
482482
client_data->flag_retry = true;
483+
*fw_info = (struct shim_fw_info){};
483484
return rv;
484485
}
485486

@@ -489,6 +490,7 @@ static int ish_query_loader_prop(struct ishtp_cl_data *client_data,
489490
"data size %d is not equal to size of loader_xfer_query_response %zu\n",
490491
rv, sizeof(struct loader_xfer_query_response));
491492
client_data->flag_retry = true;
493+
*fw_info = (struct shim_fw_info){};
492494
return -EMSGSIZE;
493495
}
494496

0 commit comments

Comments
 (0)