All of lore.kernel.org
 help / color / mirror / Atom feed
From: Peter Maydell <peter.maydell@linaro.org>
To: qemu-devel@nongnu.org
Cc: "Philippe Mathieu-Daudé" <philmd@redhat.com>,
	"KONRAD Frederic" <frederic.konrad@adacore.com>,
	"Richard Henderson" <richard.henderson@linaro.org>,
	"Mark Cave-Ayland" <mark.cave-ayland@ilande.co.uk>,
	"Fabien Chouteau" <chouteau@adacore.com>
Subject: [PATCH v2 1/3] hw/timer/slavio_timer: Remove useless check for NULL t->timer
Date: Mon, 21 Oct 2019 14:43:55 +0100	[thread overview]
Message-ID: <20191021134357.14266-2-peter.maydell@linaro.org> (raw)
In-Reply-To: <20191021134357.14266-1-peter.maydell@linaro.org>

In the slavio timer devcie, 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 <peter.maydell@linaro.org>
---
 hw/timer/slavio_timer.c | 12 +++++-------
 1 file changed, 5 insertions(+), 7 deletions(-)

diff --git a/hw/timer/slavio_timer.c b/hw/timer/slavio_timer.c
index 692d213897d..890dd53f8d8 100644
--- a/hw/timer/slavio_timer.c
+++ b/hw/timer/slavio_timer.c
@@ -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;
-- 
2.20.1



  reply	other threads:[~2019-10-21 13:48 UTC|newest]

Thread overview: 11+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2019-10-21 13:43 [PATCH v2 0/3] Convert sparc devices to new ptimer API Peter Maydell
2019-10-21 13:43 ` Peter Maydell [this message]
2019-10-21 14:03   ` [PATCH v2 1/3] hw/timer/slavio_timer: Remove useless check for NULL t->timer Philippe Mathieu-Daudé
2019-10-21 16:24   ` Richard Henderson
2019-10-21 13:43 ` [PATCH v2 2/3] hw/timer/grlib_gptimer.c: Switch to transaction-based ptimer API Peter Maydell
2019-10-21 13:43 ` [PATCH v2 3/3] hw/timer/slavio_timer.c: " Peter Maydell
2019-10-21 14:06 ` [PATCH v2 0/3] Convert sparc devices to new " Philippe Mathieu-Daudé
2019-10-24 12:19 ` Peter Maydell
2019-10-24 18:04   ` Mark Cave-Ayland
2019-10-24 18:17     ` Philippe Mathieu-Daudé
2019-10-25  7:32     ` Peter Maydell

Reply instructions:

You may reply publicly to this message via plain-text email
using any one of the following methods:

* Save the following mbox file, import it into your mail client,
  and reply-to-all from there: mbox

  Avoid top-posting and favor interleaved quoting:
  https://en.wikipedia.org/wiki/Posting_style#Interleaved_style

* Reply using the --to, --cc, and --in-reply-to
  switches of git-send-email(1):

  git send-email \
    --in-reply-to=20191021134357.14266-2-peter.maydell@linaro.org \
    --to=peter.maydell@linaro.org \
    --cc=chouteau@adacore.com \
    --cc=frederic.konrad@adacore.com \
    --cc=mark.cave-ayland@ilande.co.uk \
    --cc=philmd@redhat.com \
    --cc=qemu-devel@nongnu.org \
    --cc=richard.henderson@linaro.org \
    /path/to/YOUR_REPLY

  https://kernel.org/pub/software/scm/git/docs/git-send-email.html

* If your mail client supports setting the In-Reply-To header
  via mailto: links, try the mailto: link
Be sure your reply has a Subject: header at the top and a blank line before the message body.
This is an external index of several public inboxes,
see mirroring instructions on how to clone and mirror
all data and code used by this external index.