Re: [PATCH] HID: intel-ish-hid: initialize ts_format.reserved
From: Srinivas Pandruvada
Date: Sat Nov 05 2016 - 13:05:58 EST
On Sat, 2016-11-05 at 16:15 +0100, Jiri Kosina wrote:
> From: Jiri Kosina <jkosina@xxxxxxx>
>
> ts_format.reserved is not used anywhere yet, but the compiler
> generates aÂ
> warning when the struct's (uninitialized) field is being copied
> around
>
> drivers/hid/intel-ish-hid/ipc/ipc.c: In function
> âwrite_ipc_from_queueâ:
> drivers/hid/intel-ish-hid/ipc/ipc.c:316: warning:
> âts_format.reservedâ may be used uninitialized in this function
>
> Avoid this by force-initializing the field to zero.
>
> Signed-off-by: Jiri Kosina <jkosina@xxxxxxx>
Acked-by: Srinivas Pandruvada <srinivas.pandruvada@xxxxxxxxxxxxxxx>
> ---
> Âdrivers/hid/intel-ish-hid/ipc/ipc.c | 1 +
> Â1 file changed, 1 insertion(+)
>
> diff --git a/drivers/hid/intel-ish-hid/ipc/ipc.c b/drivers/hid/intel-
> ish-hid/ipc/ipc.c
> index 0c9ac4d..417cd07 100644
> --- a/drivers/hid/intel-ish-hid/ipc/ipc.c
> +++ b/drivers/hid/intel-ish-hid/ipc/ipc.c
> @@ -310,6 +310,7 @@ static int write_ipc_from_queue(struct
> ishtp_device *dev)
> ÂÂÂÂÂÂÂÂÂÂÂÂÂÂÂÂÂÂÂÂÂÂÂÂÂÂÂÂÂÂÂÂÂÂÂÂÂÂÂÂÂÂÂÂÂÂÂÂ((uint32_t)tv_utc.tv_
> usec);
> ÂÂÂÂÂÂÂÂÂÂÂÂÂÂÂÂts_format.ts1_source = HOST_SYSTEM_TIME_USEC;
> ÂÂÂÂÂÂÂÂÂÂÂÂÂÂÂÂts_format.ts2_source = HOST_UTC_TIME_USEC;
> +ÂÂÂÂÂÂÂÂÂÂÂÂÂÂÂts_format.reserved = 0;
> Â
> ÂÂÂÂÂÂÂÂÂÂÂÂÂÂÂÂtime_update.primary_host_time = usec_system;
> ÂÂÂÂÂÂÂÂÂÂÂÂÂÂÂÂtime_update.secondary_host_time = usec_utc;
> --Â
> 1.9.2
>