diff options
Diffstat (limited to 'drivers/rtc/rtc-cmos.c')
-rw-r--r-- | drivers/rtc/rtc-cmos.c | 3 |
1 files changed, 3 insertions, 0 deletions
diff --git a/drivers/rtc/rtc-cmos.c b/drivers/rtc/rtc-cmos.c index cf98a5d8358e..b6d35f50e404 100644 --- a/drivers/rtc/rtc-cmos.c +++ b/drivers/rtc/rtc-cmos.c | |||
@@ -35,6 +35,7 @@ | |||
35 | #include <linux/spinlock.h> | 35 | #include <linux/spinlock.h> |
36 | #include <linux/platform_device.h> | 36 | #include <linux/platform_device.h> |
37 | #include <linux/mod_devicetable.h> | 37 | #include <linux/mod_devicetable.h> |
38 | #include <linux/log2.h> | ||
38 | 39 | ||
39 | /* this is for "generic access to PC-style RTC" using CMOS_READ/CMOS_WRITE */ | 40 | /* this is for "generic access to PC-style RTC" using CMOS_READ/CMOS_WRITE */ |
40 | #include <asm-generic/rtc.h> | 41 | #include <asm-generic/rtc.h> |
@@ -384,6 +385,8 @@ static int cmos_irq_set_freq(struct device *dev, int freq) | |||
384 | if (!is_valid_irq(cmos->irq)) | 385 | if (!is_valid_irq(cmos->irq)) |
385 | return -ENXIO; | 386 | return -ENXIO; |
386 | 387 | ||
388 | if (!is_power_of_2(freq)) | ||
389 | return -EINVAL; | ||
387 | /* 0 = no irqs; 1 = 2^15 Hz ... 15 = 2^0 Hz */ | 390 | /* 0 = no irqs; 1 = 2^15 Hz ... 15 = 2^0 Hz */ |
388 | f = ffs(freq); | 391 | f = ffs(freq); |
389 | if (f-- > 16) | 392 | if (f-- > 16) |