mirror of
git://git.kernel.org/pub/scm/linux/kernel/git/torvalds/linux.git
synced 2025-08-05 16:54:27 +00:00
[PATCH] hpet: fix division by zero in HPET_INFO
Fix a division by zero that happened when the HPET_INFO ioctl was called before a timer frequency had been set. Signed-off-by: Clemens Ladisch <clemens@ladisch.de> Cc: Bob Picco <bob.picco@hp.com> Signed-off-by: Andrew Morton <akpm@osdl.org> Signed-off-by: Linus Torvalds <torvalds@osdl.org>
This commit is contained in:
parent
8e8505be9c
commit
af95eade68
1 changed files with 5 additions and 2 deletions
|
@ -494,8 +494,11 @@ hpet_ioctl_common(struct hpet_dev *devp, int cmd, unsigned long arg, int kernel)
|
||||||
{
|
{
|
||||||
struct hpet_info info;
|
struct hpet_info info;
|
||||||
|
|
||||||
info.hi_ireqfreq = hpet_time_div(hpetp,
|
if (devp->hd_ireqfreq)
|
||||||
devp->hd_ireqfreq);
|
info.hi_ireqfreq =
|
||||||
|
hpet_time_div(hpetp, devp->hd_ireqfreq);
|
||||||
|
else
|
||||||
|
info.hi_ireqfreq = 0;
|
||||||
info.hi_flags =
|
info.hi_flags =
|
||||||
readq(&timer->hpet_config) & Tn_PER_INT_CAP_MASK;
|
readq(&timer->hpet_config) & Tn_PER_INT_CAP_MASK;
|
||||||
info.hi_hpet = devp->hd_hpets->hp_which;
|
info.hi_hpet = devp->hd_hpets->hp_which;
|
||||||
|
|
Loading…
Add table
Reference in a new issue