From: Dmitry Osipenko <digetx@gmail.com>
Date: Thu, 22 Sep 2016 17:13:06 +0000 (+0100)
Subject: hw/ptimer: Actually stop the timer in case of error
X-Git-Tag: v2.8.0-rc0~123^2~20
X-Git-Url: https://www.infradead.org/git/?a=commitdiff_plain;h=780d23e54e4a62c1bc37641b72e0188b6d13e861;p=users%2Fdwmw2%2Fqemu.git

hw/ptimer: Actually stop the timer in case of error

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>
Message-id: 1e9bae4fae3c36430d7c28b0f486a0c71aff7eb3.1473252818.git.digetx@gmail.com
Reviewed-by: Peter Maydell <peter.maydell@linaro.org>
Signed-off-by: Peter Maydell <peter.maydell@linaro.org>
---

diff --git a/hw/core/ptimer.c b/hw/core/ptimer.c
index 30829ee97b..02c313542d 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;
     }