From 03a3c6f16f59da2b159a9f8c370eb568877ac378 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Philippe=20Mathieu-Daud=C3=A9?= Date: Thu, 10 Sep 2020 09:23:24 +0200 Subject: hw/gpio/max7310: Remove impossible check MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit 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 Signed-off-by: Philippe Mathieu-Daudé Reviewed-by: Richard Henderson Message-Id: <20200910072325.439344-2-f4bug@amsat.org> Signed-off-by: Laurent Vivier --- hw/gpio/max7310.c | 5 +---- 1 file changed, 1 insertion(+), 4 deletions(-) (limited to 'hw') diff --git a/hw/gpio/max7310.c b/hw/gpio/max7310.c index 2888d07..de37589 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); -- cgit v1.1 From 0a7553725ed7ecda63a3463c49d7a86bfe871e58 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Philippe=20Mathieu-Daud=C3=A9?= Date: Thu, 10 Sep 2020 09:23:25 +0200 Subject: hw/ppc/ppc4xx_pci: Replace magic value by the PCI_NUM_PINS definition MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit Replace the magic '4' value by the PCI_NUM_PINS definition. Suggested-by: Cédric Le Goater Signed-off-by: Philippe Mathieu-Daudé Acked-by: David Gibson Reviewed-by: Richard Henderson Message-Id: <20200910072325.439344-3-f4bug@amsat.org> Signed-off-by: Laurent Vivier --- hw/ppc/ppc4xx_pci.c | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) (limited to 'hw') diff --git a/hw/ppc/ppc4xx_pci.c b/hw/ppc/ppc4xx_pci.c index c24bac9..ca2553b 100644 --- a/hw/ppc/ppc4xx_pci.c +++ b/hw/ppc/ppc4xx_pci.c @@ -56,7 +56,7 @@ struct PPC4xxPCIState { struct PCIMasterMap pmm[PPC4xx_PCI_NR_PMMS]; struct PCITargetMap ptm[PPC4xx_PCI_NR_PTMS]; - qemu_irq irq[4]; + qemu_irq irq[PCI_NUM_PINS]; MemoryRegion container; MemoryRegion iomem; -- cgit v1.1 From d6892f12a5c5ca258b85dfc4d210e7604b0e3dcf Mon Sep 17 00:00:00 2001 From: Dov Murik Date: Wed, 9 Sep 2020 08:36:49 +0000 Subject: hw/timer/hpet: Remove unused functions hpet_ram_readb, hpet_ram_readw MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit Fix compiler error about defined but not used functions when compiling with -DHPET_DEBUG by deleting the unused debug functions hpet_ram_readb and hpet_ram_readw. Signed-off-by: Dov Murik Reviewed-by: Philippe Mathieu-Daudé Message-Id: <20200909083650.46771-2-dovmurik@linux.vnet.ibm.com> Signed-off-by: Laurent Vivier --- hw/timer/hpet.c | 14 -------------- 1 file changed, 14 deletions(-) (limited to 'hw') diff --git a/hw/timer/hpet.c b/hw/timer/hpet.c index 44bbe3a..07ff82b 100644 --- a/hw/timer/hpet.c +++ b/hw/timer/hpet.c @@ -419,20 +419,6 @@ static void hpet_del_timer(HPETTimer *t) update_irq(t, 0); } -#ifdef HPET_DEBUG -static uint32_t hpet_ram_readb(void *opaque, hwaddr addr) -{ - printf("qemu: hpet_read b at %" PRIx64 "\n", addr); - return 0; -} - -static uint32_t hpet_ram_readw(void *opaque, hwaddr addr) -{ - printf("qemu: hpet_read w at %" PRIx64 "\n", addr); - return 0; -} -#endif - static uint64_t hpet_ram_read(void *opaque, hwaddr addr, unsigned size) { -- cgit v1.1 From 931c1d48e5e4a6c0a38476da49ed21ef6260fe45 Mon Sep 17 00:00:00 2001 From: Dov Murik Date: Wed, 9 Sep 2020 08:36:50 +0000 Subject: hw/timer/hpet: Fix debug format strings MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit Fix compiler errors when compiling with -DHPET_DEBUG due to mismatch between format string token "%x" and the argument type uint64_t. Also "%#x" is replaced by "0x%" PRIx64 according to the coding style. Signed-off-by: Dov Murik Reviewed-by: Philippe Mathieu-Daudé Message-Id: <20200909083650.46771-3-dovmurik@linux.vnet.ibm.com> Signed-off-by: Laurent Vivier --- hw/timer/hpet.c | 13 +++++++------ 1 file changed, 7 insertions(+), 6 deletions(-) (limited to 'hw') diff --git a/hw/timer/hpet.c b/hw/timer/hpet.c index 07ff82b..edaa5a0 100644 --- a/hw/timer/hpet.c +++ b/hw/timer/hpet.c @@ -498,7 +498,8 @@ static void hpet_ram_write(void *opaque, hwaddr addr, HPETState *s = opaque; uint64_t old_val, new_val, val, index; - DPRINTF("qemu: Enter hpet_ram_writel at %" PRIx64 " = %#x\n", addr, value); + DPRINTF("qemu: Enter hpet_ram_writel at %" PRIx64 " = 0x%" PRIx64 "\n", + addr, value); index = addr; old_val = hpet_ram_read(opaque, addr, 4); new_val = value; @@ -508,7 +509,7 @@ static void hpet_ram_write(void *opaque, hwaddr addr, uint8_t timer_id = (addr - 0x100) / 0x20; HPETTimer *timer = &s->timer[timer_id]; - DPRINTF("qemu: hpet_ram_writel timer_id = %#x\n", timer_id); + DPRINTF("qemu: hpet_ram_writel timer_id = 0x%x\n", timer_id); if (timer_id > s->num_timers) { DPRINTF("qemu: timer id out of range\n"); return; @@ -640,8 +641,8 @@ static void hpet_ram_write(void *opaque, hwaddr addr, } s->hpet_counter = (s->hpet_counter & 0xffffffff00000000ULL) | value; - DPRINTF("qemu: HPET counter written. ctr = %#x -> %" PRIx64 "\n", - value, s->hpet_counter); + DPRINTF("qemu: HPET counter written. ctr = 0x%" PRIx64 " -> " + "%" PRIx64 "\n", value, s->hpet_counter); break; case HPET_COUNTER + 4: if (hpet_enabled(s)) { @@ -649,8 +650,8 @@ static void hpet_ram_write(void *opaque, hwaddr addr, } s->hpet_counter = (s->hpet_counter & 0xffffffffULL) | (((uint64_t)value) << 32); - DPRINTF("qemu: HPET counter + 4 written. ctr = %#x -> %" PRIx64 "\n", - value, s->hpet_counter); + DPRINTF("qemu: HPET counter + 4 written. ctr = 0x%" PRIx64 " -> " + "%" PRIx64 "\n", value, s->hpet_counter); break; default: DPRINTF("qemu: invalid hpet_ram_writel\n"); -- cgit v1.1