diff options
Diffstat (limited to 'kernel')
-rw-r--r-- | kernel/time/clockevents.c | 13 |
1 files changed, 13 insertions, 0 deletions
diff --git a/kernel/time/clockevents.c b/kernel/time/clockevents.c index 5fb139fef9fa..3e59fce6dd43 100644 --- a/kernel/time/clockevents.c +++ b/kernel/time/clockevents.c | |||
@@ -41,6 +41,11 @@ unsigned long clockevent_delta2ns(unsigned long latch, | |||
41 | { | 41 | { |
42 | u64 clc = ((u64) latch << evt->shift); | 42 | u64 clc = ((u64) latch << evt->shift); |
43 | 43 | ||
44 | if (unlikely(!evt->mult)) { | ||
45 | evt->mult = 1; | ||
46 | WARN_ON(1); | ||
47 | } | ||
48 | |||
44 | do_div(clc, evt->mult); | 49 | do_div(clc, evt->mult); |
45 | if (clc < 1000) | 50 | if (clc < 1000) |
46 | clc = 1000; | 51 | clc = 1000; |
@@ -151,6 +156,14 @@ static void clockevents_notify_released(void) | |||
151 | void clockevents_register_device(struct clock_event_device *dev) | 156 | void clockevents_register_device(struct clock_event_device *dev) |
152 | { | 157 | { |
153 | BUG_ON(dev->mode != CLOCK_EVT_MODE_UNUSED); | 158 | BUG_ON(dev->mode != CLOCK_EVT_MODE_UNUSED); |
159 | /* | ||
160 | * A nsec2cyc multiplicator of 0 is invalid and we'd crash | ||
161 | * on it, so fix it up and emit a warning: | ||
162 | */ | ||
163 | if (unlikely(!dev->mult)) { | ||
164 | dev->mult = 1; | ||
165 | WARN_ON(1); | ||
166 | } | ||
154 | 167 | ||
155 | spin_lock(&clockevents_lock); | 168 | spin_lock(&clockevents_lock); |
156 | 169 | ||