Disallow setting an interrupt frequency of zero (which would result in a
division by zero), and disallow enabling the interrupt when the frequency
hasn't yet been set (which would use an interrupt period of zero).
Signed-off-by: Clemens Ladisch <clemens@ladisch.de>
Signed-off-by: Andrew Morton <akpm@osdl.org>
Signed-off-by: Linus Torvalds <torvalds@osdl.org>
hpet = devp->hd_hpet;
hpetp = devp->hd_hpets;
+ if (!devp->hd_ireqfreq)
+ return -EIO;
+
v = readq(&timer->hpet_config);
spin_lock_irq(&hpet_lock);
break;
}
- if (arg & (arg - 1)) {
+ if (!arg || (arg & (arg - 1))) {
err = -EINVAL;
break;
}