diff options
author | Alex Shi <alex.shi@linaro.org> | 2017-05-31 12:02:46 +0800 |
---|---|---|
committer | Alex Shi <alex.shi@linaro.org> | 2017-05-31 12:02:46 +0800 |
commit | dc06d1ba220ca16ebbca598bb45242ec5e818cb2 (patch) | |
tree | ef66bd14901ec3a07cf65842a3b63884a64be529 /sound/core/timer.c | |
parent | 018ed21cf3b7cb618c63294793d63b23ce4afe24 (diff) | |
parent | a898540914d4136f29bc738ce593c1c501006f23 (diff) |
Merge branch 'linux-linaro-lsk-v4.1' into linux-linaro-lsk-v4.1-androidlsk-v4.1-17.06-androidlsk-v4.1-17.05-androidlinux-linaro-lsk-v4.1-android
Diffstat (limited to 'sound/core/timer.c')
-rw-r--r-- | sound/core/timer.c | 18 |
1 files changed, 15 insertions, 3 deletions
diff --git a/sound/core/timer.c b/sound/core/timer.c index 8800d237369a..b024ef0ec32b 100644 --- a/sound/core/timer.c +++ b/sound/core/timer.c @@ -1695,9 +1695,21 @@ static int snd_timer_user_params(struct file *file, return -EBADFD; if (copy_from_user(¶ms, _params, sizeof(params))) return -EFAULT; - if (!(t->hw.flags & SNDRV_TIMER_HW_SLAVE) && params.ticks < 1) { - err = -EINVAL; - goto _end; + if (!(t->hw.flags & SNDRV_TIMER_HW_SLAVE)) { + u64 resolution; + + if (params.ticks < 1) { + err = -EINVAL; + goto _end; + } + + /* Don't allow resolution less than 1ms */ + resolution = snd_timer_resolution(tu->timeri); + resolution *= params.ticks; + if (resolution < 1000000) { + err = -EINVAL; + goto _end; + } } if (params.queue_size > 0 && (params.queue_size < 32 || params.queue_size > 1024)) { |