aboutsummaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorPeter Maydell <peter.maydell@linaro.org>2014-06-10 17:16:03 +0100
committerPeter Maydell <peter.maydell@linaro.org>2014-06-10 17:16:03 +0100
commitb780bf8eff43fc49b071795292dea5d05990fff3 (patch)
tree7186ab9b901ab1d7e67a2097d8825c1691aba478
parent3334e929ae2d01e47c3e64757ee7fcf975cede94 (diff)
parent1a2858995d283ddad4a745460d1cc770a9b93fc1 (diff)
Merge remote-tracking branch 'remotes/mjt/tags/trivial-patches-2014-06-10' into staging
trivial patches for 2014-06-10 # gpg: Signature made Tue 10 Jun 2014 17:07:19 BST using RSA key ID A4C3D7DB # gpg: Good signature from "Michael Tokarev <mjt@tls.msk.ru>" # gpg: aka "Michael Tokarev <mjt@corpit.ru>" # gpg: aka "Michael Tokarev <mjt@debian.org>" # gpg: WARNING: This key is not certified with a trusted signature! # gpg: There is no indication that the signature belongs to the owner. # Primary key fingerprint: 6EE1 95D1 886E 8FFB 810D 4324 457C E0A0 8044 65C5 # Subkey fingerprint: 6F67 E18E 7C91 C5B1 5514 66A7 BEE5 9D74 A4C3 D7DB * remotes/mjt/tags/trivial-patches-2014-06-10: (25 commits) virtio.c: fix error message hw: vmware_vga: don't return cursorx when the driver asks for cursory register migration: Plug memory leak in migrate-set-cache-size command libcacard: Clean up dead stores before g_free() libcacard: Drop superfluous conditionals around g_free() cpu/x86: correctly set errors in x86_cpu_parse_featurestr smbios: use g_free directly on NULL pointers vdi: remove double conversion apb: Fix compiler warnings (large constants) hw/net/ne2000-isa: Register vmstate struct target-microblaze: Delete unused sign_extend() function hw/misc/milkymist-softusb: Remove unused softusb_{read, write}_pmem() target-i386/translate.c: Remove unused tcg_gen_lshift() hw/isa/pc87312: Remove unused function is_parallel_epp() hw/intc/openpic: Remove unused function IRQ_testbit() hw/dma/xilinx_axidma: Remove unused stream_halted() function util/qemu-sockets.c: Avoid unused variable warnings hw/sd/sd.c: Drop unused sd_acmd_type[] array hw/i386/pc.c: Remove unused parallel_io and parallel_irq variables slirp: Remove unused zero_ethaddr[] variable ... Signed-off-by: Peter Maydell <peter.maydell@linaro.org>
-rw-r--r--arch_init.c1
-rw-r--r--block/vdi.c1
-rw-r--r--hw/display/vmware_vga.c2
-rw-r--r--hw/dma/xilinx_axidma.c5
-rw-r--r--hw/i386/pc.c3
-rw-r--r--hw/i386/smbios.c9
-rw-r--r--hw/input/milkymist-softusb.c25
-rw-r--r--hw/intc/openpic.c5
-rw-r--r--hw/isa/pc87312.c5
-rw-r--r--hw/net/cadence_gem.c31
-rw-r--r--hw/net/ne2000-isa.c1
-rw-r--r--hw/pci-host/apb.c4
-rw-r--r--hw/sd/sd.c11
-rw-r--r--hw/virtio/virtio.c2
-rw-r--r--libcacard/cac.c14
-rw-r--r--libcacard/card_7816.c12
-rw-r--r--libcacard/vcard.c12
-rw-r--r--libcacard/vcard_emul_nss.c4
-rw-r--r--libcacard/vreader.c6
-rw-r--r--page_cache.c1
-rw-r--r--qtest.c2
-rw-r--r--slirp/slirp.c2
-rw-r--r--target-i386/cpu.c17
-rw-r--r--target-i386/translate.c8
-rw-r--r--target-microblaze/translate.c13
-rw-r--r--util/qemu-sockets.c3
26 files changed, 46 insertions, 153 deletions
diff --git a/arch_init.c b/arch_init.c
index 9f1a174d3a..23044c1d12 100644
--- a/arch_init.c
+++ b/arch_init.c
@@ -739,7 +739,6 @@ static void migration_end(void)
XBZRLE_cache_lock();
if (XBZRLE.cache) {
cache_fini(XBZRLE.cache);
- g_free(XBZRLE.cache);
g_free(XBZRLE.encoded_buf);
g_free(XBZRLE.current_buf);
XBZRLE.cache = NULL;
diff --git a/block/vdi.c b/block/vdi.c
index 27737af555..1b2be1af7b 100644
--- a/block/vdi.c
+++ b/block/vdi.c
@@ -239,7 +239,6 @@ static void vdi_header_to_le(VdiHeader *header)
cpu_to_le32s(&header->block_extra);
cpu_to_le32s(&header->blocks_in_image);
cpu_to_le32s(&header->blocks_allocated);
- cpu_to_le32s(&header->blocks_allocated);
uuid_convert(header->uuid_image);
uuid_convert(header->uuid_last_snap);
uuid_convert(header->uuid_link);
diff --git a/hw/display/vmware_vga.c b/hw/display/vmware_vga.c
index 9ba47e6c63..ab54b6fc58 100644
--- a/hw/display/vmware_vga.c
+++ b/hw/display/vmware_vga.c
@@ -863,7 +863,7 @@ static uint32_t vmsvga_value_read(void *opaque, uint32_t address)
break;
case SVGA_REG_CURSOR_Y:
- ret = s->cursor.x;
+ ret = s->cursor.y;
break;
case SVGA_REG_CURSOR_ON:
diff --git a/hw/dma/xilinx_axidma.c b/hw/dma/xilinx_axidma.c
index cc90eb5110..ee60d3ff39 100644
--- a/hw/dma/xilinx_axidma.c
+++ b/hw/dma/xilinx_axidma.c
@@ -157,11 +157,6 @@ static inline int stream_running(struct Stream *s)
return s->regs[R_DMACR] & DMACR_RUNSTOP;
}
-static inline int stream_halted(struct Stream *s)
-{
- return s->regs[R_DMASR] & DMASR_HALTED;
-}
-
static inline int stream_idle(struct Stream *s)
{
return !!(s->regs[R_DMASR] & DMASR_IDLE);
diff --git a/hw/i386/pc.c b/hw/i386/pc.c
index e6369d5be6..32d163288c 100644
--- a/hw/i386/pc.c
+++ b/hw/i386/pc.c
@@ -922,9 +922,6 @@ static const int ne2000_io[NE2000_NB_MAX] = { 0x300, 0x320, 0x340, 0x360,
0x280, 0x380 };
static const int ne2000_irq[NE2000_NB_MAX] = { 9, 10, 11, 3, 4, 5 };
-static const int parallel_io[MAX_PARALLEL_PORTS] = { 0x378, 0x278, 0x3bc };
-static const int parallel_irq[MAX_PARALLEL_PORTS] = { 7, 7, 7 };
-
void pc_init_ne2k_isa(ISABus *bus, NICInfo *nd)
{
static int nb_ne2k = 0;
diff --git a/hw/i386/smbios.c b/hw/i386/smbios.c
index b3bedde8b9..e3fa1b2fc1 100644
--- a/hw/i386/smbios.c
+++ b/hw/i386/smbios.c
@@ -745,11 +745,6 @@ void smbios_set_cpuid(uint32_t version, uint32_t features)
field = value; \
}
-#define G_FREE_UNLESS_NULL(ptr) \
- if (ptr != NULL) { \
- g_free(ptr); \
- }
-
void smbios_set_defaults(const char *manufacturer, const char *product,
const char *version, bool legacy_mode)
{
@@ -758,7 +753,7 @@ void smbios_set_defaults(const char *manufacturer, const char *product,
/* drop unwanted version of command-line file blob(s) */
if (smbios_legacy) {
- G_FREE_UNLESS_NULL(smbios_tables);
+ g_free(smbios_tables);
/* in legacy mode, also complain if fields were given for types > 1 */
if (find_next_bit(have_fields_bitmap,
SMBIOS_MAX_TYPE+1, 2) < SMBIOS_MAX_TYPE+1) {
@@ -767,7 +762,7 @@ void smbios_set_defaults(const char *manufacturer, const char *product,
exit(1);
}
} else {
- G_FREE_UNLESS_NULL(smbios_entries);
+ g_free(smbios_entries);
}
SMBIOS_SET_DEFAULT(type1.manufacturer, manufacturer);
diff --git a/hw/input/milkymist-softusb.c b/hw/input/milkymist-softusb.c
index 53ba71410d..1b4b8d441a 100644
--- a/hw/input/milkymist-softusb.c
+++ b/hw/input/milkymist-softusb.c
@@ -156,31 +156,6 @@ static inline void softusb_write_dmem(MilkymistSoftUsbState *s,
memcpy(s->dmem_ptr + offset, buf, len);
}
-static inline void softusb_read_pmem(MilkymistSoftUsbState *s,
- uint32_t offset, uint8_t *buf, uint32_t len)
-{
- if (offset + len >= s->pmem_size) {
- error_report("milkymist_softusb: read pmem out of bounds "
- "at offset 0x%x, len %d", offset, len);
- memset(buf, 0, len);
- return;
- }
-
- memcpy(buf, s->pmem_ptr + offset, len);
-}
-
-static inline void softusb_write_pmem(MilkymistSoftUsbState *s,
- uint32_t offset, uint8_t *buf, uint32_t len)
-{
- if (offset + len >= s->pmem_size) {
- error_report("milkymist_softusb: write pmem out of bounds "
- "at offset 0x%x, len %d", offset, len);
- return;
- }
-
- memcpy(s->pmem_ptr + offset, buf, len);
-}
-
static void softusb_mouse_changed(MilkymistSoftUsbState *s)
{
uint8_t m;
diff --git a/hw/intc/openpic.c b/hw/intc/openpic.c
index 17136c9333..08e0e19c59 100644
--- a/hw/intc/openpic.c
+++ b/hw/intc/openpic.c
@@ -311,11 +311,6 @@ static inline void IRQ_resetbit(IRQQueue *q, int n_IRQ)
clear_bit(n_IRQ, q->queue);
}
-static inline int IRQ_testbit(IRQQueue *q, int n_IRQ)
-{
- return test_bit(n_IRQ, q->queue);
-}
-
static void IRQ_check(OpenPICState *opp, IRQQueue *q)
{
int irq = -1;
diff --git a/hw/isa/pc87312.c b/hw/isa/pc87312.c
index b352b491ac..9327c53132 100644
--- a/hw/isa/pc87312.c
+++ b/hw/isa/pc87312.c
@@ -86,11 +86,6 @@ static inline uint32_t get_parallel_irq(PC87312State *s)
}
}
-static inline bool is_parallel_epp(PC87312State *s)
-{
- return s->regs[REG_PTR] & PTR_EPP_MODE;
-}
-
/* UARTs */
diff --git a/hw/net/cadence_gem.c b/hw/net/cadence_gem.c
index a26861e2ae..de26609c9d 100644
--- a/hw/net/cadence_gem.c
+++ b/hw/net/cadence_gem.c
@@ -50,7 +50,7 @@
#define GEM_IER (0x00000028/4) /* Interrupt Enable reg */
#define GEM_IDR (0x0000002C/4) /* Interrupt Disable reg */
#define GEM_IMR (0x00000030/4) /* Interrupt Mask reg */
-#define GEM_PHYMNTNC (0x00000034/4) /* Phy Maintaince reg */
+#define GEM_PHYMNTNC (0x00000034/4) /* Phy Maintenance reg */
#define GEM_RXPAUSE (0x00000038/4) /* RX Pause Time reg */
#define GEM_TXPAUSE (0x0000003C/4) /* TX Pause Time reg */
#define GEM_TXPARTIALSF (0x00000040/4) /* TX Partial Store and Forward */
@@ -150,7 +150,7 @@
#define GEM_NWCTRL_LOCALLOOP 0x00000002 /* Local Loopback */
#define GEM_NWCFG_STRIP_FCS 0x00020000 /* Strip FCS field */
-#define GEM_NWCFG_LERR_DISC 0x00010000 /* Discard RX frames with lenth err */
+#define GEM_NWCFG_LERR_DISC 0x00010000 /* Discard RX frames with len err */
#define GEM_NWCFG_BUFF_OFST_M 0x0000C000 /* Receive buffer offset mask */
#define GEM_NWCFG_BUFF_OFST_S 14 /* Receive buffer offset shift */
#define GEM_NWCFG_UCAST_HASH 0x00000080 /* accept unicast if hash match */
@@ -397,7 +397,7 @@ static const uint8_t broadcast_addr[] = { 0xFF, 0xFF, 0xFF, 0xFF, 0xFF, 0xFF };
*/
static void gem_init_register_masks(GemState *s)
{
- /* Mask of register bits which are read only*/
+ /* Mask of register bits which are read only */
memset(&s->regs_ro[0], 0, sizeof(s->regs_ro));
s->regs_ro[GEM_NWCTRL] = 0xFFF80000;
s->regs_ro[GEM_NWSTATUS] = 0xFFFFFFFF;
@@ -719,7 +719,7 @@ static ssize_t gem_receive(NetClientState *nc, const uint8_t *buf, size_t size)
unsigned crc_val;
/* The application wants the FCS field, which QEMU does not provide.
- * We must try and caclculate one.
+ * We must try and calculate one.
*/
memcpy(rxbuf, buf, size);
@@ -871,7 +871,7 @@ static void gem_transmit(GemState *s)
DB_PRINT("\n");
- /* The packet we will hand off to qemu.
+ /* The packet we will hand off to QEMU.
* Packets scattered across multiple descriptors are gathered to this
* one contiguous buffer first.
*/
@@ -880,8 +880,10 @@ static void gem_transmit(GemState *s)
/* read current descriptor */
packet_desc_addr = s->tx_desc_addr;
+
+ DB_PRINT("read descriptor 0x%" HWADDR_PRIx "\n", packet_desc_addr);
cpu_physical_memory_read(packet_desc_addr,
- (uint8_t *)&desc[0], sizeof(desc));
+ (uint8_t *)desc, sizeof(desc));
/* Handle all descriptors owned by hardware */
while (tx_desc_get_used(desc) == 0) {
@@ -911,15 +913,17 @@ static void gem_transmit(GemState *s)
/* Last descriptor for this packet; hand the whole thing off */
if (tx_desc_get_last(desc)) {
+ unsigned desc_first[2];
+
/* Modify the 1st descriptor of this packet to be owned by
* the processor.
*/
- cpu_physical_memory_read(s->tx_desc_addr,
- (uint8_t *)&desc[0], sizeof(desc));
- tx_desc_set_used(desc);
- cpu_physical_memory_write(s->tx_desc_addr,
- (uint8_t *)&desc[0], sizeof(desc));
- /* Advance the hardare current descriptor past this packet */
+ cpu_physical_memory_read(s->tx_desc_addr, (uint8_t *)desc_first,
+ sizeof(desc_first));
+ tx_desc_set_used(desc_first);
+ cpu_physical_memory_write(s->tx_desc_addr, (uint8_t *)desc_first,
+ sizeof(desc_first));
+ /* Advance the hardware current descriptor past this packet */
if (tx_desc_get_wrap(desc)) {
s->tx_desc_addr = s->regs[GEM_TXQBASE];
} else {
@@ -960,8 +964,9 @@ static void gem_transmit(GemState *s)
} else {
packet_desc_addr += 8;
}
+ DB_PRINT("read descriptor 0x%" HWADDR_PRIx "\n", packet_desc_addr);
cpu_physical_memory_read(packet_desc_addr,
- (uint8_t *)&desc[0], sizeof(desc));
+ (uint8_t *)desc, sizeof(desc));
}
if (tx_desc_get_used(desc)) {
diff --git a/hw/net/ne2000-isa.c b/hw/net/ne2000-isa.c
index c660e58335..0a14f6d1cd 100644
--- a/hw/net/ne2000-isa.c
+++ b/hw/net/ne2000-isa.c
@@ -98,6 +98,7 @@ static void isa_ne2000_class_initfn(ObjectClass *klass, void *data)
dc->realize = isa_ne2000_realizefn;
dc->props = ne2000_isa_properties;
+ dc->vmsd = &vmstate_isa_ne2000;
set_bit(DEVICE_CATEGORY_NETWORK, dc->categories);
}
diff --git a/hw/pci-host/apb.c b/hw/pci-host/apb.c
index 1497008258..6fa2723449 100644
--- a/hw/pci-host/apb.c
+++ b/hw/pci-host/apb.c
@@ -99,8 +99,8 @@ do { printf("IOMMU: " fmt , ## __VA_ARGS__); } while (0)
#define IOMMU_TTE_DATA_SIZE (1ULL << 61)
#define IOMMU_TTE_DATA_W (1ULL << 1)
-#define IOMMU_TTE_PHYS_MASK_8K 0x1ffffffe000
-#define IOMMU_TTE_PHYS_MASK_64K 0x1ffffff8000
+#define IOMMU_TTE_PHYS_MASK_8K 0x1ffffffe000ULL
+#define IOMMU_TTE_PHYS_MASK_64K 0x1ffffff8000ULL
#define IOMMU_TSB_8K_OFFSET_MASK_8M 0x00000000007fe000ULL
#define IOMMU_TSB_8K_OFFSET_MASK_16M 0x0000000000ffe000ULL
diff --git a/hw/sd/sd.c b/hw/sd/sd.c
index 4502ad143d..5efe8c1af7 100644
--- a/hw/sd/sd.c
+++ b/hw/sd/sd.c
@@ -151,17 +151,6 @@ static const sd_cmd_type_t sd_cmd_type[64] = {
sd_adtc, sd_none, sd_none, sd_none, sd_none, sd_none, sd_none, sd_none,
};
-static const sd_cmd_type_t sd_acmd_type[64] = {
- sd_none, sd_none, sd_none, sd_none, sd_none, sd_none, sd_ac, sd_none,
- sd_none, sd_none, sd_none, sd_none, sd_none, sd_adtc, sd_none, sd_none,
- sd_none, sd_none, sd_none, sd_none, sd_none, sd_none, sd_adtc, sd_ac,
- sd_none, sd_none, sd_none, sd_none, sd_none, sd_none, sd_none, sd_none,
- sd_none, sd_none, sd_none, sd_none, sd_none, sd_none, sd_none, sd_none,
- sd_none, sd_bcr, sd_ac, sd_none, sd_none, sd_none, sd_none, sd_none,
- sd_none, sd_none, sd_none, sd_adtc, sd_none, sd_none, sd_none, sd_none,
- sd_none, sd_none, sd_none, sd_none, sd_none, sd_none, sd_none, sd_none,
-};
-
static const int sd_cmd_class[64] = {
0, 0, 0, 0, 0, 9, 10, 0, 0, 0, 0, 1, 0, 0, 0, 0,
2, 2, 2, 2, 3, 3, 3, 3, 4, 4, 4, 4, 6, 6, 6, 6,
diff --git a/hw/virtio/virtio.c b/hw/virtio/virtio.c
index 3557c178f1..a07ae8ad91 100644
--- a/hw/virtio/virtio.c
+++ b/hw/virtio/virtio.c
@@ -440,7 +440,7 @@ void virtqueue_map_sg(struct iovec *sg, hwaddr *addr,
len = sg[i].iov_len;
sg[i].iov_base = cpu_physical_memory_map(addr[i], &len, is_write);
if (sg[i].iov_base == NULL || len != sg[i].iov_len) {
- error_report("virtio: trying to map MMIO memory");
+ error_report("virtio: error trying to map MMIO memory");
exit(1);
}
}
diff --git a/libcacard/cac.c b/libcacard/cac.c
index 0a0163d3eb..ae8c3784b9 100644
--- a/libcacard/cac.c
+++ b/libcacard/cac.c
@@ -100,10 +100,8 @@ cac_applet_pki_reset(VCard *card, int channel)
pki_applet = &(applet_private->u.pki_data);
pki_applet->cert_buffer = NULL;
- if (pki_applet->sign_buffer) {
- g_free(pki_applet->sign_buffer);
- pki_applet->sign_buffer = NULL;
- }
+ g_free(pki_applet->sign_buffer);
+ pki_applet->sign_buffer = NULL;
pki_applet->cert_buffer_len = 0;
pki_applet->sign_buffer_len = 0;
return VCARD_DONE;
@@ -285,12 +283,8 @@ cac_delete_pki_applet_private(VCardAppletPrivate *applet_private)
return;
}
pki_applet_data = &(applet_private->u.pki_data);
- if (pki_applet_data->cert != NULL) {
- g_free(pki_applet_data->cert);
- }
- if (pki_applet_data->sign_buffer != NULL) {
- g_free(pki_applet_data->sign_buffer);
- }
+ g_free(pki_applet_data->cert);
+ g_free(pki_applet_data->sign_buffer);
if (pki_applet_data->key != NULL) {
vcard_emul_delete_key(pki_applet_data->key);
}
diff --git a/libcacard/card_7816.c b/libcacard/card_7816.c
index a54f880390..814fa1662f 100644
--- a/libcacard/card_7816.c
+++ b/libcacard/card_7816.c
@@ -172,16 +172,12 @@ vcard_response_delete(VCardResponse *response)
switch (response->b_type) {
case VCARD_MALLOC:
/* everything was malloc'ed */
- if (response->b_data) {
- g_free(response->b_data);
- }
+ g_free(response->b_data);
g_free(response);
break;
case VCARD_MALLOC_DATA:
/* only the data buffer was malloc'ed */
- if (response->b_data) {
- g_free(response->b_data);
- }
+ g_free(response->b_data);
break;
case VCARD_MALLOC_STRUCT:
/* only the structure was malloc'ed */
@@ -358,9 +354,7 @@ vcard_apdu_delete(VCardAPDU *apdu)
if (apdu == NULL) {
return;
}
- if (apdu->a_data) {
- g_free(apdu->a_data);
- }
+ g_free(apdu->a_data);
g_free(apdu);
}
diff --git a/libcacard/vcard.c b/libcacard/vcard.c
index 6aaf085ecc..87ad5166a8 100644
--- a/libcacard/vcard.c
+++ b/libcacard/vcard.c
@@ -51,9 +51,7 @@ vcard_buffer_response_delete(VCardBufferResponse *buffer_response)
if (buffer_response == NULL) {
return;
}
- if (buffer_response->buffer) {
- g_free(buffer_response->buffer);
- }
+ g_free(buffer_response->buffer);
g_free(buffer_response);
}
@@ -119,12 +117,8 @@ vcard_delete_applet(VCardApplet *applet)
}
if (applet->applet_private_free) {
applet->applet_private_free(applet->applet_private);
- applet->applet_private = NULL;
- }
- if (applet->aid) {
- g_free(applet->aid);
- applet->aid = NULL;
}
+ g_free(applet->aid);
g_free(applet);
}
@@ -178,8 +172,6 @@ vcard_free(VCard *vcard)
}
if (vcard->vcard_private_free) {
(*vcard->vcard_private_free)(vcard->vcard_private);
- vcard->vcard_private_free = 0;
- vcard->vcard_private = 0;
}
for (current_applet = vcard->applet_list; current_applet;
current_applet = next_applet) {
diff --git a/libcacard/vcard_emul_nss.c b/libcacard/vcard_emul_nss.c
index cefc38333f..f1bba57c2f 100644
--- a/libcacard/vcard_emul_nss.c
+++ b/libcacard/vcard_emul_nss.c
@@ -471,9 +471,7 @@ vreader_emul_delete(VReaderEmul *vreader_emul)
if (vreader_emul->slot) {
PK11_FreeSlot(vreader_emul->slot);
}
- if (vreader_emul->type_params) {
- g_free(vreader_emul->type_params);
- }
+ g_free(vreader_emul->type_params);
g_free(vreader_emul);
}
diff --git a/libcacard/vreader.c b/libcacard/vreader.c
index d2a9b7df41..9f42f0fe21 100644
--- a/libcacard/vreader.c
+++ b/libcacard/vreader.c
@@ -155,9 +155,7 @@ vreader_free(VReader *reader)
if (reader->card) {
vcard_free(reader->card);
}
- if (reader->name) {
- g_free(reader->name);
- }
+ g_free(reader->name);
if (reader->reader_private_free) {
reader->reader_private_free(reader->reader_private);
}
@@ -345,8 +343,6 @@ vreader_list_delete(VReaderList *list)
next_entry = vreader_list_get_next(current_entry);
vreader_list_entry_delete(current_entry);
}
- list->head = NULL;
- list->tail = NULL;
g_free(list);
}
diff --git a/page_cache.c b/page_cache.c
index b033681a93..89bb1ec3a0 100644
--- a/page_cache.c
+++ b/page_cache.c
@@ -109,6 +109,7 @@ void cache_fini(PageCache *cache)
g_free(cache->page_cache);
cache->page_cache = NULL;
+ g_free(cache);
}
static size_t cache_get_cache_pos(const PageCache *cache,
diff --git a/qtest.c b/qtest.c
index f9695a8ff6..04a6dc1f0f 100644
--- a/qtest.c
+++ b/qtest.c
@@ -148,7 +148,7 @@ static int hex2nib(char ch)
} else if (ch >= 'a' && ch <= 'f') {
return 10 + (ch - 'a');
} else if (ch >= 'A' && ch <= 'F') {
- return 10 + (ch - 'a');
+ return 10 + (ch - 'A');
} else {
return -1;
}
diff --git a/slirp/slirp.c b/slirp/slirp.c
index 60280361e6..35f819afb7 100644
--- a/slirp/slirp.c
+++ b/slirp/slirp.c
@@ -37,8 +37,6 @@ static const uint8_t special_ethaddr[ETH_ALEN] = {
0x52, 0x55, 0x00, 0x00, 0x00, 0x00
};
-static const uint8_t zero_ethaddr[ETH_ALEN] = { 0, 0, 0, 0, 0, 0 };
-
u_int curtime;
static QTAILQ_HEAD(slirp_instances, Slirp) slirp_instances =
diff --git a/target-i386/cpu.c b/target-i386/cpu.c
index dde052cc42..8983457e23 100644
--- a/target-i386/cpu.c
+++ b/target-i386/cpu.c
@@ -1688,8 +1688,8 @@ static void x86_cpu_parse_featurestr(CPUState *cs, char *features,
numvalue = strtoul(val, &err, 0);
if (!*val || *err) {
- error_setg(&local_err, "bad numerical value %s", val);
- goto out;
+ error_setg(errp, "bad numerical value %s", val);
+ return;
}
if (numvalue < 0x80000000) {
error_report("xlevel value shall always be >= 0x80000000"
@@ -1706,8 +1706,8 @@ static void x86_cpu_parse_featurestr(CPUState *cs, char *features,
tsc_freq = strtosz_suffix_unit(val, &err,
STRTOSZ_DEFSUFFIX_B, 1000);
if (tsc_freq < 0 || *err) {
- error_setg(&local_err, "bad numerical value %s", val);
- goto out;
+ error_setg(errp, "bad numerical value %s", val);
+ return;
}
snprintf(num, sizeof(num), "%" PRId64, tsc_freq);
object_property_parse(OBJECT(cpu), num, "tsc-frequency",
@@ -1718,8 +1718,8 @@ static void x86_cpu_parse_featurestr(CPUState *cs, char *features,
char num[32];
numvalue = strtoul(val, &err, 0);
if (!*val || *err) {
- error_setg(&local_err, "bad numerical value %s", val);
- goto out;
+ error_setg(errp, "bad numerical value %s", val);
+ return;
}
if (numvalue < min) {
error_report("hv-spinlocks value shall always be >= 0x%x"
@@ -1738,7 +1738,7 @@ static void x86_cpu_parse_featurestr(CPUState *cs, char *features,
}
if (local_err) {
error_propagate(errp, local_err);
- goto out;
+ return;
}
featurestr = strtok(NULL, ",");
}
@@ -1758,9 +1758,6 @@ static void x86_cpu_parse_featurestr(CPUState *cs, char *features,
env->features[FEAT_KVM] &= ~minus_features[FEAT_KVM];
env->features[FEAT_SVM] &= ~minus_features[FEAT_SVM];
env->features[FEAT_7_0_EBX] &= ~minus_features[FEAT_7_0_EBX];
-
-out:
- return;
}
/* generate a composite string into buf of all cpuid names in featureset
diff --git a/target-i386/translate.c b/target-i386/translate.c
index 2359787b42..6fcd8245d2 100644
--- a/target-i386/translate.c
+++ b/target-i386/translate.c
@@ -1506,14 +1506,6 @@ static void gen_shift_rm_im(DisasContext *s, TCGMemOp ot, int op1, int op2,
}
}
-static inline void tcg_gen_lshift(TCGv ret, TCGv arg1, target_long arg2)
-{
- if (arg2 >= 0)
- tcg_gen_shli_tl(ret, arg1, arg2);
- else
- tcg_gen_shri_tl(ret, arg1, -arg2);
-}
-
static void gen_rot_rm_T1(DisasContext *s, TCGMemOp ot, int op1, int is_right)
{
target_ulong mask = (ot == MO_64 ? 0x3f : 0x1f);
diff --git a/target-microblaze/translate.c b/target-microblaze/translate.c
index c422bdc718..03ea15803b 100644
--- a/target-microblaze/translate.c
+++ b/target-microblaze/translate.c
@@ -99,19 +99,6 @@ static const char *special_regnames[] =
"sr16", "sr17", "sr18"
};
-/* Sign extend at translation time. */
-static inline int sign_extend(unsigned int val, unsigned int width)
-{
- int sval;
-
- /* LSL. */
- val <<= 31 - width;
- sval = val;
- /* ASR. */
- sval >>= 31 - width;
- return sval;
-}
-
static inline void t_sync_flags(DisasContext *dc)
{
/* Synch the tb dependent flags between translator and runtime. */
diff --git a/util/qemu-sockets.c b/util/qemu-sockets.c
index 627e60931a..e3d29eebb8 100644
--- a/util/qemu-sockets.c
+++ b/util/qemu-sockets.c
@@ -30,8 +30,6 @@
# define AI_ADDRCONFIG 0
#endif
-static const int on=1, off=0;
-
/* used temporarily until all users are converted to QemuOpts */
QemuOptsList socket_optslist = {
.name = "socket",
@@ -159,6 +157,7 @@ int inet_listen_opts(QemuOpts *opts, int port_offset, Error **errp)
#ifdef IPV6_V6ONLY
if (e->ai_family == PF_INET6) {
/* listen on both ipv4 and ipv6 */
+ const int off = 0;
qemu_setsockopt(slisten, IPPROTO_IPV6, IPV6_V6ONLY, &off,
sizeof(off));
}