ALSA: timer: Set lower bound of start tick time
[linux-2.6-block.git] / sound / core / timer.c
index 4d2ee99c12a3fb2a5af3dcebc4bc9a77efadcccb..d104adc75a8b0ebad1a43687b9006a39d7af4658 100644 (file)
@@ -544,6 +544,14 @@ static int snd_timer_start1(struct snd_timer_instance *timeri,
                             SNDRV_TIMER_IFLG_START))
                return -EBUSY;
 
+       /* check the actual time for the start tick;
+        * bail out as error if it's way too low (< 100us)
+        */
+       if (start) {
+               if ((u64)snd_timer_hw_resolution(timer) * ticks < 100000)
+                       return -EINVAL;
+       }
+
        if (start)
                timeri->ticks = timeri->cticks = ticks;
        else if (!timeri->cticks)