Skip to contentSkip to conversation

Trivial patches for 2014-08-15

GIT PULL Applied Michael Tokarev 2 participants 22 messages Aug 15, 2014 – Aug 18, 2014 Arm/Zynq architecture

lore
Share & tools
lore
#0 lore raw

Here's another trivial-patches pull request, with patches accumulated since the previous one which has been processed today.

This time, there's a bunch of changes by Gonglei removing "Yoda conditions" and updating docs/comments, irq zero initing patches by Peter Crosthwaite, and some other small fixes.

Please consider pulling/applying.

Thanks,

/mjt

The following changes since commit f083201667fddd51055c2ac67f67221e82298a35:

Merge remote-tracking branch 'remotes/mjt/tags/trivial-patches-2014-08-09' into staging (2014-08-15 13:41:55 +0100)

are available in the git repository at:

git://git.corpit.ru/qemu.git tags/trivial-patches-2014-08-15

for you to fetch changes up to 5edbdbcdf882e4220adc7dbf433351077cd1fbbc:

ivshmem: check the value returned by fstat() (2014-08-15 19:12:58 +0400)

----------------------------------------------------------------
trivial patches for 2014-08-15

----------------------------------------------------------------
Fam Zheng (1):
memory: Update obsolete comment about AddrRange field type

Gonglei (11):
pci-host: update obsolete reference about piix_pci.c
pci-host: update uncorresponding description
CODING_STYLE: Section about conditional statement
usb: don't use 'Yoda conditions'
audio: don't use 'Yoda conditions'
isa-bus: don't use 'Yoda conditions'
don't use 'Yoda conditions'
spice: don't use 'Yoda conditions'
vl: don't use 'Yoda conditions'
vmxnet3: don't use 'Yoda conditions' qemu-options.hx: fix typo about l2tpv3

Hu Tao (1):
vl: free err

Jan Kiszka (1):
apic: Fix reported DFR content

Liming Wang (1):
qemu-options.hx: fix a typo of chardev

