mirror of
https://git.kernel.org/pub/scm/linux/kernel/git/stable/linux.git
synced 2025-01-12 08:00:09 +00:00
[ALSA] rtctimer: optimize module parameter validation
Modules: RTC timer driver The check whether rtctimer_freq is a power of two can be done easier with a simple bit operation. Signed-off-by: Clemens Ladisch <clemens@ladisch.de>
This commit is contained in:
parent
adf25df1be
commit
d9ad1bdd6d
@ -119,16 +119,11 @@ static void rtctimer_interrupt(void *private_data)
|
||||
*/
|
||||
static int __init rtctimer_init(void)
|
||||
{
|
||||
int order, err;
|
||||
int err;
|
||||
snd_timer_t *timer;
|
||||
|
||||
if (rtctimer_freq < 2 || rtctimer_freq > 8192) {
|
||||
snd_printk(KERN_ERR "rtctimer: invalid frequency %d\n", rtctimer_freq);
|
||||
return -EINVAL;
|
||||
}
|
||||
for (order = 1; rtctimer_freq > order; order <<= 1)
|
||||
;
|
||||
if (rtctimer_freq != order) {
|
||||
if (rtctimer_freq < 2 || rtctimer_freq > 8192 ||
|
||||
(rtctimer_freq & (rtctimer_freq - 1)) != 0) {
|
||||
snd_printk(KERN_ERR "rtctimer: invalid frequency %d\n", rtctimer_freq);
|
||||
return -EINVAL;
|
||||
}
|
||||
|
Loading…
x
Reference in New Issue
Block a user