]> git.kernelconcepts.de Git - karo-tx-linux.git/blobdiff - drivers/rtc/rtc-vr41xx.c
rtc: move power of 2 periodic frequency check down into drivers
[karo-tx-linux.git] / drivers / rtc / rtc-vr41xx.c
index 57b7aac092a39bccba15bc2578ad83773f520c5e..f11297aff854a3bf680d84c382581083e853df5d 100644 (file)
@@ -27,6 +27,7 @@
 #include <linux/rtc.h>
 #include <linux/spinlock.h>
 #include <linux/types.h>
+#include <linux/log2.h>
 
 #include <asm/div64.h>
 #include <asm/io.h>
@@ -210,6 +211,8 @@ static int vr41xx_rtc_irq_set_freq(struct device *dev, int freq)
 {
        unsigned long count;
 
+       if (!is_power_of_2(freq))
+               return -EINVAL;
        count = RTC_FREQUENCY;
        do_div(count, freq);