Patchwork hw/pl061: Remove pointless comparison of array to null

login
register
mail settings
Submitter Peter Maydell
Date Nov. 9, 2011, 8:04 p.m.
Message ID <1320869094-10215-1-git-send-email-peter.maydell@linaro.org>
Download mbox | patch
Permalink /patch/124693/
State New
Headers show

Comments

Peter Maydell - Nov. 9, 2011, 8:04 p.m.
Remove a pointless comparison of an array to null. (There is
no need to check whether s->out[i] is non-null as qemu_set_irq
will do that for us.) Spotted by Coverity (see bug 887883).

Signed-off-by: Peter Maydell <peter.maydell@linaro.org>
---
 hw/pl061.c |    2 +-
 1 files changed, 1 insertions(+), 1 deletions(-)
Anthony Liguori - Nov. 11, 2011, 7:45 p.m.
On 11/09/2011 02:04 PM, Peter Maydell wrote:
> Remove a pointless comparison of an array to null. (There is
> no need to check whether s->out[i] is non-null as qemu_set_irq
> will do that for us.) Spotted by Coverity (see bug 887883).
>
> Signed-off-by: Peter Maydell<peter.maydell@linaro.org>

Applied.  Thanks.

Regards,

Anthony Liguori

> ---
>   hw/pl061.c |    2 +-
>   1 files changed, 1 insertions(+), 1 deletions(-)
>
> diff --git a/hw/pl061.c b/hw/pl061.c
> index d13746c..cf5adbe 100644
> --- a/hw/pl061.c
> +++ b/hw/pl061.c
> @@ -103,7 +103,7 @@ static void pl061_update(pl061_state *s)
>       s->old_data = out;
>       for (i = 0; i<  8; i++) {
>           mask = 1<<  i;
> -        if ((changed&  mask)&&  s->out) {
> +        if (changed&  mask) {
>               DPRINTF("Set output %d = %d\n", i, (out&  mask) != 0);
>               qemu_set_irq(s->out[i], (out&  mask) != 0);
>           }

Patch

diff --git a/hw/pl061.c b/hw/pl061.c
index d13746c..cf5adbe 100644
--- a/hw/pl061.c
+++ b/hw/pl061.c
@@ -103,7 +103,7 @@  static void pl061_update(pl061_state *s)
     s->old_data = out;
     for (i = 0; i < 8; i++) {
         mask = 1 << i;
-        if ((changed & mask) && s->out) {
+        if (changed & mask) {
             DPRINTF("Set output %d = %d\n", i, (out & mask) != 0);
             qemu_set_irq(s->out[i], (out & mask) != 0);
         }