trivial patches for 2014-06-10

-----BEGIN PGP SIGNATURE-----
 Version: GnuPG v1.4.12 (GNU/Linux)
 
 iQEcBAABAgAGBQJTly03AAoJEL7lnXSkw9fbFqUH/jokkFQDO9XJ7+SuU/DC1GMH
 JtJZIyLjwu3LmvlsGlCjHcBD/vCF2HLdYWxo+wdiY2kxJdoY3VDhiCpVA4m+U+Lb
 R7L2NV/YsCnTPsDrlm2G8TydowkqUJWzOUrISjM1o+xryL3KG6/QR7+2tksdWJ5J
 T6zD8MX3QsM1j6u5+JdrkAwDSf8oegHS56KSA5vZrRth2/rg++LXMm1J932HLnwa
 Nkb8ymmkUGtErj2x0qBcv6wNQ53u7tpX3RjOWI7t9ripXICH+3a5ZMFiaM2E37Ws
 hJDfGoDZ/N19d+cxLJBxvUrfZKwCdWvvDYHx3XyXIW3HkB6UKaG7DwMENWDoGck=
 =7cOf
 -----END PGP SIGNATURE-----

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>
This commit is contained in:
Peter Maydell 2014-06-10 17:16:03 +01:00
commit b780bf8eff
26 changed files with 46 additions and 153 deletions

View File

@ -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;

View File

@ -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);

View File

@ -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:

View File

@ -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);

View File

@ -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;

View File

@ -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);

View File

@ -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;

View File

@ -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;

View File

@ -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 */

View File

@ -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)) {

View File

@ -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);
}

View File

@ -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

View File

@ -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,

View File

@ -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);
}
}

View File

@ -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;
}
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);
}
if (pki_applet_data->key != NULL) {
vcard_emul_delete_key(pki_applet_data->key);
}

View File

@ -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);
break;
case VCARD_MALLOC_DATA:
/* only the data buffer was malloc'ed */
if (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);
}

View File

@ -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);
}
@ -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);
}
@ -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) {

View File

@ -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);
}

View File

@ -155,9 +155,7 @@ vreader_free(VReader *reader)
if (reader->card) {
vcard_free(reader->card);
}
if (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);
}

View File

@ -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,

View File

@ -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;
}

View File

@ -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 =

View File

@ -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

View File

@ -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);

View File

@ -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. */

View File

@ -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));
}