aboutsummaryrefslogtreecommitdiffstats
path: root/sound/core/timer.c
diff options
context:
space:
mode:
authorPierre-Louis Bossart <[email protected]>2020-01-11 20:33:25 +0000
committerTakashi Iwai <[email protected]>2020-01-12 08:08:22 +0000
commitf9993480214f1345497875ed363a52b7ef7e33db (patch)
tree57a464c8b28a6643bf36664874e4f11e05ca74f5 /sound/core/timer.c
parentMerge branch 'for-linus' into for-next (diff)
downloadkernel-f9993480214f1345497875ed363a52b7ef7e33db.tar.gz
kernel-f9993480214f1345497875ed363a52b7ef7e33db.zip
ALSA: timer: fix nsec/sec initialization confusion
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 <[email protected]> Cc: Arnd Bergmann <[email protected]> Fixes: 07094ae6f9527 ("ALSA: Avoid using timespec for struct snd_timer_tread") Signed-off-by: Pierre-Louis Bossart <[email protected]> Acked-by: Arnd Bergmann <[email protected]> Link: https://lore.kernel.org/r/[email protected] Signed-off-by: Takashi Iwai <[email protected]>
Diffstat (limited to 'sound/core/timer.c')
-rw-r--r--sound/core/timer.c2
1 files changed, 1 insertions, 1 deletions
diff --git a/sound/core/timer.c b/sound/core/timer.c
index 8835ff91a893..d9f85f2d66a3 100644
--- a/sound/core/timer.c
+++ b/sound/core/timer.c
@@ -2216,7 +2216,7 @@ static ssize_t snd_timer_user_read(struct file *file, char __user *buffer,
tread32 = (struct snd_timer_tread32) {
.event = tread->event,
.tstamp_sec = tread->tstamp_sec,
- .tstamp_sec = tread->tstamp_nsec,
+ .tstamp_nsec = tread->tstamp_nsec,
.val = tread->val,
};