Peter Crosthwaite (3):
ssi: xilinx_spi: Initialise CS GPIOs as NULL
ppc: convert g_new(qemu_irq usages to g_new0
intc: i8259: Convert Array allocation to g_new0

zhanghailiang (2):
l2cap: fix access to freed memory
ivshmem: check the value returned by fstat()

 CODING_STYLE              |   14 ++++++++++++++
 hw/audio/gus.c            |    2 +-
 hw/audio/hda-codec.c      |    3 ++-
 hw/audio/sb16.c           |    6 +++---
 hw/bt/l2cap.c             |    2 +-
 hw/intc/apic.c            |    2 +-
 hw/intc/i8259.c           |    2 +-
 hw/intc/openpic.c         |    2 +-
 hw/isa/isa-bus.c          |    2 +-
 hw/isa/lpc_ich9.c         |    2 +-
 hw/misc/ivshmem.c         |    6 +++++-
 hw/net/vmxnet3.c          |   16 ++++++++--------
 hw/pci-host/pam.c         |    4 ++--
 hw/pci-host/q35.c         |    2 +-
 hw/ppc/e500.c             |    2 +-
 hw/ppc/mac_newworld.c     |    2 +-
 hw/ssi/xilinx_spi.c       |    2 +-
 hw/usb/dev-audio.c        |    2 +-
 hw/usb/dev-mtp.c          |    4 ++--
 hw/usb/hcd-ehci.c         |    2 +-
 include/hw/pci-host/pam.h |    2 +-
 memory.c                  |    3 +--
 qdev-monitor.c            |    2 +-
 qemu-char.c               |    2 +-
 qemu-options.hx           |    4 ++--
 ui/spice-core.c           |    4 ++--
 util/qemu-sockets.c       |    2 +-
 vl.c                      |    6 ++++--
 28 files changed, 62 insertions(+), 42 deletions(-)
#1 lore raw

[Qemu-devel] [PULL 02/20] memory: Update obsolete comment about AddrRange field type

From: Fam Zheng <[email protected]>

We are not 64 bit any more since

08dafab4 memory: use 128-bit integers for sizes and intermediates

but the comment is forgotten to be updated.

---
 memory.c |    3 +--
 1 file changed, 1 insertion(+), 2 deletions(-)
memory.c +1 -2
index 64d7176..dbe6675 100644
@@ -56,8 +56,7 @@ static void memory_init(void)
 typedef struct AddrRange AddrRange;
 
 /*
- * Note using signed integers limits us to physical addresses at most
- * 63 bits wide.  They are needed for negative offsetting in aliases
+ * Note that signed integers are needed for negative offsetting in aliases
  * (large MemoryRegion::alias_offset).
  */
 struct AddrRange {
Signature · 1 line
1.7.10.4
#2 lore raw

[Qemu-devel] [PULL 01/20] apic: Fix reported DFR content

In reply to Michael Tokarev

From: Jan Kiszka <[email protected]>

IA-32 SDM, Figure 10-14: Bits 27:0 are reserved as 1.

Fixes Jailhouse hypervisor start with in-kernel irqchips off.

---
 hw/intc/apic.c |    2 +-
 1 file changed, 1 insertion(+), 1 deletion(-)
hw/intc/apic.c +1 -1
index ef19e55..03ff9e9 100644
@@ -698,7 +698,7 @@ static uint32_t apic_mem_readl(void *opaque, hwaddr addr)
         val = s->log_dest << 24;
         break;
     case 0x0e:
-        val = s->dest_mode << 28;
+        val = (s->dest_mode << 28) | 0xfffffff;
         break;
     case 0x0f:
         val = s->spurious_vec;
Signature · 1 line
1.7.10.4
#3 lore raw

[Qemu-devel] [PULL 08/20] audio: don't use 'Yoda conditions'

In reply to Michael Tokarev

From: Gonglei <[email protected]>

imitate nearby code about using '!value' or 'value == NULL'

---
 hw/audio/gus.c       |    2 +-
 hw/audio/hda-codec.c |    3 ++-
 hw/audio/sb16.c      |    6 +++---
 3 files changed, 6 insertions(+), 5 deletions(-)
hw/audio/gus.c +1 -1
index bba6840..4a43ce7 100644
@@ -212,7 +212,7 @@ static int GUS_read_DMA (void *opaque, int nchan, int dma_pos, int dma_len)
         pos += copied;
     }
 
-    if (0 == ((mode >> 4) & 1)) {
+    if (((mode >> 4) & 1) == 0) {
         DMA_release_DREQ (s->emu.gusdma);
     }
     return dma_len;
hw/audio/hda-codec.c +2 -1
index cbcf521..3c03ff5 100644
@@ -489,8 +489,9 @@ static int hda_audio_init(HDACodecDevice *hda, const struct desc_codec *desc)
     for (i = 0; i < a->desc->nnodes; i++) {
         node = a->desc->nodes + i;
         param = hda_codec_find_param(node, AC_PAR_AUDIO_WIDGET_CAP);
-        if (NULL == param)
+        if (param == NULL) {
             continue;
+        }
         type = (param->val & AC_WCAP_TYPE) >> AC_WCAP_TYPE_SHIFT;
         switch (type) {
         case AC_WID_AUD_OUT:
hw/audio/sb16.c +3 -3
index 60c4b3b..bda26d0 100644
@@ -928,7 +928,7 @@ static IO_WRITE_PROTO (dsp_write)
 /*         if (s->highspeed) */
 /*             break; */
 
-        if (0 == s->needed_bytes) {
+        if (s->needed_bytes == 0) {
             command (s, val);
 #if 0
             if (0 == s->needed_bytes) {
@@ -1212,7 +1212,7 @@ static int SB_read_DMA (void *opaque, int nchan, int dma_pos, int dma_len)
 #endif
 
     if (till <= copy) {
-        if (0 == s->dma_auto) {
+        if (s->dma_auto == 0) {
             copy = till;
         }
     }
@@ -1224,7 +1224,7 @@ static int SB_read_DMA (void *opaque, int nchan, int dma_pos, int dma_len)
     if (s->left_till_irq <= 0) {
         s->mixer_regs[0x82] |= (nchan & 4) ? 2 : 1;
         qemu_irq_raise (s->pic);
-        if (0 == s->dma_auto) {
+        if (s->dma_auto == 0) {
             control (s, 0);
             speaker (s, 0);
         }
Signature · 1 line
1.7.10.4
#4 lore raw

[Qemu-devel] [PULL 07/20] usb: don't use 'Yoda conditions'

In reply to Michael Tokarev

From: Gonglei <[email protected]>

imitate nearby code about using '!value' or 'value == NULL'

---
 hw/usb/dev-audio.c |    2 +-
 hw/usb/dev-mtp.c   |    4 ++--
 hw/usb/hcd-ehci.c  |    2 +-
 3 files changed, 4 insertions(+), 4 deletions(-)
hw/usb/dev-audio.c +1 -1
index bfebfe9..7b9957b 100644
@@ -371,7 +371,7 @@ static void output_callback(void *opaque, int avail)
             return;
         }
         data = streambuf_get(&s->out.buf);
-        if (NULL == data) {
+        if (!data) {
             return;
         }
         AUD_write(s->out.voice, data, USBAUDIO_PACKET_SIZE);
hw/usb/dev-mtp.c +2 -2
index 384d4a5..0820046 100644
@@ -832,7 +832,7 @@ static void usb_mtp_command(MTPState *s, MTPControl *c)
             return;
         }
         data_in = usb_mtp_get_object(s, c, o);
-        if (NULL == data_in) {
+        if (data_in == NULL) {
             usb_mtp_queue_result(s, RES_GENERAL_ERROR,
                                  c->trans, 0, 0, 0);
             return;
@@ -851,7 +851,7 @@ static void usb_mtp_command(MTPState *s, MTPControl *c)
             return;
         }
         data_in = usb_mtp_get_partial_object(s, c, o);
-        if (NULL == data_in) {
+        if (data_in == NULL) {
             usb_mtp_queue_result(s, RES_GENERAL_ERROR,
                                  c->trans, 0, 0, 0);
             return;
hw/usb/hcd-ehci.c +1 -1
index a00a93c..448e007 100644
@@ -1596,7 +1596,7 @@ static EHCIQueue *ehci_state_fetchqh(EHCIState *ehci, int async)
 
     entry = ehci_get_fetch_addr(ehci, async);
     q = ehci_find_queue_by_qh(ehci, entry, async);
-    if (NULL == q) {
+    if (q == NULL) {
         q = ehci_alloc_queue(ehci, entry, async);
     }
 
Signature · 1 line
1.7.10.4
#5 lore raw

[Qemu-devel] [PULL 06/20] CODING_STYLE: Section about conditional statement

In reply to Michael Tokarev

From: Gonglei <[email protected]>

Yoda conditions lack readability, and QEMU has a strict compiler configuration for checking a common mistake like "if (dev = NULL)". Make it a written rule.

---
 CODING_STYLE |   14 ++++++++++++++
 1 file changed, 14 insertions(+)
CODING_STYLE +14 -0
index 4280945..d46cfa5 100644
@@ -91,3 +91,17 @@ Mixed declarations (interleaving statements and declarations within blocks)
 are not allowed; declarations should be at the beginning of blocks.  In other
 words, the code should not generate warnings if using GCC's
 -Wdeclaration-after-statement option.
+
+6. Conditional statements
+
+When comparing a variable for (in)equality with a constant, list the
+constant on the right, as in:
+
+if (a == 1) {
+    /* Reads like: "If a equals 1" */
+    do_something();
+}
+
+Rationale: Yoda conditions (as in 'if (1 == a)') are awkward to read.
+Besides, good compilers already warn users when '==' is mis-typed as '=',
+even when the constant is on the right.
Signature · 1 line
1.7.10.4
#6 lore raw

[Qemu-devel] [PULL 13/20] vmxnet3: don't use 'Yoda conditions'

In reply to Michael Tokarev

From: Gonglei <[email protected]>

imitate nearby code about using '!value' or 'value == NULL'

---
 hw/net/vmxnet3.c |   16 ++++++++--------
 1 file changed, 8 insertions(+), 8 deletions(-)
hw/net/vmxnet3.c +8 -8
index 77bea6f..588149d 100644
@@ -1009,7 +1009,7 @@ vmxnet3_indicate_packet(VMXNET3State *s)
 
         vmxnet3_dump_rx_descr(&rxd);
 
-        if (0 != ready_rxcd_pa) {
+        if (ready_rxcd_pa != 0) {
             cpu_physical_memory_write(ready_rxcd_pa, &rxcd, sizeof(rxcd));
         }
 
@@ -1020,7 +1020,7 @@ vmxnet3_indicate_packet(VMXNET3State *s)
         rxcd.gen = new_rxcd_gen;
         rxcd.rqID = RXQ_IDX + rx_ridx * s->rxq_num;
 
-        if (0 == bytes_left) {
+        if (bytes_left == 0) {
             vmxnet3_rx_update_descr(s->rx_pkt, &rxcd);
         }
 
@@ -1038,16 +1038,16 @@ vmxnet3_indicate_packet(VMXNET3State *s)
         num_frags++;
     }
 
-    if (0 != ready_rxcd_pa) {
+    if (ready_rxcd_pa != 0) {
         rxcd.eop = 1;
-        rxcd.err = (0 != bytes_left);
+        rxcd.err = (bytes_left != 0);
         cpu_physical_memory_write(ready_rxcd_pa, &rxcd, sizeof(rxcd));
 
         /* Flush RX descriptor changes */
         smp_wmb();
     }
 
-    if (0 != new_rxcd_pa) {
+    if (new_rxcd_pa != 0) {
         vmxnet3_revert_rxc_descr(s, RXQ_IDX);
     }
 
@@ -1190,8 +1190,8 @@ static void vmxnet3_update_mcast_filters(VMXNET3State *s)
     s->mcast_list_len = list_bytes / sizeof(s->mcast_list[0]);
 
     s->mcast_list = g_realloc(s->mcast_list, list_bytes);
-    if (NULL == s->mcast_list) {
-        if (0 == s->mcast_list_len) {
+    if (!s->mcast_list) {
+        if (s->mcast_list_len == 0) {
             VMW_CFPRN("Current multicast list is empty");
         } else {
             VMW_ERPRN("Failed to allocate multicast list of %d elements",
@@ -1667,7 +1667,7 @@ vmxnet3_io_bar1_write(void *opaque,
          * memory address. We save it to temp variable and set the
          * shared address only after we get the high part
          */
-        if (0 == val) {
+        if (val == 0) {
             s->device_active = false;
         }
         s->temp_shared_guest_driver_memory = val;
Signature · 1 line
1.7.10.4
#7 lore raw

[Qemu-devel] [PULL 14/20] qemu-options.hx: fix typo about l2tpv3

In reply to Michael Tokarev

From: Gonglei <[email protected]>

two duplicate destport description.

s/destport/srcport/, s/destination/source/

---
 qemu-options.hx |    2 +-
 1 file changed, 1 insertion(+), 1 deletion(-)
qemu-options.hx +1 -1
index 000cccd..9d743e5 100644
@@ -1444,7 +1444,7 @@ DEF("net", HAS_ARG, QEMU_OPTION_net,
     "                use 'src=' to specify source address\n"
     "                use 'dst=' to specify destination address\n"
     "                use 'udp=on' to specify udp encapsulation\n"
-    "                use 'dstport=' to specify destination udp port\n"
+    "                use 'srcport=' to specify source udp port\n"
     "                use 'dstport=' to specify destination udp port\n"
     "                use 'ipv6=on' to force v6\n"
     "                L2TPv3 uses cookies to prevent misconfiguration as\n"
Signature · 1 line
1.7.10.4
#8 lore raw

[Qemu-devel] [PULL 16/20] ssi: xilinx_spi: Initialise CS GPIOs as NULL

In reply to Michael Tokarev

From: Peter Crosthwaite <[email protected]>

To properly indicate they are unconnected.

---
 hw/ssi/xilinx_spi.c |    2 +-
 1 file changed, 1 insertion(+), 1 deletion(-)
hw/ssi/xilinx_spi.c +1 -1
index 207f47a..620573c 100644
@@ -329,7 +329,7 @@ static int xilinx_spi_init(SysBusDevice *sbd)
     s->spi = ssi_create_bus(dev, "spi");
 
     sysbus_init_irq(sbd, &s->irq);
-    s->cs_lines = g_new(qemu_irq, s->num_cs);
+    s->cs_lines = g_new0(qemu_irq, s->num_cs);
     ssi_auto_connect_slaves(dev, s->cs_lines, s->spi);
     for (i = 0; i < s->num_cs; ++i) {
         sysbus_init_irq(sbd, &s->cs_lines[i]);
Signature · 1 line
1.7.10.4
#9 lore raw

[Qemu-devel] [PULL 19/20] l2cap: fix access to freed memory

In reply to Michael Tokarev

From: zhanghailiang <[email protected]>

Pointer 'ch' will be used in function 'l2cap_channel_open_req_msg' after it was previously freed in 'l2cap_channel_open'.
Assigned it to NULL after it is freed.

---
 hw/bt/l2cap.c |    2 +-
 1 file changed, 1 insertion(+), 1 deletion(-)
hw/bt/l2cap.c +1 -1
index 2301d6f..591e047 100644
@@ -429,7 +429,7 @@ static struct l2cap_chan_s *l2cap_channel_open(struct l2cap_instance_s *l2cap,
                 status = L2CAP_CS_NO_INFO;
             } else {
                 g_free(ch);
-
+                ch = NULL;
                 result = L2CAP_CR_NO_MEM;
                 status = L2CAP_CS_NO_INFO;
             }
Signature · 1 line
1.7.10.4
#10 lore raw

[Qemu-devel] [PULL 20/20] ivshmem: check the value returned by fstat()

In reply to Michael Tokarev

From: zhanghailiang <[email protected]>

The function fstat() may fail, so check its return value.

---
 hw/misc/ivshmem.c |    6 +++++-
 1 file changed, 5 insertions(+), 1 deletion(-)
hw/misc/ivshmem.c +5 -1
index 768e528..2be4b86 100644
@@ -324,7 +324,11 @@ static int check_shm_size(IVShmemState *s, int fd) {
 
     struct stat buf;
 
-    fstat(fd, &buf);
+    if (fstat(fd, &buf) < 0) {
+        fprintf(stderr, "ivshmem: exiting: fstat on fd %d failed: %s\n",
+                fd, strerror(errno));
+        return -1;
+    }
 
     if (s->ivshmem_size > buf.st_size) {
         fprintf(stderr,
Signature · 1 line
1.7.10.4
#11 lore raw

[Qemu-devel] [PULL 12/20] vl: don't use 'Yoda conditions'

In reply to Michael Tokarev

From: Gonglei <[email protected]>

imitate nearby code about using '!value' or 'value == NULL'

---
 vl.c |    5 +++--
 1 file changed, 3 insertions(+), 2 deletions(-)
vl.c +3 -2
index a8029d5..9783133 100644
@@ -1154,7 +1154,7 @@ static int drive_init_func(QemuOpts *opts, void *opaque)
 
 static int drive_enable_snapshot(QemuOpts *opts, void *opaque)
 {
-    if (NULL == qemu_opt_get(opts, "snapshot")) {
+    if (qemu_opt_get(opts, "snapshot") == NULL) {
         qemu_opt_set(opts, "snapshot", "on");
     }
     return 0;
@@ -2506,8 +2506,9 @@ static int foreach_device_config(int type, int (*func)(const char *cmdline))
         loc_push_restore(&conf->loc);
         rc = func(conf->cmdline);
         loc_pop(&conf->loc);
-        if (0 != rc)
+        if (rc) {
             return rc;
+        }
     }
     return 0;
 }
Signature · 1 line
1.7.10.4
#12 lore raw

[Qemu-devel] [PULL 11/20] spice: don't use 'Yoda conditions'

In reply to Michael Tokarev

From: Gonglei <[email protected]>

imitate nearby code about using '!value' or 'value == NULL'

---
 ui/spice-core.c |    4 ++--
 1 file changed, 2 insertions(+), 2 deletions(-)
ui/spice-core.c +2 -2
index 7bb91e6..1a2fb4b 100644
@@ -677,7 +677,7 @@ void qemu_spice_init(void)
 
     if (tls_port) {
         x509_dir = qemu_opt_get(opts, "x509-dir");
-        if (NULL == x509_dir) {
+        if (!x509_dir) {
             x509_dir = ".";
         }
 
@@ -803,7 +803,7 @@ void qemu_spice_init(void)
 
     seamless_migration = qemu_opt_get_bool(opts, "seamless-migration", 0);
     spice_server_set_seamless_migration(spice_server, seamless_migration);
-    if (0 != spice_server_init(spice_server, &core_interface)) {
+    if (spice_server_init(spice_server, &core_interface) != 0) {
         error_report("failed to initialize spice server");
         exit(1);
     };
Signature · 1 line
1.7.10.4
#13 lore raw

[Qemu-devel] [PULL 04/20] pci-host: update obsolete reference about piix_pci.c

In reply to Michael Tokarev

From: Gonglei <[email protected]>

piix_pci.c has been renamed into piix.c at commit
c0907c9e6417cb959dfd9ef6873221536ec91351

update the obsolete reference.

---
 hw/isa/lpc_ich9.c         |    2 +-
 hw/pci-host/pam.c         |    2 +-
 hw/pci-host/q35.c         |    2 +-
 include/hw/pci-host/pam.h |    2 +-
 4 files changed, 4 insertions(+), 4 deletions(-)
hw/isa/lpc_ich9.c +1 -1
index b846d81..177023b 100644
@@ -7,7 +7,7 @@
  *               VA Linux Systems Japan K.K.
  * Copyright (C) 2012 Jason Baron <[email protected]>
  *
- * This is based on piix_pci.c, but heavily modified.
+ * This is based on piix.c, but heavily modified.
  *
  * Permission is hereby granted, free of charge, to any person obtaining a copy
  * of this software and associated documentation files (the "Software"), to deal
hw/pci-host/pam.c +1 -1
index e1e95aa..6abee4f 100644
@@ -6,7 +6,7 @@
  *                    VA Linux Systems Japan K.K.
  * Copyright (c) 2012 Jason Baron <[email protected]>
  *
- * Split out from piix_pci.c
+ * Split out from piix.c
  *
  * Permission is hereby granted, free of charge, to any person obtaining a copy
  * of this software and associated documentation files (the "Software"), to deal
hw/pci-host/q35.c +1 -1
index a0a3068..37f228e 100644
@@ -7,7 +7,7 @@
  *               VA Linux Systems Japan K.K.
  * Copyright (C) 2012 Jason Baron <[email protected]>
  *
- * This is based on piix_pci.c, but heavily modified.
+ * This is based on piix.c, but heavily modified.
  *
  * Permission is hereby granted, free of charge, to any person obtaining a copy
  * of this software and associated documentation files (the "Software"), to deal
include/hw/pci-host/pam.h +1 -1
index a8b87b8..4d03e4b 100644
@@ -7,7 +7,7 @@
  *               VA Linux Systems Japan K.K.
  * Copyright (c) 2012 Jason Baron <[email protected]>
  *
- * Split out from piix_pci.c
+ * Split out from piix.c
  *
  * Permission is hereby granted, free of charge, to any person obtaining a copy
  * of this software and associated documentation files (the "Software"), to deal
Signature · 1 line
1.7.10.4
#14 lore raw

[Qemu-devel] [PULL 09/20] isa-bus: don't use 'Yoda conditions'

In reply to Michael Tokarev

From: Gonglei <[email protected]>

imitate nearby code about using '!value' or 'value == NULL'

---
 hw/isa/isa-bus.c |    2 +-
 1 file changed, 1 insertion(+), 1 deletion(-)
hw/isa/isa-bus.c +1 -1
index b28981b..cc85e53 100644
@@ -50,7 +50,7 @@ ISABus *isa_bus_new(DeviceState *dev, MemoryRegion *address_space_io)
         fprintf(stderr, "Can't create a second ISA bus\n");
         return NULL;
     }
-    if (NULL == dev) {
+    if (!dev) {
         dev = qdev_create(NULL, "isabus-bridge");
         qdev_init_nofail(dev);
     }
Signature · 1 line
1.7.10.4
#15 lore raw

[Qemu-devel] [PULL 03/20] qemu-options.hx: fix a typo of chardev

In reply to Michael Tokarev

From: Liming Wang <[email protected]>

Change host to port.

---
 qemu-options.hx |    2 +-
 1 file changed, 1 insertion(+), 1 deletion(-)
qemu-options.hx +1 -1
index 96516c1..000cccd 100644
@@ -1926,7 +1926,7 @@ ETEXI
 
 DEF("chardev", HAS_ARG, QEMU_OPTION_chardev,
     "-chardev null,id=id[,mux=on|off]\n"
-    "-chardev socket,id=id[,host=host],port=host[,to=to][,ipv4][,ipv6][,nodelay]\n"
+    "-chardev socket,id=id[,host=host],port=port[,to=to][,ipv4][,ipv6][,nodelay]\n"
     "         [,server][,nowait][,telnet][,mux=on|off] (tcp)\n"
     "-chardev socket,id=id,path=path[,server][,nowait][,telnet],[mux=on|off] (unix)\n"
     "-chardev udp,id=id[,host=host],port=port[,localaddr=localaddr]\n"
Signature · 1 line
1.7.10.4
#16 lore raw

[Qemu-devel] [PULL 05/20] pci-host: update uncorresponding description

In reply to Michael Tokarev

From: Gonglei <[email protected]>

---
 hw/pci-host/pam.c |    2 +-
 1 file changed, 1 insertion(+), 1 deletion(-)
hw/pci-host/pam.c +1 -1
index 6abee4f..8272de3 100644
@@ -1,5 +1,5 @@
 /*
- * QEMU i440FX/PIIX3 PCI Bridge Emulation
+ * QEMU Smram/pam logic implementation
  *
  * Copyright (c) 2006 Fabrice Bellard
  * Copyright (c) 2011 Isaku Yamahata <yamahata at valinux co jp>
Signature · 1 line
1.7.10.4
#17 lore raw

[Qemu-devel] [PULL 10/20] don't use 'Yoda conditions'

In reply to Michael Tokarev

From: Gonglei <[email protected]>

imitate nearby code about using '!value' or 'value == NULL'

---
 qdev-monitor.c      |    2 +-
 qemu-char.c         |    2 +-
 util/qemu-sockets.c |    2 +-
 3 files changed, 3 insertions(+), 3 deletions(-)
qdev-monitor.c +1 -1
index f87f3d8..81a4e9b 100644
@@ -694,7 +694,7 @@ void qmp_device_del(const char *id, Error **errp)
     DeviceState *dev;
 
     dev = qdev_find_recursive(sysbus_get_default(), id);
-    if (NULL == dev) {
+    if (!dev) {
         error_set(errp, QERR_DEVICE_NOT_FOUND, id);
         return;
     }
qemu-char.c +1 -1
index 6964a2d..3dcc39a 100644
@@ -4121,7 +4121,7 @@ void qmp_chardev_remove(const char *id, Error **errp)
     CharDriverState *chr;
 
     chr = qemu_chr_find(id);
-    if (NULL == chr) {
+    if (chr == NULL) {
         error_setg(errp, "Chardev '%s' not found", id);
         return;
     }
util/qemu-sockets.c +1 -1
index 74cf078..5d38395 100644
@@ -732,7 +732,7 @@ int unix_connect_opts(QemuOpts *opts, Error **errp,
     ConnectState *connect_state = NULL;
     int sock, rc;
 
-    if (NULL == path) {
+    if (path == NULL) {
         error_setg(errp, "unix connect: no path specified");
         return -1;
     }
Signature · 1 line
1.7.10.4
#18 lore raw

[Qemu-devel] [PULL 15/20] vl: free err

In reply to Michael Tokarev

From: Hu Tao <[email protected]>

err is not freed after use, thus causing memory leak. This patch fixes it.

---
 vl.c |    1 +
 1 file changed, 1 insertion(+)
vl.c +1 -0
index 9783133..b796c67 100644
@@ -2918,6 +2918,7 @@ out:
     g_free(dummy);
     if (err) {
         qerror_report_err(err);
+        error_free(err);
         return -1;
     }
     return 0;
Signature · 1 line
1.7.10.4
#19 lore raw

[Qemu-devel] [PULL 18/20] intc: i8259: Convert Array allocation to g_new0

In reply to Michael Tokarev

From: Peter Crosthwaite <[email protected]>

To be more array friendly and to indicate the IRQs are initially disconnected.

---
 hw/intc/i8259.c |    2 +-
 1 file changed, 1 insertion(+), 1 deletion(-)
hw/intc/i8259.c +1 -1
index d0b0c52..a563b82 100644
@@ -472,7 +472,7 @@ qemu_irq *i8259_init(ISABus *bus, qemu_irq parent_irq)
     ISADevice *isadev;
     int i;
 
-    irq_set = g_malloc(ISA_NUM_IRQS * sizeof(qemu_irq));
+    irq_set = g_new0(qemu_irq, ISA_NUM_IRQS);
 
     isadev = i8259_init_chip(TYPE_I8259, bus, true);
     dev = DEVICE(isadev);
Signature · 1 line
1.7.10.4
#20 lore raw

[Qemu-devel] [PULL 17/20] ppc: convert g_new(qemu_irq usages to g_new0

In reply to Michael Tokarev

From: Peter Crosthwaite <[email protected]>

To indicate the IRQs are initially disconnected.

---
 hw/intc/openpic.c     |    2 +-
 hw/ppc/e500.c         |    2 +-
 hw/ppc/mac_newworld.c |    2 +-
 3 files changed, 3 insertions(+), 3 deletions(-)
hw/intc/openpic.c +1 -1
index 028529e..7d1f3b9 100644
@@ -1627,7 +1627,7 @@ static void openpic_realize(DeviceState *dev, Error **errp)
     }
 
     for (i = 0; i < opp->nb_cpus; i++) {
-        opp->dst[i].irqs = g_new(qemu_irq, OPENPIC_OUTPUT_NB);
+        opp->dst[i].irqs = g_new0(qemu_irq, OPENPIC_OUTPUT_NB);
         for (j = 0; j < OPENPIC_OUTPUT_NB; j++) {
             sysbus_init_irq(d, &opp->dst[i].irqs[j]);
         }
hw/ppc/e500.c +1 -1
index 1a5b30d..16c85ef 100644
@@ -583,7 +583,7 @@ static qemu_irq *ppce500_init_mpic(PPCE500Params *params, MemoryRegion *ccsr,
     SysBusDevice *s;
     int i;
 
-    mpic = g_new(qemu_irq, 256);
+    mpic = g_new0(qemu_irq, 256);
 
     if (kvm_enabled()) {
         QemuOpts *machine_opts = qemu_get_machine_opts();
hw/ppc/mac_newworld.c +1 -1
index f5bccd2..1ec4bb4 100644
@@ -346,7 +346,7 @@ static void ppc_core99_init(MachineState *machine)
         }
     }
 
-    pic = g_new(qemu_irq, 64);
+    pic = g_new0(qemu_irq, 64);
 
     dev = qdev_create(NULL, TYPE_OPENPIC);
     qdev_prop_set_uint32(dev, "model", OPENPIC_MODEL_RAVEN);
Signature · 1 line
1.7.10.4
#21 lore raw
In reply to Michael Tokarev
Quoted 21 lines · Michael Tokarev

Here's another trivial-patches pull request, with patches accumulated since the previous one which has been processed today.

This time, there's a bunch of changes by Gonglei removing "Yoda conditions" and updating docs/comments, irq zero initing patches by Peter Crosthwaite, and some other small fixes.

Please consider pulling/applying.

Thanks,

/mjt

The following changes since commit f083201667fddd51055c2ac67f67221e82298a35:

Merge remote-tracking branch 'remotes/mjt/tags/trivial-patches-2014-08-09' into staging (2014-08-15 13:41:55 +0100)

are available in the git repository at:

git://git.corpit.ru/qemu.git tags/trivial-patches-2014-08-15

Quoted 8 lines

for you to fetch changes up to 5edbdbcdf882e4220adc7dbf433351077cd1fbbc:

ivshmem: check the value returned by fstat() (2014-08-15 19:12:58 +0400)

----------------------------------------------------------------
trivial patches for 2014-08-15

----------------------------------------------------------------

Applied, thanks.

-- PMM