aboutsummaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
-rw-r--r--sound/core/rtctimer.c11
1 files changed, 3 insertions, 8 deletions
diff --git a/sound/core/rtctimer.c b/sound/core/rtctimer.c
index 85627dbe6a57..8762ff8938c2 100644
--- a/sound/core/rtctimer.c
+++ b/sound/core/rtctimer.c
@@ -119,16 +119,11 @@ static void rtctimer_interrupt(void *private_data)
119 */ 119 */
120static int __init rtctimer_init(void) 120static int __init rtctimer_init(void)
121{ 121{
122 int order, err; 122 int err;
123 snd_timer_t *timer; 123 snd_timer_t *timer;
124 124
125 if (rtctimer_freq < 2 || rtctimer_freq > 8192) { 125 if (rtctimer_freq < 2 || rtctimer_freq > 8192 ||
126 snd_printk(KERN_ERR "rtctimer: invalid frequency %d\n", rtctimer_freq); 126 (rtctimer_freq & (rtctimer_freq - 1)) != 0) {
127 return -EINVAL;
128 }
129 for (order = 1; rtctimer_freq > order; order <<= 1)
130 ;
131 if (rtctimer_freq != order) {
132 snd_printk(KERN_ERR "rtctimer: invalid frequency %d\n", rtctimer_freq); 127 snd_printk(KERN_ERR "rtctimer: invalid frequency %d\n", rtctimer_freq);
133 return -EINVAL; 128 return -EINVAL;
134 } 129 }