static void sample_timer(struct timer_list *t)
 {
        struct pwm_fan_ctx *ctx = from_timer(ctx, t, rpm_timer);
+       unsigned int delta = ktime_ms_delta(ktime_get(), ctx->sample_start);
        int pulses;
-       u64 tmp;
 
-       pulses = atomic_read(&ctx->pulses);
-       atomic_sub(pulses, &ctx->pulses);
-       tmp = (u64)pulses * ktime_ms_delta(ktime_get(), ctx->sample_start) * 60;
-       do_div(tmp, ctx->pulses_per_revolution * 1000);
-       ctx->rpm = tmp;
+       if (delta) {
+               pulses = atomic_read(&ctx->pulses);
+               atomic_sub(pulses, &ctx->pulses);
+               ctx->rpm = (unsigned int)(pulses * 1000 * 60) /
+                       (ctx->pulses_per_revolution * delta);
+
+               ctx->sample_start = ktime_get();
+       }
 
-       ctx->sample_start = ktime_get();
        mod_timer(&ctx->rpm_timer, jiffies + HZ);
 }