]> Git Repo - qemu.git/commitdiff
hw/timer/slavio_timer: Remove useless check for NULL t->timer
authorPeter Maydell <[email protected]>
Mon, 21 Oct 2019 13:43:55 +0000 (14:43 +0100)
committerPeter Maydell <[email protected]>
Thu, 24 Oct 2019 16:16:29 +0000 (17:16 +0100)
In the slavio timer device, the ptimer TimerContext::timer is
always created by slavio_timer_init(), so there's no need to
check it for NULL; remove the single unneeded NULL check.

This will be useful to avoid compiler/Coverity errors when
a subsequent change adds a use of t->timer before the location
we currently do the NULL check.

Signed-off-by: Peter Maydell <[email protected]>
Reviewed-by: Philippe Mathieu-Daudé <[email protected]>
Reviewed-by: Richard Henderson <[email protected]>
Message-id: 20191021134357[email protected]
Signed-off-by: Peter Maydell <[email protected]>
hw/timer/slavio_timer.c

index 692d213897deab1e7b02002965aa04550e784643..890dd53f8d8914b6db6a17adb81bf0f720ea5252 100644 (file)
@@ -227,13 +227,11 @@ static void slavio_timer_mem_writel(void *opaque, hwaddr addr,
             // set limit, reset counter
             qemu_irq_lower(t->irq);
             t->limit = val & TIMER_MAX_COUNT32;
-            if (t->timer) {
-                if (t->limit == 0) { /* free-run */
-                    ptimer_set_limit(t->timer,
-                                     LIMIT_TO_PERIODS(TIMER_MAX_COUNT32), 1);
-                } else {
-                    ptimer_set_limit(t->timer, LIMIT_TO_PERIODS(t->limit), 1);
-                }
+            if (t->limit == 0) { /* free-run */
+                ptimer_set_limit(t->timer,
+                                 LIMIT_TO_PERIODS(TIMER_MAX_COUNT32), 1);
+            } else {
+                ptimer_set_limit(t->timer, LIMIT_TO_PERIODS(t->limit), 1);
             }
         }
         break;
This page took 0.027034 seconds and 4 git commands to generate.