All of lore.kernel.org
 help / color / mirror / Atom feed
* [Qemu-devel] [PULL 00/19] Trivial patches for 2015-10-08
@ 2015-10-08 16:52 Michael Tokarev
  2015-10-08 16:52 ` [Qemu-devel] [PULL 01/19] Add .dir-locals.el file to configure emacs coding style Michael Tokarev
                   ` (19 more replies)
  0 siblings, 20 replies; 22+ messages in thread
From: Michael Tokarev @ 2015-10-08 16:52 UTC (permalink / raw)
  To: qemu-devel; +Cc: qemu-trivial, Michael Tokarev

Another trivial-patches pull request.
Everything's trivial in there this time.

Please consider applying/pulling.

Thank you!

/mjt

The following changes since commit 31c9bd164ddb653915b9029ba0edd40cd57530d9:

  Merge remote-tracking branch 'remotes/rth/tags/pull-tcg-20151007' into staging (2015-10-08 15:33:56 +0100)

are available in the git repository at:

  git://git.corpit.ru/qemu.git tags/pull-trivial-patches-2015-10-08

for you to fetch changes up to deb847bfba7ee0ab8151842f5e9cb12d4daad3a3:

  tests: Unique test path for /string-visitor/output (2015-10-08 19:48:17 +0300)

----------------------------------------------------------------
trivial patches for 2015-10-08

----------------------------------------------------------------
Christopher Covington (1):
      s/cpu_get_real_ticks/cpu_get_host_ticks/

Daniel P. Berrange (1):
      Add .dir-locals.el file to configure emacs coding style

David Gibson (1):
      .travis.yml: Run make check for all targets, not just some

Dr. David Alan Gilbert (1):
      tests: Unique test path for /string-visitor/output

Guenter Roeck (1):
      imx_serial: Generate interrupt on tx empty if enabled

Marc-André Lureau (1):
      qapi: add missing @

Markus Armbruster (2):
      rocker: Use g_new() & friends where that makes obvious sense
      linux-user: Use g_new() & friends where that makes obvious sense

Paolo Bonzini (3):
      block/ssh: remove dead code
      pci-assign: do not include sys/io.h
      pc: check for underflow in load_linux

Sai Pavan Boddu (2):
      sdhci: use PRIx64 for uint64_t type
      sdhci: Change debug prints to compile unconditionally

Shraddha Barke (4):
      target-microblaze: Remove unnecessary variable
      target-ppc: Remove unnecessary variable
      hw: timer: Remove unnecessary variable
      hw: char: Remove unnecessary variable

Stefan Weil (2):
      MAINTAINERS: Add NSIS file for W32, W64 hosts
      linux-user: Remove type casts to union type

 .dir-locals.el                     |  2 ++
 .travis.yml                        | 10 +--------
 MAINTAINERS                        |  1 +
 block/ssh.c                        |  5 +----
 bsd-user/main.c                    |  2 +-
 cpus.c                             |  6 +++---
 hw/char/etraxfs_ser.c              |  4 +---
 hw/char/imx_serial.c               |  4 +++-
 hw/i386/kvm/pci-assign.c           |  1 -
 hw/i386/pc.c                       |  4 ++++
 hw/intc/xics.c                     |  2 +-
 hw/net/rocker/rocker.c             |  2 +-
 hw/net/rocker/rocker_desc.c        |  4 ++--
 hw/net/rocker/rocker_fp.c          |  2 +-
 hw/net/rocker/rocker_of_dpa.c      |  9 ++++----
 hw/ppc/ppc.c                       |  4 ++--
 hw/sd/sdhci.c                      | 43 ++++++++++++++++++++------------------
 hw/timer/m48t59.c                  |  4 +---
 include/qemu/timer.h               | 20 +++++++++---------
 linux-user/elfload.c               |  2 +-
 linux-user/main.c                  |  6 +++---
 linux-user/syscall.c               | 10 ++++-----
 qapi/block.json                    |  2 +-
 target-alpha/sys_helper.c          |  2 +-
 target-microblaze/op_helper.c      |  4 +---
 target-ppc/kvm.c                   |  3 +--
 tests/test-string-output-visitor.c | 16 +++++++-------
 27 files changed, 83 insertions(+), 91 deletions(-)
 create mode 100644 .dir-locals.el

^ permalink raw reply	[flat|nested] 22+ messages in thread

* [Qemu-devel] [PULL 01/19] Add .dir-locals.el file to configure emacs coding style
  2015-10-08 16:52 [Qemu-devel] [PULL 00/19] Trivial patches for 2015-10-08 Michael Tokarev
@ 2015-10-08 16:52 ` Michael Tokarev
  2015-10-09 12:25   ` Marc-André Lureau
  2015-10-08 16:52 ` [Qemu-devel] [PULL 02/19] sdhci: use PRIx64 for uint64_t type Michael Tokarev
                   ` (18 subsequent siblings)
  19 siblings, 1 reply; 22+ messages in thread
From: Michael Tokarev @ 2015-10-08 16:52 UTC (permalink / raw)
  To: qemu-devel; +Cc: qemu-trivial, Michael Tokarev

From: "Daniel P. Berrange" <berrange@redhat.com>

Some default emacs setups indent by 2 spaces and uses tabs
which is counter to the QEMU coding style rules. Adding a
.dir-locals.el file in the top level of the GIT repo will
inform emacs about the QEMU coding style, and so assist
contributors in avoiding common style mistakes before
they submit patches.

Signed-off-by: Daniel P. Berrange <berrange@redhat.com>
Reviewed-by: Markus Armbruster <armbru@redhat.com>
Signed-off-by: Michael Tokarev <mjt@tls.msk.ru>
---
 .dir-locals.el | 2 ++
 1 file changed, 2 insertions(+)
 create mode 100644 .dir-locals.el

diff --git a/.dir-locals.el b/.dir-locals.el
new file mode 100644
index 0000000..3ac0cfc
--- /dev/null
+++ b/.dir-locals.el
@@ -0,0 +1,2 @@
+((c-mode . ((c-file-style . "stroustrup")
+	    (indent-tabs-mode . nil))))
-- 
2.1.4

^ permalink raw reply related	[flat|nested] 22+ messages in thread

* [Qemu-devel] [PULL 02/19] sdhci: use PRIx64 for uint64_t type
  2015-10-08 16:52 [Qemu-devel] [PULL 00/19] Trivial patches for 2015-10-08 Michael Tokarev
  2015-10-08 16:52 ` [Qemu-devel] [PULL 01/19] Add .dir-locals.el file to configure emacs coding style Michael Tokarev
@ 2015-10-08 16:52 ` Michael Tokarev
  2015-10-08 16:52 ` [Qemu-devel] [PULL 03/19] sdhci: Change debug prints to compile unconditionally Michael Tokarev
                   ` (17 subsequent siblings)
  19 siblings, 0 replies; 22+ messages in thread
From: Michael Tokarev @ 2015-10-08 16:52 UTC (permalink / raw)
  To: qemu-devel
  Cc: Sai Pavan Boddu, qemu-trivial, Sai Pavan Boddu, Michael Tokarev

From: Sai Pavan Boddu <sai.pavan.boddu@xilinx.com>

Fix compile time warnings, because of type mismatch for unsigned long
long type.

Signed-off-by: Sai Pavan Boddu <saipava@xilinx.com>
Reviewed-by: Peter Crosthwaite <crosthwaite.peter@gmail.com>
Signed-off-by: Michael Tokarev <mjt@tls.msk.ru>
---
 hw/sd/sdhci.c | 7 +++++--
 1 file changed, 5 insertions(+), 2 deletions(-)

diff --git a/hw/sd/sdhci.c b/hw/sd/sdhci.c
index 65304cf..436448c 100644
--- a/hw/sd/sdhci.c
+++ b/hw/sd/sdhci.c
@@ -22,6 +22,7 @@
  * with this program; if not, see <http://www.gnu.org/licenses/>.
  */
 
+#include <inttypes.h>
 #include "hw/hw.h"
 #include "sysemu/block-backend.h"
 #include "sysemu/blockdev.h"
@@ -719,7 +720,8 @@ static void sdhci_do_adma(SDHCIState *s)
             break;
         case SDHC_ADMA_ATTR_ACT_LINK:   /* link to next descriptor table */
             s->admasysaddr = dscr.addr;
-            DPRINT_L1("ADMA link: admasysaddr=0x%lx\n", s->admasysaddr);
+            DPRINT_L1("ADMA link: admasysaddr=0x%" PRIx64 "\n",
+                      s->admasysaddr);
             break;
         default:
             s->admasysaddr += dscr.incr;
