Re: [PATCH v2 5/6] hpet: removing unused variable m in hpet_interrupt

From: Clemens Ladisch
Date: Mon Apr 03 2017 - 09:05:14 EST


Corentin Labbe wrote:
> This patch fix the following warning:
> drivers/char/hpet.c:146:17: attention : variable âmâ set but not used [-Wunused-but-set-variable]
> by removing the unused variable m in hpet_interrupt

This patch might silence the warning, but it leaves the bug that
actually caused the warning.

As far as I can see, the computation of "base" should use "m".

But the entire algorithm is completely bogus because it does not
actually remove the race condition; the counter is likely to have
advanced beyond the "mc" value when the new comparator value is
written. Also see arch/x86/kernel/hpet.c for how hpet_next_event()
handles this.

And why a non-periodic timer should generate periodic interrupts is
another question.

And nobody uses this crap.
So I'm really not sure what to do about this ...


Regards,
Clemens