diff options
author | Nicholas Mc Guire <hofrat@osadl.org> | 2015-03-08 06:02:38 -0400 |
---|---|---|
committer | Mark Brown <broonie@kernel.org> | 2015-03-09 14:15:56 -0400 |
commit | 159366ea38706402e8ebd0f55eef52931333deac (patch) | |
tree | 2f3bbaafa26f4ee7e1a0cc2ccb9967eaf874ac18 /sound/soc | |
parent | 62c76fe2e580f6a975679e8711bade09e24c204b (diff) |
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: Nicholas Mc Guire <hofrat@osadl.org>
Acked-by: Charles Keepax <ckeepax@opensource.wolfsonmicro.com>
Signed-off-by: Mark Brown <broonie@kernel.org>
Diffstat (limited to 'sound/soc')
-rw-r--r-- | sound/soc/codecs/wm8996.c | 3 |
1 files changed, 2 insertions, 1 deletions
diff --git a/sound/soc/codecs/wm8996.c b/sound/soc/codecs/wm8996.c index 7a2b96959589..308748a022c5 100644 --- a/sound/soc/codecs/wm8996.c +++ b/sound/soc/codecs/wm8996.c | |||
@@ -2110,7 +2110,8 @@ static int wm8996_set_fll(struct snd_soc_codec *codec, int fll_id, int source, | |||
2110 | if (i2c->irq) | 2110 | if (i2c->irq) |
2111 | timeout *= 10; | 2111 | timeout *= 10; |
2112 | else | 2112 | else |
2113 | timeout /= 2; | 2113 | /* ensure timeout of atleast 1 jiffies */ |
2114 | timeout = timeout/2 ? : 1; | ||
2114 | 2115 | ||
2115 | for (retry = 0; retry < 10; retry++) { | 2116 | for (retry = 0; retry < 10; retry++) { |
2116 | time_left = wait_for_completion_timeout(&wm8996->fll_lock, | 2117 | time_left = wait_for_completion_timeout(&wm8996->fll_lock, |