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

On 10/21/19 3:43 PM, Peter Maydell wrote:
> In the slavio timer devcie, the ptimer TimerContext::timer is

typo "device"

> 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>

Reviewed-by: Philippe Mathieu-Daudé <philmd@redhat.com>

> ---
>   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;
> 



  reply	other threads:[~2019-10-21 14:05 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 ` [PATCH v2 1/3] hw/timer/slavio_timer: Remove useless check for NULL t->timer Peter Maydell
2019-10-21 14:03   ` Philippe Mathieu-Daudé [this message]
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=17865d60-9d78-e876-90c3-f8f7363f689c@redhat.com \
    --to=philmd@redhat.com \
    --cc=chouteau@adacore.com \
    --cc=frederic.konrad@adacore.com \
    --cc=mark.cave-ayland@ilande.co.uk \
    --cc=peter.maydell@linaro.org \
    --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.