Donate to e Foundation | Murena handsets with /e/OS | Own a part of Murena! Learn more

Commit 159366ea authored by Nicholas Mc Guire's avatar Nicholas Mc Guire Committed by Mark Brown
Browse files

ASoC: wm8996: ensure lower bounds of 1 for timeout



wait_for_completion_timeout can be called with timeout == 0 due to
msecs_to_jiffies(2) == 1 for HZ < 1000 and usecs_to_jiffies(300) == 1
for all reasonable values of HZ, thus the following timeout /= 2; sets
timeout to 0. This patch simply adds a lower-bounds of 1.

Signed-off-by: default avatarNicholas Mc Guire <hofrat@osadl.org>
Acked-by: default avatarCharles Keepax <ckeepax@opensource.wolfsonmicro.com>
Signed-off-by: default avatarMark Brown <broonie@kernel.org>
parent 62c76fe2
Loading
Loading
Loading
Loading
+2 −1
Original line number Original line Diff line number Diff line
@@ -2110,7 +2110,8 @@ static int wm8996_set_fll(struct snd_soc_codec *codec, int fll_id, int source,
	if (i2c->irq)
	if (i2c->irq)
		timeout *= 10;
		timeout *= 10;
	else
	else
		timeout /= 2;
		/* ensure timeout of atleast 1 jiffies */
		timeout = timeout/2 ? : 1;


	for (retry = 0; retry < 10; retry++) {
	for (retry = 0; retry < 10; retry++) {
		time_left = wait_for_completion_timeout(&wm8996->fll_lock,
		time_left = wait_for_completion_timeout(&wm8996->fll_lock,