diff options
author | Alex Shi <alex.shi@linaro.org> | 2017-03-20 12:03:13 +0800 |
---|---|---|
committer | Alex Shi <alex.shi@linaro.org> | 2017-03-20 12:03:13 +0800 |
commit | 89e7fad96be88f30f491bf227d864bf5e8e701b2 (patch) | |
tree | 6316161ebd26b780991ff8632471fbbfa3af7ea8 /sound/core/timer.c | |
parent | 5b0250d2571ee75ca3c0b34579c3e90bc2bd9c6a (diff) | |
parent | 1c563c0006661025d7a6c9bc85fc889a4e8a1c06 (diff) |
Merge branch 'linux-linaro-lsk-v4.4' into linux-linaro-lsk-v4.4-rtlsk-v4.4-17.09-rtlsk-v4.4-17.08-rtlsk-v4.4-17.07-rtlsk-v4.4-17.06-rtlsk-v4.4-17.05-rtlsk-v4.4-17.03-rt
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 ae4ea2e2e7fe..278a332f97bd 100644 --- a/sound/core/timer.c +++ b/sound/core/timer.c @@ -1700,9 +1700,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)) { |