Commit 17f48ec3 authored by Clemens Ladisch's avatar Clemens Ladisch Committed by Jaroslav Kysela

[ALSA] system timer: fix lost ticks correction adjustment

Fix the adjustment of the lost ticks correction variable in the case
when the correction has been fully taken into account in the next timer
expiration value.  Subtracting the scheduled ticks value would result in
an underflow.
Signed-off-by: default avatarClemens Ladisch <clemens@ladisch.de>
Signed-off-by: default avatarJaroslav Kysela <perex@suse.cz>
parent 7bc5ba7e
...@@ -987,7 +987,7 @@ static int snd_timer_s_start(struct snd_timer * timer) ...@@ -987,7 +987,7 @@ static int snd_timer_s_start(struct snd_timer * timer)
njiff++; njiff++;
} else { } else {
njiff += timer->sticks - priv->correction; njiff += timer->sticks - priv->correction;
priv->correction -= timer->sticks; priv->correction = 0;
} }
priv->last_expires = priv->tlist.expires = njiff; priv->last_expires = priv->tlist.expires = njiff;
add_timer(&priv->tlist); add_timer(&priv->tlist);
......
Markdown is supported
0%
or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment