[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]
Re: [PATCH 1/5] hw/gpio/max7310: Remove impossible check
From: |
Peter Maydell |
Subject: |
Re: [PATCH 1/5] hw/gpio/max7310: Remove impossible check |
Date: |
Tue, 1 Sep 2020 11:42:53 +0100 |
On Tue, 1 Sep 2020 at 11:40, Philippe Mathieu-Daudé <f4bug@amsat.org> wrote:
>
> The max7310_gpio_set() handler is static and only used by
> qdev_init_gpio_in, initialized with 8 IRQs. The 'line'
> argument can not be out of the [0-8[ range.
> Remove the dead code.
>
> Signed-off-by: Philippe Mathieu-Daudé <f4bug@amsat.org>
> ---
> hw/gpio/max7310.c | 4 ----
> 1 file changed, 4 deletions(-)
>
> diff --git a/hw/gpio/max7310.c b/hw/gpio/max7310.c
> index bebb4030d27..7f5de189acf 100644
> --- a/hw/gpio/max7310.c
> +++ b/hw/gpio/max7310.c
> @@ -8,9 +8,7 @@
> */
>
> #include "qemu/osdep.h"
> -#include "hw/hw.h"
> #include "hw/i2c/i2c.h"
> -#include "hw/hw.h"
> #include "hw/irq.h"
> #include "migration/vmstate.h"
> #include "qemu/module.h"
> @@ -176,8 +174,6 @@ static const VMStateDescription vmstate_max7310 = {
> static void max7310_gpio_set(void *opaque, int line, int level)
> {
> MAX7310State *s = (MAX7310State *) opaque;
> - if (line >= ARRAY_SIZE(s->handler) || line < 0)
> - hw_error("bad GPIO line");
I think it would be reasonable to retain this one as an assert.
-- PMM