From 7f5b7d3e2c19c0aa52dcac0a10d473c7fd142450 Mon Sep 17 00:00:00 2001 From: Blue Swirl Date: Sun, 25 Apr 2010 18:58:25 +0000 Subject: [PATCH] x86: remove dead assignments, spotted by clang analyzer Value stored is never read. Signed-off-by: Blue Swirl --- hw/acpi.c | 5 ++--- hw/i8259.c | 2 ++ hw/parallel.c | 7 +++---- hw/pc.c | 6 ++---- hw/pci-hotplug.c | 3 +-- hw/vga.c | 9 ++++++--- target-i386/translate.c | 4 +--- 7 files changed, 17 insertions(+), 19 deletions(-) diff --git a/hw/acpi.c b/hw/acpi.c index 5c01c2e3bf..e3b63b724a 100644 --- a/hw/acpi.c +++ b/hw/acpi.c @@ -88,8 +88,7 @@ static uint32_t get_pmtmr(PIIX4PMState *s) static int get_pmsts(PIIX4PMState *s) { int64_t d; - int pmsts; - pmsts = s->pmsts; + d = muldiv64(qemu_get_clock(vm_clock), PM_FREQ, get_ticks_per_sec()); if (d >= s->tmr_overflow_time) s->pmsts |= TMROF_EN; @@ -206,8 +205,8 @@ static uint32_t pm_ioport_readw(void *opaque, uint32_t addr) static void pm_ioport_writel(void *opaque, uint32_t addr, uint32_t val) { // PIIX4PMState *s = opaque; - addr &= 0x3f; #ifdef DEBUG + addr &= 0x3f; printf("PM writel port=0x%04x val=0x%08x\n", addr, val); #endif } diff --git a/hw/i8259.c b/hw/i8259.c index 37ef04e519..ea48e0e045 100644 --- a/hw/i8259.c +++ b/hw/i8259.c @@ -234,7 +234,9 @@ int pic_read_irq(PicState2 *s) irq2 = 7; } intno = s->pics[1].irq_base + irq2; +#if defined(DEBUG_PIC) || defined(DEBUG_IRQ_LATENCY) irq = irq2 + 8; +#endif } else { intno = s->pics[0].irq_base + irq; } diff --git a/hw/parallel.c b/hw/parallel.c index 12693d40d2..be8e2d5479 100644 --- a/hw/parallel.c +++ b/hw/parallel.c @@ -414,15 +414,14 @@ parallel_ioport_eppdata_read_hw4(void *opaque, uint32_t addr) static void parallel_ioport_ecp_write(void *opaque, uint32_t addr, uint32_t val) { - addr &= 7; - pdebug("wecp%d=%02x\n", addr, val); + pdebug("wecp%d=%02x\n", addr & 7, val); } static uint32_t parallel_ioport_ecp_read(void *opaque, uint32_t addr) { uint8_t ret = 0xff; - addr &= 7; - pdebug("recp%d:%02x\n", addr, ret); + + pdebug("recp%d:%02x\n", addr & 7, ret); return ret; } diff --git a/hw/pc.c b/hw/pc.c index b797f218f7..b659344154 100644 --- a/hw/pc.c +++ b/hw/pc.c @@ -813,9 +813,7 @@ static void pc_init1(ram_addr_t ram_size, ram_addr_t below_4g_mem_size, above_4g_mem_size = 0; int bios_size, isa_bios_size; PCIBus *pci_bus; - ISADevice *isa_dev; int piix3_devfn = -1; - CPUState *env; qemu_irq *cpu_irq; qemu_irq *isa_irq; qemu_irq *i8259; @@ -845,7 +843,7 @@ static void pc_init1(ram_addr_t ram_size, } for (i = 0; i < smp_cpus; i++) { - env = pc_new_cpu(cpu_model); + pc_new_cpu(cpu_model); } vmport_init(); @@ -1014,7 +1012,7 @@ static void pc_init1(ram_addr_t ram_size, } } - isa_dev = isa_create_simple("i8042"); + isa_create_simple("i8042"); DMA_init(0); #ifdef HAS_AUDIO audio_init(pci_enabled ? pci_bus : NULL, isa_irq); diff --git a/hw/pci-hotplug.c b/hw/pci-hotplug.c index 343fd17031..cc45c504ad 100644 --- a/hw/pci-hotplug.c +++ b/hw/pci-hotplug.c @@ -105,7 +105,7 @@ void drive_hot_add(Monitor *mon, const QDict *qdict) { int dom, pci_bus; unsigned slot; - int type, bus; + int type; PCIDevice *dev; DriveInfo *dinfo = NULL; const char *pci_addr = qdict_get_str(qdict, "pci_addr"); @@ -119,7 +119,6 @@ void drive_hot_add(Monitor *mon, const QDict *qdict) goto err; } type = dinfo->type; - bus = drive_get_max_bus (type); switch (type) { case IF_SCSI: diff --git a/hw/vga.c b/hw/vga.c index bb65677e89..845dbcc3ba 100644 --- a/hw/vga.c +++ b/hw/vga.c @@ -169,7 +169,10 @@ static void vga_precise_update_retrace_info(VGACommonState *s) int vretr_start_line; int vretr_end_line; - int div2, sldiv2, dots; + int dots; +#if 0 + int div2, sldiv2; +#endif int clocking_mode; int clock_sel; const int clk_hz[] = {25175000, 28322000, 25175000, 25175000}; @@ -190,8 +193,6 @@ static void vga_precise_update_retrace_info(VGACommonState *s) vretr_end_line = s->cr[0x11] & 0xf; - div2 = (s->cr[0x17] >> 2) & 1; - sldiv2 = (s->cr[0x17] >> 3) & 1; clocking_mode = (s->sr[0x01] >> 3) & 1; clock_sel = (s->msr >> 2) & 3; @@ -216,6 +217,8 @@ static void vga_precise_update_retrace_info(VGACommonState *s) r->htotal = htotal_chars; #if 0 + div2 = (s->cr[0x17] >> 2) & 1; + sldiv2 = (s->cr[0x17] >> 3) & 1; printf ( "hz=%f\n" "htotal = %d\n" diff --git a/target-i386/translate.c b/target-i386/translate.c index 307aabdd30..6311b6865c 100644 --- a/target-i386/translate.c +++ b/target-i386/translate.c @@ -763,7 +763,6 @@ static void gen_check_io(DisasContext *s, int ot, target_ulong cur_eip, if (s->cc_op != CC_OP_DYNAMIC) gen_op_set_cc_op(s->cc_op); gen_jmp_im(cur_eip); - state_saved = 1; } svm_flags |= (1 << (4 + ot)); next_eip = s->pc - s->cs_base; @@ -7744,7 +7743,7 @@ static inline void gen_intermediate_code_internal(CPUState *env, target_ulong pc_ptr; uint16_t *gen_opc_end; CPUBreakpoint *bp; - int j, lj, cflags; + int j, lj; uint64_t flags; target_ulong pc_start; target_ulong cs_base; @@ -7755,7 +7754,6 @@ static inline void gen_intermediate_code_internal(CPUState *env, pc_start = tb->pc; cs_base = tb->cs_base; flags = tb->flags; - cflags = tb->cflags; dc->pe = (flags >> HF_PE_SHIFT) & 1; dc->code32 = (flags >> HF_CS32_SHIFT) & 1;