[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]
[PULL 01/17] hw/gpio/max7310: Remove impossible check
From: |
Laurent Vivier |
Subject: |
[PULL 01/17] hw/gpio/max7310: Remove impossible check |
Date: |
Sat, 19 Sep 2020 20:44:35 +0200 |
From: Philippe Mathieu-Daudé <f4bug@amsat.org>
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>
---
hw/gpio/max7310.c | 5 +----
1 file changed, 1 insertion(+), 4 deletions(-)
diff --git a/hw/gpio/max7310.c b/hw/gpio/max7310.c
index 2888d071ac6b..de375892ef11 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);
--
2.26.2
- [PULL 00/17] Trivial branch for 5.2 patches, Laurent Vivier, 2020/09/19
- [PULL 03/17] ui/spice-input: Remove superfluous forward declaration, Laurent Vivier, 2020/09/19
- [PULL 02/17] hw/ppc/ppc4xx_pci: Replace magic value by the PCI_NUM_PINS definition, Laurent Vivier, 2020/09/19
- [PULL 01/17] hw/gpio/max7310: Remove impossible check,
Laurent Vivier <=
- [PULL 04/17] manual: escape backslashes in "parsed-literal" blocks, Laurent Vivier, 2020/09/19
- [PULL 05/17] meson: remove empty else and duplicated gio deps, Laurent Vivier, 2020/09/19
- [PULL 06/17] hw/timer/hpet: Remove unused functions hpet_ram_readb, hpet_ram_readw, Laurent Vivier, 2020/09/19
- [PULL 08/17] scripts/git.orderfile: Display meson files along with buildsys ones, Laurent Vivier, 2020/09/19
- [PULL 07/17] hw/timer/hpet: Fix debug format strings, Laurent Vivier, 2020/09/19
- [PULL 09/17] qemu/: fix some comment spelling errors, Laurent Vivier, 2020/09/19
- [PULL 13/17] util/: fix some comment spelling errors, Laurent Vivier, 2020/09/19
- [PULL 16/17] qapi/: fix some comment spelling errors, Laurent Vivier, 2020/09/19
- [PULL 12/17] scripts/: fix some comment spelling errors, Laurent Vivier, 2020/09/19
- [PULL 15/17] disas/: fix some comment spelling errors, Laurent Vivier, 2020/09/19