hid: intel-ish-hid: avoid bogus uninitialized-variable warning
Subsystems (2)
PATCH 1/1 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().
--- drivers/hid/intel-ish-hid/ishtp-fw-loader.c | 2 ++ 1 file changed, 2 insertions(+)
drivers/hid/intel-ish-hid/ishtp-fw-loader.c +2 -0
@@ -480,6 +480,7 @@ static int ish_query_loader_prop(struct ishtp_cl_data *client_data, sizeof(ldr_xfer_query_resp));if (rv <0 ) { client_data->flag_retry = true; + *fw_info = (struct shim_fw_info ){};return rv; }
@@ -489,6 +490,7 @@ static int ish_query_loader_prop(struct ishtp_cl_data *client_data,"data size %d is not equal to size of loader_xfer_query_response %zu\n" , rv, sizeof(struct loader_xfer_query_response)); client_data->flag_retry = true; + *fw_info = (struct shim_fw_info ){};return -EMSGSIZE ; }
Signature · 1 line
2.26.0
Quoted 18 lines · Arnd Bergmann
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; ^
Quoted 6 lines
Make sure to initialize it before returning an error from
ish_query_loader_prop().Fixes 91b228107da3 ("HID: intel-ish-hid: ISH firmware loader clientdriver")
Signed-off-by Arnd Bergmann <[email protected]>
Quoted 28 lines
--- drivers/hid/intel-ish-hid/ishtp-fw-loader.c | 2 ++ 1 file changed, 2 insertions(+)drivers/hid/intel-ish-hid/ishtp-fw-loader.c +2
-0@@ -480,6 +480,7 @@ static int ish_query_loader_prop(structishtp_cl_data *client_data, sizeof(ldr_xfer_query_resp));if (rv <0 ) { client_data->flag_retry = true; + *fw_info = (struct shim_fw_info ){};return rv; }@@ -489,6 +490,7 @@ static int ish_query_loader_prop(struct ishtp_cl_data *client_data, "data size %d is not equal to size of loader_xfer_query_response %zu\n", rv, sizeof(struct loader_xfer_query_response)); client_data->flag_retry = true; + *fw_info = (struct shim_fw_info ){};return -EMSGSIZE ;}
Quoted 13 lines · Arnd Bergmann
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; ^
Quoted 4 lines
Make sure to initialize it before returning an error from
ish_query_loader_prop().Fixes 91b228107da3 ("HID: intel-ish-hid: ISH firmware loader client driver")Signed-off-by Arnd Bergmann <[email protected]>
Applied, thanks.
Signature · 2 lines
Jiri Kosina SUSE Labs