diff mbox

[v15,03/15] hw/ptimer: Actually stop timer in case of error

Message ID ffcb377ed7793be91586692755f37aea81f66a0d.1469110137.git.digetx@gmail.com (mailing list archive)
State New, archived
Headers show

Commit Message

Dmitry Osipenko July 21, 2016, 2:31 p.m. UTC
Running with counter / period = 0 is treated as a error case, printing error
message claiming that timer has been disabled. However, timer is only marked
as disabled, keeping to tick till expired and triggering after being claimed
as disabled. Stop the QEMU timer to avoid confusion.

Signed-off-by: Dmitry Osipenko <digetx@gmail.com>
---
 hw/core/ptimer.c | 1 +
 1 file changed, 1 insertion(+)
diff mbox

Patch

diff --git a/hw/core/ptimer.c b/hw/core/ptimer.c
index 461b91c..1dd2d32 100644
--- a/hw/core/ptimer.c
+++ b/hw/core/ptimer.c
@@ -44,6 +44,7 @@  static void ptimer_reload(ptimer_state *s)
     }
     if (s->delta == 0 || s->period == 0) {
         fprintf(stderr, "Timer with period zero, disabling\n");
+        timer_del(s->timer);
         s->enabled = 0;
         return;
     }