@@ -727,7 +729,8 @@ static void sdhci_do_adma(SDHCIState *s)
         }
 
         if (dscr.attr & SDHC_ADMA_ATTR_INT) {
-            DPRINT_L1("ADMA interrupt: admasysaddr=0x%lx\n", s->admasysaddr);
+            DPRINT_L1("ADMA interrupt: admasysaddr=0x%" PRIx64 "\n",
+                      s->admasysaddr);
             if (s->norintstsen & SDHC_NISEN_DMA) {
                 s->norintsts |= SDHC_NIS_DMA;
             }
-- 
2.1.4

^ permalink raw reply related	[flat|nested] 22+ messages in thread

* [Qemu-devel] [PULL 03/19] sdhci: Change debug prints to compile unconditionally
  2015-10-08 16:52 [Qemu-devel] [PULL 00/19] Trivial patches for 2015-10-08 Michael Tokarev
  2015-10-08 16:52 ` [Qemu-devel] [PULL 01/19] Add .dir-locals.el file to configure emacs coding style Michael Tokarev
  2015-10-08 16:52 ` [Qemu-devel] [PULL 02/19] sdhci: use PRIx64 for uint64_t type Michael Tokarev
@ 2015-10-08 16:52 ` Michael Tokarev
  2015-10-08 16:52 ` [Qemu-devel] [PULL 04/19] imx_serial: Generate interrupt on tx empty if enabled Michael Tokarev
                   ` (16 subsequent siblings)
  19 siblings, 0 replies; 22+ messages in thread
From: Michael Tokarev @ 2015-10-08 16:52 UTC (permalink / raw)
  To: qemu-devel
  Cc: Sai Pavan Boddu, qemu-trivial, Sai Pavan Boddu, Michael Tokarev

From: Sai Pavan Boddu <sai.pavan.boddu@xilinx.com>

Conditional compilation hides few type mismatch warnings, fix it to
compile unconditionally.

Signed-off-by: Sai Pavan Boddu <saipava@xilinx.com>
Suggested-by: Eric Blake <eblake@redhat.com>
Reviewed-by: Peter Crosthwaite <crosthwaite.peter@gmail.com>
Signed-off-by: Michael Tokarev <mjt@tls.msk.ru>
---
 hw/sd/sdhci.c | 36 ++++++++++++++++++------------------
 1 file changed, 18 insertions(+), 18 deletions(-)

diff --git a/hw/sd/sdhci.c b/hw/sd/sdhci.c
index 436448c..8b0f9f0 100644
--- a/hw/sd/sdhci.c
+++ b/hw/sd/sdhci.c
@@ -37,24 +37,24 @@
 #define SDHC_DEBUG                        0
 #endif
 
-#if SDHC_DEBUG == 0
-    #define DPRINT_L1(fmt, args...)       do { } while (0)
-    #define DPRINT_L2(fmt, args...)       do { } while (0)
-    #define ERRPRINT(fmt, args...)        do { } while (0)
-#elif SDHC_DEBUG == 1
-    #define DPRINT_L1(fmt, args...)       \
-        do {fprintf(stderr, "QEMU SDHC: "fmt, ## args); } while (0)
-    #define DPRINT_L2(fmt, args...)       do { } while (0)
-    #define ERRPRINT(fmt, args...)        \
-        do {fprintf(stderr, "QEMU SDHC ERROR: "fmt, ## args); } while (0)
-#else
-    #define DPRINT_L1(fmt, args...)       \
-        do {fprintf(stderr, "QEMU SDHC: "fmt, ## args); } while (0)
-    #define DPRINT_L2(fmt, args...)       \
-        do {fprintf(stderr, "QEMU SDHC: "fmt, ## args); } while (0)
-    #define ERRPRINT(fmt, args...)        \
-        do {fprintf(stderr, "QEMU SDHC ERROR: "fmt, ## args); } while (0)
-#endif
+#define DPRINT_L1(fmt, args...) \
+    do { \
+        if (SDHC_DEBUG) { \
+            fprintf(stderr, "QEMU SDHC: " fmt, ## args); \
+        } \
+    } while (0)
+#define DPRINT_L2(fmt, args...) \
+    do { \
+        if (SDHC_DEBUG > 1) { \
+            fprintf(stderr, "QEMU SDHC: " fmt, ## args); \
+        } \
+    } while (0)
+#define ERRPRINT(fmt, args...) \
+    do { \
+        if (SDHC_DEBUG) { \
+            fprintf(stderr, "QEMU SDHC ERROR: " fmt, ## args); \
+        } \
+    } while (0)
 
 /* Default SD/MMC host controller features information, which will be
  * presented in CAPABILITIES register of generic SD host controller at reset.
-- 
2.1.4

^ permalink raw reply related	[flat|nested] 22+ messages in thread

* [Qemu-devel] [PULL 04/19] imx_serial: Generate interrupt on tx empty if enabled
  2015-10-08 16:52 [Qemu-devel] [PULL 00/19] Trivial patches for 2015-10-08 Michael Tokarev
                   ` (2 preceding siblings ...)
  2015-10-08 16:52 ` [Qemu-devel] [PULL 03/19] sdhci: Change debug prints to compile unconditionally Michael Tokarev
@ 2015-10-08 16:52 ` Michael Tokarev
  2015-10-08 16:52 ` [Qemu-devel] [PULL 05/19] block/ssh: remove dead code Michael Tokarev
                   ` (15 subsequent siblings)
  19 siblings, 0 replies; 22+ messages in thread
From: Michael Tokarev @ 2015-10-08 16:52 UTC (permalink / raw)
  To: qemu-devel; +Cc: qemu-trivial, Michael Tokarev, Guenter Roeck

From: Guenter Roeck <linux@roeck-us.net>

Generate an interrupt if the tx buffer is empty and the tx empty interrupt
is enabled. This fixes a problem seen when running a Linux image since
Linux commit 55c3cb1358e ("serial: imx: remove unneeded imx_transmit_buffer()
from imx_start_tx()"). Linux now waits for the tx empty interrupt before
starting to send data, causing transmit stalls until there is an interrupt
for another reason.

Signed-off-by: Guenter Roeck <linux@roeck-us.net>
Reviewed-by: Peter Crosthwaite <crosthwaite.peter@gmail.com>
Signed-off-by: Michael Tokarev <mjt@tls.msk.ru>
---
 hw/char/imx_serial.c | 4 +++-
 1 file changed, 3 insertions(+), 1 deletion(-)

diff --git a/hw/char/imx_serial.c b/hw/char/imx_serial.c
index e8f32c4..f0c4c72 100644
--- a/hw/char/imx_serial.c
+++ b/hw/char/imx_serial.c
@@ -66,7 +66,9 @@ static void imx_update(IMXSerialState *s)
     uint32_t flags;
 
     flags = (s->usr1 & s->ucr1) & (USR1_TRDY|USR1_RRDY);
-    if (!(s->ucr1 & UCR1_TXMPTYEN)) {
+    if (s->ucr1 & UCR1_TXMPTYEN) {
+        flags |= (s->uts1 & UTS1_TXEMPTY);
+    } else {
         flags &= ~USR1_TRDY;
     }
 
-- 
2.1.4

^ permalink raw reply related	[flat|nested] 22+ messages in thread

* [Qemu-devel] [PULL 05/19] block/ssh: remove dead code
  2015-10-08 16:52 [Qemu-devel] [PULL 00/19] Trivial patches for 2015-10-08 Michael Tokarev
                   ` (3 preceding siblings ...)
  2015-10-08 16:52 ` [Qemu-devel] [PULL 04/19] imx_serial: Generate interrupt on tx empty if enabled Michael Tokarev
@ 2015-10-08 16:52 ` Michael Tokarev
  2015-10-08 16:52 ` [Qemu-devel] [PULL 06/19] pci-assign: do not include sys/io.h Michael Tokarev
                   ` (14 subsequent siblings)
  19 siblings, 0 replies; 22+ messages in thread
From: Michael Tokarev @ 2015-10-08 16:52 UTC (permalink / raw)
  To: qemu-devel; +Cc: qemu-trivial, Paolo Bonzini, Michael Tokarev

From: Paolo Bonzini <pbonzini@redhat.com>

The "err" label cannot be reached with qp != NULL.  Remove the free-ing
of qp and avoid future regressions by removing the initializer.

Signed-off-by: Paolo Bonzini <pbonzini@redhat.com>
ACKed-by: Richard W.M. Jones <rjones@redhat.com>
Reviewed-by: Fam Zheng <famz@redhat.com>
Signed-off-by: Michael Tokarev <mjt@tls.msk.ru>
---
 block/ssh.c | 5 +----
 1 file changed, 1 insertion(+), 4 deletions(-)

diff --git a/block/ssh.c b/block/ssh.c
index 8d06739..d35b51f 100644
--- a/block/ssh.c
+++ b/block/ssh.c
@@ -193,7 +193,7 @@ sftp_error_report(BDRVSSHState *s, const char *fs, ...)
 static int parse_uri(const char *filename, QDict *options, Error **errp)
 {
     URI *uri = NULL;
-    QueryParams *qp = NULL;
+    QueryParams *qp;
     int i;
 
     uri = uri_parse(filename);
@@ -249,9 +249,6 @@ static int parse_uri(const char *filename, QDict *options, Error **errp)
     return 0;
 
  err:
-    if (qp) {
-      query_params_free(qp);
-    }
     if (uri) {
       uri_free(uri);
     }
-- 
2.1.4

^ permalink raw reply related	[flat|nested] 22+ messages in thread

* [Qemu-devel] [PULL 06/19] pci-assign: do not include sys/io.h
  2015-10-08 16:52 [Qemu-devel] [PULL 00/19] Trivial patches for 2015-10-08 Michael Tokarev
                   ` (4 preceding siblings ...)
  2015-10-08 16:52 ` [Qemu-devel] [PULL 05/19] block/ssh: remove dead code Michael Tokarev
@ 2015-10-08 16:52 ` Michael Tokarev
  2015-10-08 16:52 ` [Qemu-devel] [PULL 07/19] pc: check for underflow in load_linux Michael Tokarev
                   ` (13 subsequent siblings)
  19 siblings, 0 replies; 22+ messages in thread
From: Michael Tokarev @ 2015-10-08 16:52 UTC (permalink / raw)
  To: qemu-devel; +Cc: qemu-trivial, Paolo Bonzini, Michael Tokarev

From: Paolo Bonzini <pbonzini@redhat.com>

This file does not exist on bionic libc and the functions it defines
are in fact not used by pci-assign.c.  Remove it.

Reported-by: Houcheng Lin <houcheng@gmail.com>
Signed-off-by: Paolo Bonzini <pbonzini@redhat.com>
Signed-off-by: Michael Tokarev <mjt@tls.msk.ru>
---
 hw/i386/kvm/pci-assign.c | 1 -
 1 file changed, 1 deletion(-)

diff --git a/hw/i386/kvm/pci-assign.c b/hw/i386/kvm/pci-assign.c
index b1beaa6..44beee3 100644
--- a/hw/i386/kvm/pci-assign.c
+++ b/hw/i386/kvm/pci-assign.c
@@ -22,7 +22,6 @@
  */
 #include <stdio.h>
 #include <unistd.h>
-#include <sys/io.h>
 #include <sys/mman.h>
 #include <sys/types.h>
 #include <sys/stat.h>
-- 
2.1.4

^ permalink raw reply related	[flat|nested] 22+ messages in thread

* [Qemu-devel] [PULL 07/19] pc: check for underflow in load_linux
  2015-10-08 16:52 [Qemu-devel] [PULL 00/19] Trivial patches for 2015-10-08 Michael Tokarev
                   ` (5 preceding siblings ...)
  2015-10-08 16:52 ` [Qemu-devel] [PULL 06/19] pci-assign: do not include sys/io.h Michael Tokarev
@ 2015-10-08 16:52 ` Michael Tokarev
  2015-10-08 16:52 ` [Qemu-devel] [PULL 08/19] s/cpu_get_real_ticks/cpu_get_host_ticks/ Michael Tokarev
                   ` (12 subsequent siblings)
  19 siblings, 0 replies; 22+ messages in thread
From: Michael Tokarev @ 2015-10-08 16:52 UTC (permalink / raw)
  To: qemu-devel; +Cc: qemu-trivial, Paolo Bonzini, Michael Tokarev

From: Paolo Bonzini <pbonzini@redhat.com>

If (setup_size+1)*512 is small enough, kernel_size -= setup_size can allocate
a huge amount of memory.  Avoid that.

Signed-off-by: Paolo Bonzini <pbonzini@redhat.com>
Signed-off-by: Michael Tokarev <mjt@tls.msk.ru>
---
 hw/i386/pc.c | 4 ++++
 1 file changed, 4 insertions(+)

diff --git a/hw/i386/pc.c b/hw/i386/pc.c
index 9275297..682867a 100644
--- a/hw/i386/pc.c
+++ b/hw/i386/pc.c
@@ -985,6 +985,10 @@ static void load_linux(PCMachineState *pcms,
         setup_size = 4;
     }
     setup_size = (setup_size+1)*512;
+    if (setup_size > kernel_size) {
+        fprintf(stderr, "qemu: invalid kernel header\n");
+        exit(1);
+    }
     kernel_size -= setup_size;
 
     setup  = g_malloc(setup_size);
-- 
2.1.4

^ permalink raw reply related	[flat|nested] 22+ messages in thread

* [Qemu-devel] [PULL 08/19] s/cpu_get_real_ticks/cpu_get_host_ticks/
  2015-10-08 16:52 [Qemu-devel] [PULL 00/19] Trivial patches for 2015-10-08 Michael Tokarev
                   ` (6 preceding siblings ...)
  2015-10-08 16:52 ` [Qemu-devel] [PULL 07/19] pc: check for underflow in load_linux Michael Tokarev
@ 2015-10-08 16:52 ` Michael Tokarev
  2015-10-08 16:52 ` [Qemu-devel] [PULL 09/19] target-microblaze: Remove unnecessary variable Michael Tokarev
                   ` (11 subsequent siblings)
  19 siblings, 0 replies; 22+ messages in thread
From: Michael Tokarev @ 2015-10-08 16:52 UTC (permalink / raw)
  To: qemu-devel; +Cc: qemu-trivial, Michael Tokarev, Christopher Covington

From: Christopher Covington <cov@codeaurora.org>

This should help clarify the purpose of the function that returns
the host system's CPU cycle count.

Signed-off-by: Christopher Covington <cov@codeaurora.org>
Acked-by: Paolo Bonzini <pbonzini@redhat.com>
ppc portion
Acked-by: David Gibson <david@gibson.dropbear.id.au>
Signed-off-by: Michael Tokarev <mjt@tls.msk.ru>
---
 bsd-user/main.c           |  2 +-
 cpus.c                    |  6 +++---
 hw/intc/xics.c            |  2 +-
 hw/ppc/ppc.c              |  4 ++--
 include/qemu/timer.h      | 20 ++++++++++----------
 linux-user/main.c         |  4 ++--
 target-alpha/sys_helper.c |  2 +-
 7 files changed, 20 insertions(+), 20 deletions(-)

diff --git a/bsd-user/main.c b/bsd-user/main.c
index f0a1268..adf2de0 100644
--- a/bsd-user/main.c
+++ b/bsd-user/main.c
@@ -108,7 +108,7 @@ void cpu_list_unlock(void)
 
 uint64_t cpu_get_tsc(CPUX86State *env)
 {
-    return cpu_get_real_ticks();
+    return cpu_get_host_ticks();
 }
 
 static void write_dt(void *ptr, unsigned long addr, unsigned long limit,
diff --git a/cpus.c b/cpus.c
index d44c0ed..d2e9e4f 100644
--- a/cpus.c
+++ b/cpus.c
@@ -199,7 +199,7 @@ int64_t cpu_get_ticks(void)
 
     ticks = timers_state.cpu_ticks_offset;
     if (timers_state.cpu_ticks_enabled) {
-        ticks += cpu_get_real_ticks();
+        ticks += cpu_get_host_ticks();
     }
 
     if (timers_state.cpu_ticks_prev > ticks) {
@@ -247,7 +247,7 @@ void cpu_enable_ticks(void)
     /* Here, the really thing protected by seqlock is cpu_clock_offset. */
     seqlock_write_lock(&timers_state.vm_clock_seqlock);
     if (!timers_state.cpu_ticks_enabled) {
-        timers_state.cpu_ticks_offset -= cpu_get_real_ticks();
+        timers_state.cpu_ticks_offset -= cpu_get_host_ticks();
         timers_state.cpu_clock_offset -= get_clock();
         timers_state.cpu_ticks_enabled = 1;
     }
@@ -263,7 +263,7 @@ void cpu_disable_ticks(void)
     /* Here, the really thing protected by seqlock is cpu_clock_offset. */
     seqlock_write_lock(&timers_state.vm_clock_seqlock);
     if (timers_state.cpu_ticks_enabled) {
-        timers_state.cpu_ticks_offset += cpu_get_real_ticks();
+        timers_state.cpu_ticks_offset += cpu_get_host_ticks();
         timers_state.cpu_clock_offset = cpu_get_clock_locked();
         timers_state.cpu_ticks_enabled = 0;
     }
diff --git a/hw/intc/xics.c b/hw/intc/xics.c
index 67881c7..9ff5796 100644
--- a/hw/intc/xics.c
+++ b/hw/intc/xics.c
@@ -848,7 +848,7 @@ static target_ulong h_xirr_x(PowerPCCPU *cpu, sPAPRMachineState *spapr,
     uint32_t xirr = icp_accept(ss);
 
     args[0] = xirr;
-    args[1] = cpu_get_real_ticks();
+    args[1] = cpu_get_host_ticks();
     return H_SUCCESS;
 }
 
diff --git a/hw/ppc/ppc.c b/hw/ppc/ppc.c
index b77e303..2c604ef 100644
--- a/hw/ppc/ppc.c
+++ b/hw/ppc/ppc.c
@@ -834,7 +834,7 @@ static void cpu_ppc_set_tb_clk (void *opaque, uint32_t freq)
 static void timebase_pre_save(void *opaque)
 {
     PPCTimebase *tb = opaque;
-    uint64_t ticks = cpu_get_real_ticks();
+    uint64_t ticks = cpu_get_host_ticks();
     PowerPCCPU *first_ppc_cpu = POWERPC_CPU(first_cpu);
 
     if (!first_ppc_cpu->env.tb_env) {
@@ -878,7 +878,7 @@ static int timebase_post_load(void *opaque, int version_id)
                                      NANOSECONDS_PER_SECOND);
     guest_tb = tb_remote->guest_timebase + MIN(0, migration_duration_tb);
 
-    tb_off_adj = guest_tb - cpu_get_real_ticks();
+    tb_off_adj = guest_tb - cpu_get_host_ticks();
 
     tb_off = first_ppc_cpu->env.tb_env->tb_offset;
     trace_ppc_tb_adjust(tb_off, tb_off_adj, tb_off_adj - tb_off,
diff --git a/include/qemu/timer.h b/include/qemu/timer.h
index 9939246..d0946cb 100644
--- a/include/qemu/timer.h
+++ b/include/qemu/timer.h
@@ -857,7 +857,7 @@ int64_t cpu_icount_to_ns(int64_t icount);
 
 #if defined(_ARCH_PPC)
 
-static inline int64_t cpu_get_real_ticks(void)
+static inline int64_t cpu_get_host_ticks(void)
 {
     int64_t retval;
 #ifdef _ARCH_PPC64
@@ -883,7 +883,7 @@ static inline int64_t cpu_get_real_ticks(void)
 
 #elif defined(__i386__)
 
-static inline int64_t cpu_get_real_ticks(void)
+static inline int64_t cpu_get_host_ticks(void)
 {
     int64_t val;
     asm volatile ("rdtsc" : "=A" (val));
@@ -892,7 +892,7 @@ static inline int64_t cpu_get_real_ticks(void)
 
 #elif defined(__x86_64__)
 
-static inline int64_t cpu_get_real_ticks(void)
+static inline int64_t cpu_get_host_ticks(void)
 {
     uint32_t low,high;
     int64_t val;
@@ -905,7 +905,7 @@ static inline int64_t cpu_get_real_ticks(void)
 
 #elif defined(__hppa__)
 
-static inline int64_t cpu_get_real_ticks(void)
+static inline int64_t cpu_get_host_ticks(void)
 {
     int val;
     asm volatile ("mfctl %%cr16, %0" : "=r"(val));
@@ -914,7 +914,7 @@ static inline int64_t cpu_get_real_ticks(void)
 
 #elif defined(__ia64)
 
-static inline int64_t cpu_get_real_ticks(void)
+static inline int64_t cpu_get_host_ticks(void)
 {
     int64_t val;
     asm volatile ("mov %0 = ar.itc" : "=r"(val) :: "memory");
@@ -923,7 +923,7 @@ static inline int64_t cpu_get_real_ticks(void)
 
 #elif defined(__s390__)
 
-static inline int64_t cpu_get_real_ticks(void)
+static inline int64_t cpu_get_host_ticks(void)
 {
     int64_t val;
     asm volatile("stck 0(%1)" : "=m" (val) : "a" (&val) : "cc");
@@ -932,7 +932,7 @@ static inline int64_t cpu_get_real_ticks(void)
 
 #elif defined(__sparc__)
 
-static inline int64_t cpu_get_real_ticks (void)
+static inline int64_t cpu_get_host_ticks (void)
 {
 #if defined(_LP64)
     uint64_t        rval;
@@ -970,7 +970,7 @@ static inline int64_t cpu_get_real_ticks (void)
                               : "=r" (value));          \
     }
 
-static inline int64_t cpu_get_real_ticks(void)
+static inline int64_t cpu_get_host_ticks(void)
 {
     /* On kernels >= 2.6.25 rdhwr <reg>, $2 and $3 are emulated */
     uint32_t count;
@@ -986,7 +986,7 @@ static inline int64_t cpu_get_real_ticks(void)
 
 #elif defined(__alpha__)
 
-static inline int64_t cpu_get_real_ticks(void)
+static inline int64_t cpu_get_host_ticks(void)
 {
     uint64_t cc;
     uint32_t cur, ofs;
@@ -1001,7 +1001,7 @@ static inline int64_t cpu_get_real_ticks(void)
 /* The host CPU doesn't have an easily accessible cycle counter.
    Just return a monotonically increasing value.  This will be
    totally wrong, but hopefully better than nothing.  */
-static inline int64_t cpu_get_real_ticks (void)
+static inline int64_t cpu_get_host_ticks (void)
 {
     static int64_t ticks = 0;
     return ticks++;
diff --git a/linux-user/main.c b/linux-user/main.c
index 1f60ff2..d6af7ca 100644
--- a/linux-user/main.c
+++ b/linux-user/main.c
@@ -215,7 +215,7 @@ void cpu_list_unlock(void)
 
 uint64_t cpu_get_tsc(CPUX86State *env)
 {
-    return cpu_get_real_ticks();
+    return cpu_get_host_ticks();
 }
 
 static void write_dt(void *ptr, unsigned long addr, unsigned long limit,
@@ -1425,7 +1425,7 @@ void cpu_loop (CPUSPARCState *env)
 #ifdef TARGET_PPC
 static inline uint64_t cpu_ppc_get_tb(CPUPPCState *env)
 {
-    return cpu_get_real_ticks();
+    return cpu_get_host_ticks();
 }
 
 uint64_t cpu_ppc_load_tbl(CPUPPCState *env)
diff --git a/target-alpha/sys_helper.c b/target-alpha/sys_helper.c
index 1f0e1a9..75c96c1 100644
--- a/target-alpha/sys_helper.c
+++ b/target-alpha/sys_helper.c
@@ -34,7 +34,7 @@ uint64_t helper_load_pcc(CPUAlphaState *env)
 #else
     /* In user-mode, QEMU_CLOCK_VIRTUAL doesn't exist.  Just pass through the host cpu
        clock ticks.  Also, don't bother taking PCC_OFS into account.  */
-    return (uint32_t)cpu_get_real_ticks();
+    return (uint32_t)cpu_get_host_ticks();
 #endif
 }
 
-- 
2.1.4

^ permalink raw reply related	[flat|nested] 22+ messages in thread

* [Qemu-devel] [PULL 09/19] target-microblaze: Remove unnecessary variable
  2015-10-08 16:52 [Qemu-devel] [PULL 00/19] Trivial patches for 2015-10-08 Michael Tokarev
                   ` (7 preceding siblings ...)
  2015-10-08 16:52 ` [Qemu-devel] [PULL 08/19] s/cpu_get_real_ticks/cpu_get_host_ticks/ Michael Tokarev
@ 2015-10-08 16:52 ` Michael Tokarev
  2015-10-08 16:52 ` [Qemu-devel] [PULL 10/19] target-ppc: " Michael Tokarev
                   ` (10 subsequent siblings)
  19 siblings, 0 replies; 22+ messages in thread
From: Michael Tokarev @ 2015-10-08 16:52 UTC (permalink / raw)
  To: qemu-devel; +Cc: qemu-trivial, Michael Tokarev, Shraddha Barke

From: Shraddha Barke <shraddha.6596@gmail.com>

Compress lines and remove the variable.

Signed-off-by: Shraddha Barke <shraddha.6596@gmail.com>
Signed-off-by: Michael Tokarev <mjt@tls.msk.ru>
---
 target-microblaze/op_helper.c | 4 +---
 1 file changed, 1 insertion(+), 3 deletions(-)

diff --git a/target-microblaze/op_helper.c b/target-microblaze/op_helper.c
index 092c4b5..d324347 100644
--- a/target-microblaze/op_helper.c
+++ b/target-microblaze/op_helper.c
@@ -150,9 +150,7 @@ uint32_t helper_clz(uint32_t t0)
 
 uint32_t helper_carry(uint32_t a, uint32_t b, uint32_t cf)
 {
-    uint32_t ncf;
-    ncf = compute_carry(a, b, cf);
-    return ncf;
+    return compute_carry(a, b, cf);
 }
 
 static inline int div_prepare(CPUMBState *env, uint32_t a, uint32_t b)
-- 
2.1.4

^ permalink raw reply related	[flat|nested] 22+ messages in thread

* [Qemu-devel] [PULL 10/19] target-ppc: Remove unnecessary variable
  2015-10-08 16:52 [Qemu-devel] [PULL 00/19] Trivial patches for 2015-10-08 Michael Tokarev
                   ` (8 preceding siblings ...)
  2015-10-08 16:52 ` [Qemu-devel] [PULL 09/19] target-microblaze: Remove unnecessary variable Michael Tokarev
@ 2015-10-08 16:52 ` Michael Tokarev
  2015-10-08 16:52 ` [Qemu-devel] [PULL 11/19] MAINTAINERS: Add NSIS file for W32, W64 hosts Michael Tokarev
                   ` (9 subsequent siblings)
  19 siblings, 0 replies; 22+ messages in thread
From: Michael Tokarev @ 2015-10-08 16:52 UTC (permalink / raw)
  To: qemu-devel; +Cc: qemu-trivial, Michael Tokarev, Shraddha Barke

From: Shraddha Barke <shraddha.6596@gmail.com>

Compress lines and remove the variable.

Signed-off-by: Shraddha Barke <shraddha.6596@gmail.com>
Signed-off-by: Michael Tokarev <mjt@tls.msk.ru>
---
 target-ppc/kvm.c | 3 +--
 1 file changed, 1 insertion(+), 2 deletions(-)

diff --git a/target-ppc/kvm.c b/target-ppc/kvm.c
index e641680..f8ea783 100644
--- a/target-ppc/kvm.c
+++ b/target-ppc/kvm.c
@@ -1782,8 +1782,7 @@ uint32_t kvmppc_get_tbfreq(void)
 
     ns++;
 
-    retval = atoi(ns);
-    return retval;
+    return atoi(ns);
 }
 
 bool kvmppc_get_host_serial(char **value)
-- 
2.1.4

^ permalink raw reply related	[flat|nested] 22+ messages in thread

* [Qemu-devel] [PULL 11/19] MAINTAINERS: Add NSIS file for W32, W64 hosts
  2015-10-08 16:52 [Qemu-devel] [PULL 00/19] Trivial patches for 2015-10-08 Michael Tokarev
                   ` (9 preceding siblings ...)
  2015-10-08 16:52 ` [Qemu-devel] [PULL 10/19] target-ppc: " Michael Tokarev
@ 2015-10-08 16:52 ` Michael Tokarev
  2015-10-08 16:52 ` [Qemu-devel] [PULL 12/19] qapi: add missing @ Michael Tokarev
                   ` (8 subsequent siblings)
  19 siblings, 0 replies; 22+ messages in thread
From: Michael Tokarev @ 2015-10-08 16:52 UTC (permalink / raw)
  To: qemu-devel; +Cc: qemu-trivial, Stefan Weil, Michael Tokarev

From: Stefan Weil <sw@weilnetz.de>

The NSIS installer configuration is maintained by me.

Signed-off-by: Stefan Weil <sw@weilnetz.de>
Signed-off-by: Michael Tokarev <mjt@tls.msk.ru>
---
 MAINTAINERS | 1 +
 1 file changed, 1 insertion(+)

diff --git a/MAINTAINERS b/MAINTAINERS
index 7603ea2..9bde832 100644
--- a/MAINTAINERS
+++ b/MAINTAINERS
@@ -275,6 +275,7 @@ L: qemu-devel@nongnu.org
 M: Stefan Weil <sw@weilnetz.de>
 S: Maintained
 F: *win32*
+F: qemu.nsi
 
 ARM Machines
 ------------
-- 
2.1.4

^ permalink raw reply related	[flat|nested] 22+ messages in thread

* [Qemu-devel] [PULL 12/19] qapi: add missing @
  2015-10-08 16:52 [Qemu-devel] [PULL 00/19] Trivial patches for 2015-10-08 Michael Tokarev
                   ` (10 preceding siblings ...)
  2015-10-08 16:52 ` [Qemu-devel] [PULL 11/19] MAINTAINERS: Add NSIS file for W32, W64 hosts Michael Tokarev
@ 2015-10-08 16:52 ` Michael Tokarev
  2015-10-08 16:52 ` [Qemu-devel] [PULL 13/19] hw: timer: Remove unnecessary variable Michael Tokarev
                   ` (7 subsequent siblings)
  19 siblings, 0 replies; 22+ messages in thread
From: Michael Tokarev @ 2015-10-08 16:52 UTC (permalink / raw)
  To: qemu-devel; +Cc: qemu-trivial, Marc-André Lureau, Michael Tokarev

From: Marc-André Lureau <marcandre.lureau@redhat.com>

Signed-off-by: Marc-André Lureau <marcandre.lureau@redhat.com>
Reviewed-by: Eric Blake <eblake@redhat.com>
Signed-off-by: Michael Tokarev <mjt@tls.msk.ru>
---
 qapi/block.json | 2 +-
 1 file changed, 1 insertion(+), 1 deletion(-)

diff --git a/qapi/block.json b/qapi/block.json
index aad645c..84022f1 100644
--- a/qapi/block.json
+++ b/qapi/block.json
@@ -6,7 +6,7 @@
 { 'include': 'block-core.json' }
 
 ##
-# BiosAtaTranslation:
+# @BiosAtaTranslation:
 #
 # Policy that BIOS should use to interpret cylinder/head/sector
 # addresses.  Note that Bochs BIOS and SeaBIOS will not actually
-- 
2.1.4

^ permalink raw reply related	[flat|nested] 22+ messages in thread

* [Qemu-devel] [PULL 13/19] hw: timer: Remove unnecessary variable
  2015-10-08 16:52 [Qemu-devel] [PULL 00/19] Trivial patches for 2015-10-08 Michael Tokarev
                   ` (11 preceding siblings ...)
  2015-10-08 16:52 ` [Qemu-devel] [PULL 12/19] qapi: add missing @ Michael Tokarev
@ 2015-10-08 16:52 ` Michael Tokarev
  2015-10-08 16:52 ` [Qemu-devel] [PULL 14/19] hw: char: " Michael Tokarev
                   ` (6 subsequent siblings)
  19 siblings, 0 replies; 22+ messages in thread
From: Michael Tokarev @ 2015-10-08 16:52 UTC (permalink / raw)
  To: qemu-devel; +Cc: qemu-trivial, Michael Tokarev, Shraddha Barke

From: Shraddha Barke <shraddha.6596@gmail.com>

Compress lines and remove the variable.

Signed-off-by: Shraddha Barke <shraddha.6596@gmail.com>
Signed-off-by: Michael Tokarev <mjt@tls.msk.ru>
---
 hw/timer/m48t59.c | 4 +---
 1 file changed, 1 insertion(+), 3 deletions(-)

diff --git a/hw/timer/m48t59.c b/hw/timer/m48t59.c
index 8ab683d..b3df8f9 100644
--- a/hw/timer/m48t59.c
+++ b/hw/timer/m48t59.c
@@ -590,10 +590,8 @@ static void nvram_writel (void *opaque, hwaddr addr, uint32_t value)
 static uint32_t nvram_readb (void *opaque, hwaddr addr)
 {
     M48t59State *NVRAM = opaque;
-    uint32_t retval;
 
-    retval = m48t59_read(NVRAM, addr);
-    return retval;
+    return m48t59_read(NVRAM, addr);
 }
 
 static uint32_t nvram_readw (void *opaque, hwaddr addr)
-- 
2.1.4

^ permalink raw reply related	[flat|nested] 22+ messages in thread

* [Qemu-devel] [PULL 14/19] hw: char: Remove unnecessary variable
  2015-10-08 16:52 [Qemu-devel] [PULL 00/19] Trivial patches for 2015-10-08 Michael Tokarev
                   ` (12 preceding siblings ...)
  2015-10-08 16:52 ` [Qemu-devel] [PULL 13/19] hw: timer: Remove unnecessary variable Michael Tokarev
@ 2015-10-08 16:52 ` Michael Tokarev
  2015-10-08 16:52 ` [Qemu-devel] [PULL 15/19] .travis.yml: Run make check for all targets, not just some Michael Tokarev
                   ` (5 subsequent siblings)
  19 siblings, 0 replies; 22+ messages in thread
From: Michael Tokarev @ 2015-10-08 16:52 UTC (permalink / raw)
  To: qemu-devel; +Cc: qemu-trivial, Michael Tokarev, Shraddha Barke

From: Shraddha Barke <shraddha.6596@gmail.com>

Compress lines and remove the variable.

Signed-off-by: Shraddha Barke <shraddha.6596@gmail.com>
Signed-off-by: Michael Tokarev <mjt@tls.msk.ru>
---
 hw/char/etraxfs_ser.c | 4 +---
 1 file changed, 1 insertion(+), 3 deletions(-)

diff --git a/hw/char/etraxfs_ser.c b/hw/char/etraxfs_ser.c
index 857c136..562021e 100644
--- a/hw/char/etraxfs_ser.c
+++ b/hw/char/etraxfs_ser.c
@@ -182,15 +182,13 @@ static void serial_receive(void *opaque, const uint8_t *buf, int size)
 static int serial_can_receive(void *opaque)
 {
     ETRAXSerial *s = opaque;
-    int r;
 
     /* Is the receiver enabled?  */
     if (!(s->regs[RW_REC_CTRL] & (1 << 3))) {
         return 0;
     }
 
-    r = sizeof(s->rx_fifo) - s->rx_fifo_len;
-    return r;
+    return sizeof(s->rx_fifo) - s->rx_fifo_len;
 }
 
 static void serial_event(void *opaque, int event)
-- 
2.1.4

^ permalink raw reply related	[flat|nested] 22+ messages in thread

* [Qemu-devel] [PULL 15/19] .travis.yml: Run make check for all targets, not just some
  2015-10-08 16:52 [Qemu-devel] [PULL 00/19] Trivial patches for 2015-10-08 Michael Tokarev
                   ` (13 preceding siblings ...)
  2015-10-08 16:52 ` [Qemu-devel] [PULL 14/19] hw: char: " Michael Tokarev
@ 2015-10-08 16:52 ` Michael Tokarev
  2015-10-08 16:52 ` [Qemu-devel] [PULL 16/19] rocker: Use g_new() & friends where that makes obvious sense Michael Tokarev
                   ` (4 subsequent siblings)
  19 siblings, 0 replies; 22+ messages in thread
From: Michael Tokarev @ 2015-10-08 16:52 UTC (permalink / raw)
  To: qemu-devel; +Cc: qemu-trivial, Michael Tokarev, David Gibson

From: David Gibson <david@gibson.dropbear.id.au>

ed173cb ".travis.yml: remove "make check" from main matrix" stopped running
make check for all the Travis build targets for various reasons.  It
continued to run make check on one Travis build, which builds for a big
list of all (? nearly all) our supported softmmu targets.

Unfortunately, due to a spacing / quoting error it only actually builds for
the alpha, arm, aarch64 and cris targets.  Specifically, the list of
targets is split over several lines.  Even with YAML folding, this will
leave spaces in the list, meaning $TARGETS won't have the value we need.

I had a look at the YAML spec and I couldn't quickly see a way of splitting
the list so that it doesn't end up with spaces, so this patch fixes the
problem by putting the whole list on one huge line.

Signed-off-by: David Gibson <david@gibson.dropbear.id.au>
Signed-off-by: Michael Tokarev <mjt@tls.msk.ru>
---
 .travis.yml | 10 +---------
 1 file changed, 1 insertion(+), 9 deletions(-)

diff --git a/.travis.yml b/.travis.yml
index 0ac170b..6ca0260 100644
--- a/.travis.yml
+++ b/.travis.yml
@@ -54,15 +54,7 @@ matrix:
   include:
     # Make check target (we only do this once)
     - env:
-        - TARGETS=alpha-softmmu,arm-softmmu,aarch64-softmmu,cris-softmmu,
-                  i386-softmmu,x86_64-softmmu,m68k-softmmu,microblaze-softmmu,
-                  microblazeel-softmmu,mips-softmmu,mips64-softmmu,
-                  mips64el-softmmu,mipsel-softmmu,or32-softmmu,ppc-softmmu,
-                  ppc64-softmmu,ppcemb-softmmu,s390x-softmmu,sh4-softmmu,
-                  sh4eb-softmmu,sparc-softmmu,sparc64-softmmu,
-                  unicore32-softmmu,unicore32-linux-user,
-                  lm32-softmmu,moxie-softmmu,tricore-softmmu,xtensa-softmmu,
-                  xtensaeb-softmmu
+        - TARGETS=alpha-softmmu,arm-softmmu,aarch64-softmmu,cris-softmmu,i386-softmmu,x86_64-softmmu,m68k-softmmu,microblaze-softmmu,microblazeel-softmmu,mips-softmmu,mips64-softmmu,mips64el-softmmu,mipsel-softmmu,or32-softmmu,ppc-softmmu,ppc64-softmmu,ppcemb-softmmu,s390x-softmmu,sh4-softmmu,sh4eb-softmmu,sparc-softmmu,sparc64-softmmu,unicore32-softmmu,unicore32-linux-user,lm32-softmmu,moxie-softmmu,tricore-softmmu,xtensa-softmmu,xtensaeb-softmmu
           TEST_CMD="make check"
       compiler: gcc
     # Debug related options
-- 
2.1.4

^ permalink raw reply related	[flat|nested] 22+ messages in thread

* [Qemu-devel] [PULL 16/19] rocker: Use g_new() & friends where that makes obvious sense
  2015-10-08 16:52 [Qemu-devel] [PULL 00/19] Trivial patches for 2015-10-08 Michael Tokarev
                   ` (14 preceding siblings ...)
  2015-10-08 16:52 ` [Qemu-devel] [PULL 15/19] .travis.yml: Run make check for all targets, not just some Michael Tokarev
@ 2015-10-08 16:52 ` Michael Tokarev
  2015-10-08 16:52 ` [Qemu-devel] [PULL 17/19] linux-user: " Michael Tokarev
                   ` (3 subsequent siblings)
  19 siblings, 0 replies; 22+ messages in thread
From: Michael Tokarev @ 2015-10-08 16:52 UTC (permalink / raw)
  To: qemu-devel; +Cc: qemu-trivial, Michael Tokarev, Markus Armbruster

From: Markus Armbruster <armbru@redhat.com>

g_new(T, n) is neater than g_malloc(sizeof(T) * n).  It's also safer,
for two reasons.  One, it catches multiplication overflowing size_t.
Two, it returns T * rather than void *, which lets the compiler catch
more type errors.

This commit only touches allocations with size arguments of the form
sizeof(T).  Same Coccinelle semantic patchas in commit b45c03f.

Signed-off-by: Markus Armbruster <armbru@redhat.com>
Acked-by: Jiri Pirko <jiri@resnulli.us>
Reviewed-by: Eric Blake <eblake@redhat.com>
Reviewed-by: Jiri Pirko <jiri@mellanox.com>
Signed-off-by: Michael Tokarev <mjt@tls.msk.ru>
---
 hw/net/rocker/rocker.c        | 2 +-
 hw/net/rocker/rocker_desc.c   | 4 ++--
 hw/net/rocker/rocker_fp.c     | 2 +-
 hw/net/rocker/rocker_of_dpa.c | 9 ++++-----
 4 files changed, 8 insertions(+), 9 deletions(-)

diff --git a/hw/net/rocker/rocker.c b/hw/net/rocker/rocker.c
index 7e7bda4..bb6fdc3 100644
--- a/hw/net/rocker/rocker.c
+++ b/hw/net/rocker/rocker.c
@@ -1362,7 +1362,7 @@ static int pci_rocker_init(PCIDevice *dev)
         r->fp_ports = ROCKER_FP_PORTS_MAX;
     }
 
-    r->rings = g_malloc(sizeof(DescRing *) * rocker_pci_ring_count(r));
+    r->rings = g_new(DescRing *, rocker_pci_ring_count(r));
     if (!r->rings) {
         goto err_rings_alloc;
     }
diff --git a/hw/net/rocker/rocker_desc.c b/hw/net/rocker/rocker_desc.c
index b5c0b4a..5e697b1 100644
--- a/hw/net/rocker/rocker_desc.c
+++ b/hw/net/rocker/rocker_desc.c
@@ -142,7 +142,7 @@ bool desc_ring_set_size(DescRing *ring, uint32_t size)
     ring->size = size;
     ring->head = ring->tail = 0;
 
-    ring->info = g_realloc(ring->info, size * sizeof(DescInfo));
+    ring->info = g_renew(DescInfo, ring->info, size);
     if (!ring->info) {
         return false;
     }
@@ -345,7 +345,7 @@ DescRing *desc_ring_alloc(Rocker *r, int index)
 {
     DescRing *ring;
 
-    ring = g_malloc0(sizeof(DescRing));
+    ring = g_new0(DescRing, 1);
     if (!ring) {
         return NULL;
     }
diff --git a/hw/net/rocker/rocker_fp.c b/hw/net/rocker/rocker_fp.c
index c693ae5..5906396 100644
--- a/hw/net/rocker/rocker_fp.c
+++ b/hw/net/rocker/rocker_fp.c
@@ -218,7 +218,7 @@ FpPort *fp_port_alloc(Rocker *r, char *sw_name,
                       MACAddr *start_mac, unsigned int index,
                       NICPeers *peers)
 {
-    FpPort *port = g_malloc0(sizeof(FpPort));
+    FpPort *port = g_new0(FpPort, 1);
 
     if (!port) {
         return NULL;
diff --git a/hw/net/rocker/rocker_of_dpa.c b/hw/net/rocker/rocker_of_dpa.c
index 874fb01..1ad2791 100644
--- a/hw/net/rocker/rocker_of_dpa.c
+++ b/hw/net/rocker/rocker_of_dpa.c
@@ -367,7 +367,7 @@ static OfDpaFlow *of_dpa_flow_alloc(uint64_t cookie)
     OfDpaFlow *flow;
     int64_t now = qemu_clock_get_ms(QEMU_CLOCK_VIRTUAL) / 1000;
 
-    flow = g_malloc0(sizeof(OfDpaFlow));
+    flow = g_new0(OfDpaFlow, 1);
     if (!flow) {
         return NULL;
     }
@@ -811,7 +811,7 @@ static int of_dpa_group_get_stats(OfDpa *of_dpa, uint32_t id)
 
 static OfDpaGroup *of_dpa_group_alloc(uint32_t id)
 {
-    OfDpaGroup *group = g_malloc0(sizeof(OfDpaGroup));
+    OfDpaGroup *group = g_new0(OfDpaGroup, 1);
 
     if (!group) {
         return NULL;
@@ -2039,15 +2039,14 @@ static int of_dpa_cmd_add_l2_flood(OfDpa *of_dpa, OfDpaGroup *group,
     group->l2_flood.group_count =
         rocker_tlv_get_le16(group_tlvs[ROCKER_TLV_OF_DPA_GROUP_COUNT]);
 
-    tlvs = g_malloc0((group->l2_flood.group_count + 1) *
-                     sizeof(RockerTlv *));
+    tlvs = g_new0(RockerTlv *, group->l2_flood.group_count + 1);
     if (!tlvs) {
         return -ROCKER_ENOMEM;
     }
 
     g_free(group->l2_flood.group_ids);
     group->l2_flood.group_ids =
-        g_malloc0(group->l2_flood.group_count * sizeof(uint32_t));
+        g_new0(uint32_t, group->l2_flood.group_count);
     if (!group->l2_flood.group_ids) {
         err = -ROCKER_ENOMEM;
         goto err_out;
-- 
2.1.4

^ permalink raw reply related	[flat|nested] 22+ messages in thread

* [Qemu-devel] [PULL 17/19] linux-user: Use g_new() & friends where that makes obvious sense
  2015-10-08 16:52 [Qemu-devel] [PULL 00/19] Trivial patches for 2015-10-08 Michael Tokarev
                   ` (15 preceding siblings ...)
  2015-10-08 16:52 ` [Qemu-devel] [PULL 16/19] rocker: Use g_new() & friends where that makes obvious sense Michael Tokarev
@ 2015-10-08 16:52 ` Michael Tokarev
  2015-10-08 16:52 ` [Qemu-devel] [PULL 18/19] linux-user: Remove type casts to union type Michael Tokarev
                   ` (2 subsequent siblings)
  19 siblings, 0 replies; 22+ messages in thread
From: Michael Tokarev @ 2015-10-08 16:52 UTC (permalink / raw)
  To: qemu-devel; +Cc: qemu-trivial, Michael Tokarev, Markus Armbruster

From: Markus Armbruster <armbru@redhat.com>

g_new(T, n) is neater than g_malloc(sizeof(T) * n).  It's also safer,
for two reasons.  One, it catches multiplication overflowing size_t.
Two, it returns T * rather than void *, which lets the compiler catch
more type errors.

This commit only touches allocations with size arguments of the form
sizeof(T).  Same Coccinelle semantic patch as in commit b45c03f.

Signed-off-by: Markus Armbruster <armbru@redhat.com>
Reviewed-by: Eric Blake <eblake@redhat.com>
Reviewed-by: Stefan Weil <sw@weilnetz.de>
Signed-off-by: Michael Tokarev <mjt@tls.msk.ru>
---
 linux-user/elfload.c | 2 +-
 linux-user/main.c    | 2 +-
 linux-user/syscall.c | 2 +-
 3 files changed, 3 insertions(+), 3 deletions(-)

diff --git a/linux-user/elfload.c b/linux-user/elfload.c
index fdae6a6..d68f5a1 100644
--- a/linux-user/elfload.c
+++ b/linux-user/elfload.c
@@ -2853,7 +2853,7 @@ static int fill_note_info(struct elf_note_info *info,
     TaskState *ts = (TaskState *)cpu->opaque;
     int i;
 
-    info->notes = g_malloc0(NUMNOTES * sizeof (struct memelfnote));
+    info->notes = g_new0(struct memelfnote, NUMNOTES);
     if (info->notes == NULL)
         return (-ENOMEM);
     info->prstatus = g_malloc0(sizeof (*info->prstatus));
diff --git a/linux-user/main.c b/linux-user/main.c
index d6af7ca..8acfe0f 100644
--- a/linux-user/main.c
+++ b/linux-user/main.c
@@ -4270,7 +4270,7 @@ int main(int argc, char **argv, char **envp)
     }
     target_argv[target_argc] = NULL;
 
-    ts = g_malloc0 (sizeof(TaskState));
+    ts = g_new0(TaskState, 1);
     init_task_state(ts);
     /* build Task State */
     ts->info = info;
diff --git a/linux-user/syscall.c b/linux-user/syscall.c
index 98b5766..b8ce208 100644
--- a/linux-user/syscall.c
+++ b/linux-user/syscall.c
@@ -4566,7 +4566,7 @@ static int do_fork(CPUArchState *env, unsigned int flags, abi_ulong newsp,
         new_thread_info info;
         pthread_attr_t attr;
 
-        ts = g_malloc0(sizeof(TaskState));
+        ts = g_new0(TaskState, 1);
         init_task_state(ts);
         /* we create a new CPU instance. */
         new_env = cpu_copy(env);
-- 
2.1.4

^ permalink raw reply related	[flat|nested] 22+ messages in thread

* [Qemu-devel] [PULL 18/19] linux-user: Remove type casts to union type
  2015-10-08 16:52 [Qemu-devel] [PULL 00/19] Trivial patches for 2015-10-08 Michael Tokarev
                   ` (16 preceding siblings ...)
  2015-10-08 16:52 ` [Qemu-devel] [PULL 17/19] linux-user: " Michael Tokarev
@ 2015-10-08 16:52 ` Michael Tokarev
  2015-10-08 16:52 ` [Qemu-devel] [PULL 19/19] tests: Unique test path for /string-visitor/output Michael Tokarev
  2015-10-09 11:02 ` [Qemu-devel] [PULL 00/19] Trivial patches for 2015-10-08 Peter Maydell
  19 siblings, 0 replies; 22+ messages in thread
From: Michael Tokarev @ 2015-10-08 16:52 UTC (permalink / raw)
  To: qemu-devel; +Cc: qemu-trivial, Stefan Weil, Riku Voipio, Michael Tokarev

From: Stefan Weil <sw@weilnetz.de>

Casting to a union type is a gcc (and clang) extension. Other compilers
might not support it. This is not a problem today, but the type casts
can be removed easily. Smatch now no longer complains like before:

linux-user/syscall.c:3190:18: warning: cast to non-scalar
linux-user/syscall.c:7348:44: warning: cast to non-scalar

Cc: Riku Voipio <riku.voipio@iki.fi>
Signed-off-by: Stefan Weil <sw@weilnetz.de>
Signed-off-by: Michael Tokarev <mjt@tls.msk.ru>
---
 linux-user/syscall.c | 8 ++++----
 1 file changed, 4 insertions(+), 4 deletions(-)

diff --git a/linux-user/syscall.c b/linux-user/syscall.c
index b8ce208..8bfb24f 100644
--- a/linux-user/syscall.c
+++ b/linux-user/syscall.c
@@ -2728,8 +2728,9 @@ static inline abi_long host_to_target_semarray(int semid, abi_ulong target_addr,
 }
 
 static inline abi_long do_semctl(int semid, int semnum, int cmd,
-                                 union target_semun target_su)
+                                 abi_ulong target_arg)
 {
+    union target_semun target_su = { .buf = target_arg };
     union semun arg;
     struct semid_ds dsarg;
     unsigned short *array = NULL;
@@ -3251,8 +3252,7 @@ static abi_long do_ipc(unsigned int call, abi_long first,
          * ptr argument. */
         abi_ulong atptr;
         get_user_ual(atptr, ptr);
-        ret = do_semctl(first, second, third,
-                (union target_semun) atptr);
+        ret = do_semctl(first, second, third, atptr);
         break;
     }
 
@@ -7550,7 +7550,7 @@ abi_long do_syscall(void *cpu_env, int num, abi_long arg1,
 #endif
 #ifdef TARGET_NR_semctl
     case TARGET_NR_semctl:
-        ret = do_semctl(arg1, arg2, arg3, (union target_semun)(abi_ulong)arg4);
+        ret = do_semctl(arg1, arg2, arg3, arg4);
         break;
 #endif
 #ifdef TARGET_NR_msgctl
-- 
2.1.4

^ permalink raw reply related	[flat|nested] 22+ messages in thread

* [Qemu-devel] [PULL 19/19] tests: Unique test path for /string-visitor/output
  2015-10-08 16:52 [Qemu-devel] [PULL 00/19] Trivial patches for 2015-10-08 Michael Tokarev
                   ` (17 preceding siblings ...)
  2015-10-08 16:52 ` [Qemu-devel] [PULL 18/19] linux-user: Remove type casts to union type Michael Tokarev
@ 2015-10-08 16:52 ` Michael Tokarev
  2015-10-09 11:02 ` [Qemu-devel] [PULL 00/19] Trivial patches for 2015-10-08 Peter Maydell
  19 siblings, 0 replies; 22+ messages in thread
From: Michael Tokarev @ 2015-10-08 16:52 UTC (permalink / raw)
  To: qemu-devel; +Cc: qemu-trivial, Michael Tokarev, Dr. David Alan Gilbert

From: "Dr. David Alan Gilbert" <dgilbert@redhat.com>

Newer GLib's want unique test paths, and thus moan at dupes.
(Seen on Fedora 23 which has glib 2.46)

Uniquify the paths.

Signed-off-by: Dr. David Alan Gilbert <dgilbert@redhat.com>
Reviewed-by: Eric Blake <eblake@redhat.com>
Signed-off-by: Michael Tokarev <mjt@tls.msk.ru>
---
 tests/test-string-output-visitor.c | 16 ++++++++--------
 1 file changed, 8 insertions(+), 8 deletions(-)

diff --git a/tests/test-string-output-visitor.c b/tests/test-string-output-visitor.c
index 101fb27..fd5e67b 100644
--- a/tests/test-string-output-visitor.c
+++ b/tests/test-string-output-visitor.c
@@ -248,39 +248,39 @@ int main(int argc, char **argv)
 
     output_visitor_test_add("/string-visitor/output/int",
                             &out_visitor_data, test_visitor_out_int, false);
-    output_visitor_test_add("/string-visitor/output/int",
+    output_visitor_test_add("/string-visitor/output/int-human",
                             &out_visitor_data, test_visitor_out_int, true);
     output_visitor_test_add("/string-visitor/output/bool",
                             &out_visitor_data, test_visitor_out_bool, false);
-    output_visitor_test_add("/string-visitor/output/bool",
+    output_visitor_test_add("/string-visitor/output/bool-human",
                             &out_visitor_data, test_visitor_out_bool, true);
     output_visitor_test_add("/string-visitor/output/number",
                             &out_visitor_data, test_visitor_out_number, false);
-    output_visitor_test_add("/string-visitor/output/number",
+    output_visitor_test_add("/string-visitor/output/number-human",
                             &out_visitor_data, test_visitor_out_number, true);
     output_visitor_test_add("/string-visitor/output/string",
                             &out_visitor_data, test_visitor_out_string, false);
-    output_visitor_test_add("/string-visitor/output/string",
+    output_visitor_test_add("/string-visitor/output/string-human",
                             &out_visitor_data, test_visitor_out_string, true);
     output_visitor_test_add("/string-visitor/output/no-string",
                             &out_visitor_data, test_visitor_out_no_string,
                             false);
-    output_visitor_test_add("/string-visitor/output/no-string",
+    output_visitor_test_add("/string-visitor/output/no-string-human",
                             &out_visitor_data, test_visitor_out_no_string,
                             true);
     output_visitor_test_add("/string-visitor/output/enum",
                             &out_visitor_data, test_visitor_out_enum, false);
-    output_visitor_test_add("/string-visitor/output/enum",
+    output_visitor_test_add("/string-visitor/output/enum-human",
                             &out_visitor_data, test_visitor_out_enum, true);
     output_visitor_test_add("/string-visitor/output/enum-errors",
                             &out_visitor_data, test_visitor_out_enum_errors,
                             false);
-    output_visitor_test_add("/string-visitor/output/enum-errors",
+    output_visitor_test_add("/string-visitor/output/enum-errors-human",
                             &out_visitor_data, test_visitor_out_enum_errors,
                             true);
     output_visitor_test_add("/string-visitor/output/intList",
                             &out_visitor_data, test_visitor_out_intList, false);
-    output_visitor_test_add("/string-visitor/output/intList",
+    output_visitor_test_add("/string-visitor/output/intList-human",
                             &out_visitor_data, test_visitor_out_intList, true);
 
     g_test_run();
-- 
2.1.4

^ permalink raw reply related	[flat|nested] 22+ messages in thread

* Re: [Qemu-devel] [PULL 00/19] Trivial patches for 2015-10-08
  2015-10-08 16:52 [Qemu-devel] [PULL 00/19] Trivial patches for 2015-10-08 Michael Tokarev
                   ` (18 preceding siblings ...)
  2015-10-08 16:52 ` [Qemu-devel] [PULL 19/19] tests: Unique test path for /string-visitor/output Michael Tokarev
@ 2015-10-09 11:02 ` Peter Maydell
  19 siblings, 0 replies; 22+ messages in thread
From: Peter Maydell @ 2015-10-09 11:02 UTC (permalink / raw)
  To: Michael Tokarev; +Cc: QEMU Trivial, QEMU Developers

On 8 October 2015 at 17:52, Michael Tokarev <mjt@tls.msk.ru> wrote:
> Another trivial-patches pull request.
> Everything's trivial in there this time.
>
> Please consider applying/pulling.
>
> Thank you!
>
> /mjt
>
> The following changes since commit 31c9bd164ddb653915b9029ba0edd40cd57530d9:
>
>   Merge remote-tracking branch 'remotes/rth/tags/pull-tcg-20151007' into staging (2015-10-08 15:33:56 +0100)
>
> are available in the git repository at:
>
>   git://git.corpit.ru/qemu.git tags/pull-trivial-patches-2015-10-08
>
> for you to fetch changes up to deb847bfba7ee0ab8151842f5e9cb12d4daad3a3:
>
>   tests: Unique test path for /string-visitor/output (2015-10-08 19:48:17 +0300)
>
> ----------------------------------------------------------------
> trivial patches for 2015-10-08
>
> ----------------------------------------------------------------

Applied, thanks.

-- PMM

^ permalink raw reply	[flat|nested] 22+ messages in thread

* Re: [Qemu-devel] [PULL 01/19] Add .dir-locals.el file to configure emacs coding style
  2015-10-08 16:52 ` [Qemu-devel] [PULL 01/19] Add .dir-locals.el file to configure emacs coding style Michael Tokarev
@ 2015-10-09 12:25   ` Marc-André Lureau
  0 siblings, 0 replies; 22+ messages in thread
From: Marc-André Lureau @ 2015-10-09 12:25 UTC (permalink / raw)
  To: Michael Tokarev, Daniel P. Berrange; +Cc: qemu-trivial, QEMU

Hi

Similar to this file, I proposed a clang-format file. I also use
emacs, but clang-format is way better at dealing with reformating,
especially on a given region without touching the rest:

https://lists.nongnu.org/archive/html/qemu-devel/2015-10/msg01278.html

On Thu, Oct 8, 2015 at 6:52 PM, Michael Tokarev <mjt@tls.msk.ru> wrote:
> From: "Daniel P. Berrange" <berrange@redhat.com>
>
> Some default emacs setups indent by 2 spaces and uses tabs
> which is counter to the QEMU coding style rules. Adding a
> .dir-locals.el file in the top level of the GIT repo will
> inform emacs about the QEMU coding style, and so assist
> contributors in avoiding common style mistakes before
> they submit patches.
>
> Signed-off-by: Daniel P. Berrange <berrange@redhat.com>
> Reviewed-by: Markus Armbruster <armbru@redhat.com>
> Signed-off-by: Michael Tokarev <mjt@tls.msk.ru>
> ---
>  .dir-locals.el | 2 ++
>  1 file changed, 2 insertions(+)
>  create mode 100644 .dir-locals.el
>
> diff --git a/.dir-locals.el b/.dir-locals.el
> new file mode 100644
> index 0000000..3ac0cfc
> --- /dev/null
> +++ b/.dir-locals.el
> @@ -0,0 +1,2 @@
> +((c-mode . ((c-file-style . "stroustrup")
> +           (indent-tabs-mode . nil))))
> --
> 2.1.4
>
>



-- 
Marc-André Lureau

^ permalink raw reply	[flat|nested] 22+ messages in thread

end of thread, other threads:[~2015-10-09 12:25 UTC | newest]

Thread overview: 22+ messages (download: mbox.gz / follow: Atom feed)
-- links below jump to the message on this page --
2015-10-08 16:52 [Qemu-devel] [PULL 00/19] Trivial patches for 2015-10-08 Michael Tokarev
2015-10-08 16:52 ` [Qemu-devel] [PULL 01/19] Add .dir-locals.el file to configure emacs coding style Michael Tokarev
2015-10-09 12:25   ` Marc-André Lureau
2015-10-08 16:52 ` [Qemu-devel] [PULL 02/19] sdhci: use PRIx64 for uint64_t type Michael Tokarev
2015-10-08 16:52 ` [Qemu-devel] [PULL 03/19] sdhci: Change debug prints to compile unconditionally Michael Tokarev
2015-10-08 16:52 ` [Qemu-devel] [PULL 04/19] imx_serial: Generate interrupt on tx empty if enabled Michael Tokarev
2015-10-08 16:52 ` [Qemu-devel] [PULL 05/19] block/ssh: remove dead code Michael Tokarev
2015-10-08 16:52 ` [Qemu-devel] [PULL 06/19] pci-assign: do not include sys/io.h Michael Tokarev
2015-10-08 16:52 ` [Qemu-devel] [PULL 07/19] pc: check for underflow in load_linux Michael Tokarev
2015-10-08 16:52 ` [Qemu-devel] [PULL 08/19] s/cpu_get_real_ticks/cpu_get_host_ticks/ Michael Tokarev
2015-10-08 16:52 ` [Qemu-devel] [PULL 09/19] target-microblaze: Remove unnecessary variable Michael Tokarev
2015-10-08 16:52 ` [Qemu-devel] [PULL 10/19] target-ppc: " Michael Tokarev
2015-10-08 16:52 ` [Qemu-devel] [PULL 11/19] MAINTAINERS: Add NSIS file for W32, W64 hosts Michael Tokarev
2015-10-08 16:52 ` [Qemu-devel] [PULL 12/19] qapi: add missing @ Michael Tokarev
2015-10-08 16:52 ` [Qemu-devel] [PULL 13/19] hw: timer: Remove unnecessary variable Michael Tokarev
2015-10-08 16:52 ` [Qemu-devel] [PULL 14/19] hw: char: " Michael Tokarev
2015-10-08 16:52 ` [Qemu-devel] [PULL 15/19] .travis.yml: Run make check for all targets, not just some Michael Tokarev
2015-10-08 16:52 ` [Qemu-devel] [PULL 16/19] rocker: Use g_new() & friends where that makes obvious sense Michael Tokarev
2015-10-08 16:52 ` [Qemu-devel] [PULL 17/19] linux-user: " Michael Tokarev
2015-10-08 16:52 ` [Qemu-devel] [PULL 18/19] linux-user: Remove type casts to union type Michael Tokarev
2015-10-08 16:52 ` [Qemu-devel] [PULL 19/19] tests: Unique test path for /string-visitor/output Michael Tokarev
2015-10-09 11:02 ` [Qemu-devel] [PULL 00/19] Trivial patches for 2015-10-08 Peter Maydell

This is an external index of several public inboxes,
see mirroring instructions on how to clone and mirror
all data and code used by this external index.