]> Git Repo - qemu.git/commitdiff
hw/gpio/max7310: Remove impossible check
authorPhilippe Mathieu-Daudé <[email protected]>
Thu, 10 Sep 2020 07:23:24 +0000 (09:23 +0200)
committerLaurent Vivier <[email protected]>
Wed, 16 Sep 2020 08:43:48 +0000 (10:43 +0200)
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 <[email protected]>
Signed-off-by: Philippe Mathieu-Daudé <[email protected]>
Reviewed-by: Richard Henderson <[email protected]>
Message-Id: <20200910072325[email protected]>
Signed-off-by: Laurent Vivier <[email protected]>
hw/gpio/max7310.c

index 2888d071ac6b39ec24c8f562e34fba4b94c9fb17..de375892ef111362002a2f185e073182c96d6a0d 100644 (file)
@@ -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);
This page took 0.028977 seconds and 4 git commands to generate.