[alsa-devel] [PATCH] ALSA: timer: fix nsec/sec initialization confusion

Takashi Iwai tiwai at suse.de
Sun Jan 12 09:43:34 CET 2020


On Sat, 11 Jan 2020 21:33:25 +0100,
Pierre-Louis Bossart wrote:
> 
> GCC reports a warning with W=1:
> 
> sound/core/timer.c: In function ‘snd_timer_user_read’:
> sound/core/timer.c:2219:19: warning: initialized field overwritten
> [-Woverride-init]
>  2219 |     .tstamp_sec = tread->tstamp_nsec,
>       |                   ^~~~~
> sound/core/timer.c:2219:19: note: (near initialization for
> ‘(anonymous).tstamp_sec’)
> 
> Assigning nsec values to sec fields is problematic in general, even
> more so when the initial goal was to survive the 2030 timer
> armageddon.
> 
> Fix by using the proper field in the initialization
> 
> Cc: Baolin Wang <baolin.wang at linaro.org>
> Cc: Arnd Bergmann <arnd at arndb.de>
> Fixes: 07094ae6f9527 ("ALSA: Avoid using timespec for struct snd_timer_tread")
> Signed-off-by: Pierre-Louis Bossart <pierre-louis.bossart at linux.intel.com>

Applied now.  Thanks.


Takashi


More information about the Alsa-devel mailing list