aboutsummaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorPhilippe Mathieu-Daudé <f4bug@amsat.org>2020-09-10 09:23:24 +0200
committerLaurent Vivier <laurent@vivier.eu>2020-09-16 10:43:48 +0200
commit03a3c6f16f59da2b159a9f8c370eb568877ac378 (patch)
tree423a472837c7c8b43a1569353149d95df874b7b3
parentde39a045bd8d2b49e4f3d07976622c29d58e0bac (diff)
hw/gpio/max7310: Remove impossible check
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. Replace the dead code by an assertion. Suggested-by: Peter Maydell <peter.maydell@linaro.org> Signed-off-by: Philippe Mathieu-Daudé <f4bug@amsat.org> Reviewed-by: Richard Henderson <richard.henderson@linaro.org> Message-Id: <20200910072325.439344-2-f4bug@amsat.org> Signed-off-by: Laurent Vivier <laurent@vivier.eu>
-rw-r--r--hw/gpio/max7310.c5
1 files changed, 1 insertions, 4 deletions
diff --git a/hw/gpio/max7310.c b/hw/gpio/max7310.c
index 2888d071ac..de375892ef 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/log.h"
@@ -175,8 +173,7 @@ 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");
+ assert(line >= 0 && line < ARRAY_SIZE(s->handler));
if (level)
s->level |= s->direction & (1 << line);