All of lore.kernel.org
 help / color / mirror / Atom feed
* [Qemu-devel] [PATCH 0/4] coccinelle: re-run scripts from scripts/coccinelle
@ 2018-03-22 16:12 Laurent Vivier
  2018-03-22 16:12 ` [Qemu-devel] [PATCH 1/4] error: Strip trailing '\n' from error string arguments (again again) Laurent Vivier
                   ` (7 more replies)
  0 siblings, 8 replies; 31+ messages in thread
From: Laurent Vivier @ 2018-03-22 16:12 UTC (permalink / raw)
  To: qemu-devel
  Cc: Peter Crosthwaite, Daniel P. Berrangé,
	Dr. David Alan Gilbert, Paolo Bonzini, David Gibson, Kevin Wolf,
	Richard Henderson, qemu-arm, Eric Blake, Jason Wang, Max Reitz,
	Fam Zheng, qemu-trivial, Alexander Graf, qemu-ppc, Peter Maydell,
	Alberto Garcia, qemu-block, Igor Mitsyanko, Yongbok Kim,
	Michael S. Tsirkin, Aurelien Jarno, Eduardo Habkost,
	Max Filippov, Markus Armbruster, Laurent Vivier

I've re-run some scripts from the coccinelle directory,
and they have found some problems.

This series fixes them.

Laurent Vivier (4):
  error: Strip trailing '\n' from error string arguments (again again)
  error: Remove NULL checks on error_propagate() calls
  qdict: remove useless cast
  Remove unnecessary variables for function return value

 accel/tcg/translate-all.c                          |  5 +-
 block/nvme.c                                       | 11 ++---
 block/quorum.c                                     |  6 +--
 hw/arm/exynos4210.c                                |  7 +--
 hw/block/vhost-user-blk.c                          |  5 +-
 hw/hppa/dino.c                                     |  5 +-
 hw/misc/mos6522.c                                  |  6 +--
 hw/net/ftgmac100.c                                 |  5 +-
 hw/ppc/pnv_lpc.c                                   | 14 +-----
 io/channel-websock.c                               |  4 +-
 io/net-listener.c                                  |  6 +--
 monitor.c                                          |  2 +-
 target/i386/hax-darwin.c                           | 10 ++--
 target/i386/hvf/hvf.c                              | 24 +++++-----
 target/mips/dsp_helper.c                           | 15 ++----
 target/xtensa/core-dc232b/xtensa-modules.c         | 56 ++++++----------------
 target/xtensa/core-dc233c/xtensa-modules.c         | 56 ++++++----------------
 target/xtensa/core-de212/xtensa-modules.c          | 48 +++++--------------
 target/xtensa/core-fsf/xtensa-modules.c            | 32 ++++---------
 .../xtensa/core-sample_controller/xtensa-modules.c | 24 +++-------
 target/xtensa/translate.c                          |  5 +-
 tests/m48t59-test.c                                |  6 +--
 tests/test-thread-pool.c                           |  6 +--
 util/uri.c                                         |  5 +-
 24 files changed, 94 insertions(+), 269 deletions(-)

-- 
2.14.3

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

* [Qemu-devel] [PATCH 1/4] error: Strip trailing '\n' from error string arguments (again again)
  2018-03-22 16:12 [Qemu-devel] [PATCH 0/4] coccinelle: re-run scripts from scripts/coccinelle Laurent Vivier
@ 2018-03-22 16:12 ` Laurent Vivier
  2018-03-22 16:12 ` [Qemu-devel] [PATCH 2/4] error: Remove NULL checks on error_propagate() calls Laurent Vivier
                   ` (6 subsequent siblings)
  7 siblings, 0 replies; 31+ messages in thread
From: Laurent Vivier @ 2018-03-22 16:12 UTC (permalink / raw)
  To: qemu-devel
  Cc: Peter Crosthwaite, Daniel P. Berrangé,
	Dr. David Alan Gilbert, Paolo Bonzini, David Gibson, Kevin Wolf,
	Richard Henderson, qemu-arm, Eric Blake, Jason Wang, Max Reitz,
	Fam Zheng, qemu-trivial, Alexander Graf, qemu-ppc, Peter Maydell,
	Alberto Garcia, qemu-block, Igor Mitsyanko, Yongbok Kim,
	Michael S. Tsirkin, Aurelien Jarno, Eduardo Habkost,
	Max Filippov, Markus Armbruster, Laurent Vivier

Re-run Coccinelle script scripts/coccinelle/err-bad-newline.cocci,
and found new error_report() occurences with '\n'.

Signed-off-by: Laurent Vivier <lvivier@redhat.com>
---
 target/i386/hvf/hvf.c | 24 ++++++++++++------------
 1 file changed, 12 insertions(+), 12 deletions(-)

diff --git a/target/i386/hvf/hvf.c b/target/i386/hvf/hvf.c
index 15870a4f36..c36753954b 100644
--- a/target/i386/hvf/hvf.c
+++ b/target/i386/hvf/hvf.c
@@ -86,25 +86,25 @@ static void assert_hvf_ok(hv_return_t ret)
 
     switch (ret) {
     case HV_ERROR:
-        error_report("Error: HV_ERROR\n");
+        error_report("Error: HV_ERROR");
         break;
     case HV_BUSY:
-        error_report("Error: HV_BUSY\n");
+        error_report("Error: HV_BUSY");
         break;
     case HV_BAD_ARGUMENT:
-        error_report("Error: HV_BAD_ARGUMENT\n");
+        error_report("Error: HV_BAD_ARGUMENT");
         break;
     case HV_NO_RESOURCES:
-        error_report("Error: HV_NO_RESOURCES\n");
+        error_report("Error: HV_NO_RESOURCES");
         break;
     case HV_NO_DEVICE:
-        error_report("Error: HV_NO_DEVICE\n");
+        error_report("Error: HV_NO_DEVICE");
         break;
     case HV_UNSUPPORTED:
-        error_report("Error: HV_UNSUPPORTED\n");
+        error_report("Error: HV_UNSUPPORTED");
         break;
     default:
-        error_report("Unknown Error\n");
+        error_report("Unknown Error");
     }
 
     abort();
@@ -191,7 +191,7 @@ void hvf_set_phys_mem(MemoryRegionSection *section, bool add)
     if (mem) {
         mem->size = 0;
         if (do_hvf_set_memory(mem)) {
-            error_report("Failed to reset overlapping slot\n");
+            error_report("Failed to reset overlapping slot");
             abort();
         }
     }
@@ -211,7 +211,7 @@ void hvf_set_phys_mem(MemoryRegionSection *section, bool add)
     }
 
     if (x == hvf_state->num_slots) {
-        error_report("No free slots\n");
+        error_report("No free slots");
         abort();
     }
 
@@ -221,7 +221,7 @@ void hvf_set_phys_mem(MemoryRegionSection *section, bool add)
     mem->region = area;
 
     if (do_hvf_set_memory(mem)) {
-        error_report("Error registering new memory slot\n");
+        error_report("Error registering new memory slot");
         abort();
     }
 }
@@ -884,7 +884,7 @@ int hvf_vcpu_exec(CPUState *cpu)
                 break;
             }
             default:
-                error_report("Unrecognized CR %d\n", cr);
+                error_report("Unrecognized CR %d", cr);
                 abort();
             }
             RIP(env) += ins_len;
@@ -930,7 +930,7 @@ int hvf_vcpu_exec(CPUState *cpu)
             env->error_code = 0;
             break;
         default:
-            error_report("%llx: unhandled exit %llx\n", rip, exit_reason);
+            error_report("%llx: unhandled exit %llx", rip, exit_reason);
         }
     } while (ret == 0);
 
-- 
2.14.3

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

* [Qemu-devel] [PATCH 2/4] error: Remove NULL checks on error_propagate() calls
  2018-03-22 16:12 [Qemu-devel] [PATCH 0/4] coccinelle: re-run scripts from scripts/coccinelle Laurent Vivier
  2018-03-22 16:12 ` [Qemu-devel] [PATCH 1/4] error: Strip trailing '\n' from error string arguments (again again) Laurent Vivier
@ 2018-03-22 16:12 ` Laurent Vivier
  2018-03-23 20:50   ` Eric Blake
  2018-03-22 16:12 ` [Qemu-devel] [PATCH 3/4] qdict: remove useless cast Laurent Vivier
                   ` (5 subsequent siblings)
  7 siblings, 1 reply; 31+ messages in thread
From: Laurent Vivier @ 2018-03-22 16:12 UTC (permalink / raw)
  To: qemu-devel
  Cc: Peter Crosthwaite, Daniel P. Berrangé,
	Dr. David Alan Gilbert, Paolo Bonzini, David Gibson, Kevin Wolf,
	Richard Henderson, qemu-arm, Eric Blake, Jason Wang, Max Reitz,
	Fam Zheng, qemu-trivial, Alexander Graf, qemu-ppc, Peter Maydell,
	Alberto Garcia, qemu-block, Igor Mitsyanko, Yongbok Kim,
	Michael S. Tsirkin, Aurelien Jarno, Eduardo Habkost,
	Max Filippov, Markus Armbruster, Laurent Vivier

Re-run Coccinelle patch
scripts/coccinelle/error_propagate_null.cocci

Signed-off-by: Laurent Vivier <lvivier@redhat.com>
---
 io/channel-websock.c | 4 +---
 1 file changed, 1 insertion(+), 3 deletions(-)

diff --git a/io/channel-websock.c b/io/channel-websock.c
index ec48a305f0..e6608b969d 100644
--- a/io/channel-websock.c
+++ b/io/channel-websock.c
@@ -586,9 +586,7 @@ static gboolean qio_channel_websock_handshake_io(QIOChannel *ioc,
         return TRUE;
     }
 
-    if (err) {
-        error_propagate(&wioc->io_err, err);
-    }
+    error_propagate(&wioc->io_err, err);
 
     trace_qio_channel_websock_handshake_reply(ioc);
     qio_channel_add_watch(
-- 
2.14.3

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

* [Qemu-devel] [PATCH 3/4] qdict: remove useless cast
  2018-03-22 16:12 [Qemu-devel] [PATCH 0/4] coccinelle: re-run scripts from scripts/coccinelle Laurent Vivier
  2018-03-22 16:12 ` [Qemu-devel] [PATCH 1/4] error: Strip trailing '\n' from error string arguments (again again) Laurent Vivier
  2018-03-22 16:12 ` [Qemu-devel] [PATCH 2/4] error: Remove NULL checks on error_propagate() calls Laurent Vivier
@ 2018-03-22 16:12 ` Laurent Vivier
  2018-03-22 16:23   ` Dr. David Alan Gilbert
  2018-03-27  3:01   ` Fam Zheng
  2018-03-22 16:12 ` [Qemu-devel] [PATCH 4/4] Remove unnecessary variables for function return value Laurent Vivier
                   ` (4 subsequent siblings)
  7 siblings, 2 replies; 31+ messages in thread
From: Laurent Vivier @ 2018-03-22 16:12 UTC (permalink / raw)
  To: qemu-devel
  Cc: Peter Crosthwaite, Daniel P. Berrangé,
	Dr. David Alan Gilbert, Paolo Bonzini, David Gibson, Kevin Wolf,
	Richard Henderson, qemu-arm, Eric Blake, Jason Wang, Max Reitz,
	Fam Zheng, qemu-trivial, Alexander Graf, qemu-ppc, Peter Maydell,
	Alberto Garcia, qemu-block, Igor Mitsyanko, Yongbok Kim,
	Michael S. Tsirkin, Aurelien Jarno, Eduardo Habkost,
	Max Filippov, Markus Armbruster, Laurent Vivier

Re-run Coccinelle script scripts/coccinelle/qobject.cocci

Signed-off-by: Laurent Vivier <lvivier@redhat.com>
---
 block/nvme.c | 11 +++++------
 monitor.c    |  2 +-
 2 files changed, 6 insertions(+), 7 deletions(-)

diff --git a/block/nvme.c b/block/nvme.c
index 8bca57aae6..c4f3a7bc94 100644
--- a/block/nvme.c
+++ b/block/nvme.c
@@ -695,12 +695,11 @@ static void nvme_parse_filename(const char *filename, QDict *options,
         unsigned long ns;
         const char *slash = strchr(tmp, '/');
         if (!slash) {
-            qdict_put(options, NVME_BLOCK_OPT_DEVICE,
-                      qstring_from_str(tmp));
+            qdict_put_str(options, NVME_BLOCK_OPT_DEVICE, tmp);
             return;
         }
         device = g_strndup(tmp, slash - tmp);
-        qdict_put(options, NVME_BLOCK_OPT_DEVICE, qstring_from_str(device));
+        qdict_put_str(options, NVME_BLOCK_OPT_DEVICE, device);
         g_free(device);
         namespace = slash + 1;
         if (*namespace && qemu_strtoul(namespace, NULL, 10, &ns)) {
@@ -708,8 +707,8 @@ static void nvme_parse_filename(const char *filename, QDict *options,
                        namespace);
             return;
         }
-        qdict_put(options, NVME_BLOCK_OPT_NAMESPACE,
-                  qstring_from_str(*namespace ? namespace : "1"));
+        qdict_put_str(options, NVME_BLOCK_OPT_NAMESPACE,
+                      *namespace ? namespace : "1");
     }
 }
 
@@ -1082,7 +1081,7 @@ static void nvme_refresh_filename(BlockDriverState *bs, QDict *opts)
                  bs->drv->format_name);
     }
 
-    qdict_put(opts, "driver", qstring_from_str(bs->drv->format_name));
+    qdict_put_str(opts, "driver", bs->drv->format_name);
     bs->full_open_options = opts;
 }
 
diff --git a/monitor.c b/monitor.c
index 6ccd2fc089..6e7667d82f 100644
--- a/monitor.c
+++ b/monitor.c
@@ -4316,7 +4316,7 @@ static QObject *get_qmp_greeting(Monitor *mon)
             /* Monitors that are not using IOThread won't support OOB */
             continue;
         }
-        qlist_append(cap_list, qstring_from_str(QMPCapability_str(cap)));
+        qlist_append_str(cap_list, QMPCapability_str(cap));
     }
 
     return qobject_from_jsonf("{'QMP': {'version': %p, 'capabilities': %p}}",
-- 
2.14.3

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

* [Qemu-devel] [PATCH 4/4] Remove unnecessary variables for function return value
  2018-03-22 16:12 [Qemu-devel] [PATCH 0/4] coccinelle: re-run scripts from scripts/coccinelle Laurent Vivier
                   ` (2 preceding siblings ...)
  2018-03-22 16:12 ` [Qemu-devel] [PATCH 3/4] qdict: remove useless cast Laurent Vivier
@ 2018-03-22 16:12 ` Laurent Vivier
  2018-03-22 16:45   ` Eric Blake
                     ` (4 more replies)
  2018-03-22 16:27 ` [Qemu-devel] [PATCH 0/4] coccinelle: re-run scripts from scripts/coccinelle Eric Blake
                   ` (3 subsequent siblings)
  7 siblings, 5 replies; 31+ messages in thread
From: Laurent Vivier @ 2018-03-22 16:12 UTC (permalink / raw)
  To: qemu-devel
  Cc: Peter Crosthwaite, Daniel P. Berrangé,
	Dr. David Alan Gilbert, Paolo Bonzini, David Gibson, Kevin Wolf,
	Richard Henderson, qemu-arm, Eric Blake, Jason Wang, Max Reitz,
	Fam Zheng, qemu-trivial, Alexander Graf, qemu-ppc, Peter Maydell,
	Alberto Garcia, qemu-block, Igor Mitsyanko, Yongbok Kim,
	Michael S. Tsirkin, Aurelien Jarno, Eduardo Habkost,
	Max Filippov, Markus Armbruster, Laurent Vivier

Re-run Coccinelle script scripts/coccinelle/return_directly.cocci

Signed-off-by: Laurent Vivier <lvivier@redhat.com>
---
 accel/tcg/translate-all.c                          |  5 +-
 block/quorum.c                                     |  6 +--
 hw/arm/exynos4210.c                                |  7 +--
 hw/block/vhost-user-blk.c                          |  5 +-
 hw/hppa/dino.c                                     |  5 +-
 hw/misc/mos6522.c                                  |  6 +--
 hw/net/ftgmac100.c                                 |  5 +-
 hw/ppc/pnv_lpc.c                                   | 14 +-----
 io/net-listener.c                                  |  6 +--
 target/i386/hax-darwin.c                           | 10 ++--
 target/mips/dsp_helper.c                           | 15 ++----
 target/xtensa/core-dc232b/xtensa-modules.c         | 56 ++++++----------------
 target/xtensa/core-dc233c/xtensa-modules.c         | 56 ++++++----------------
 target/xtensa/core-de212/xtensa-modules.c          | 48 +++++--------------
 target/xtensa/core-fsf/xtensa-modules.c            | 32 ++++---------
 .../xtensa/core-sample_controller/xtensa-modules.c | 24 +++-------
 target/xtensa/translate.c                          |  5 +-
 tests/m48t59-test.c                                |  6 +--
 tests/test-thread-pool.c                           |  6 +--
 util/uri.c                                         |  5 +-
 20 files changed, 75 insertions(+), 247 deletions(-)

diff --git a/accel/tcg/translate-all.c b/accel/tcg/translate-all.c
index 5ad1b919bc..55d822d410 100644
--- a/accel/tcg/translate-all.c
+++ b/accel/tcg/translate-all.c
@@ -644,11 +644,8 @@ static inline void *alloc_code_gen_buffer(void)
 static inline void *alloc_code_gen_buffer(void)
 {
     size_t size = tcg_ctx->code_gen_buffer_size;
-    void *buf;
-
-    buf = VirtualAlloc(NULL, size, MEM_RESERVE | MEM_COMMIT,
+    return VirtualAlloc(NULL, size, MEM_RESERVE | MEM_COMMIT,
                         PAGE_EXECUTE_READWRITE);
-    return buf;
 }
 #else
 static inline void *alloc_code_gen_buffer(void)
diff --git a/block/quorum.c b/block/quorum.c
index 14333c18aa..304442ef65 100644
--- a/block/quorum.c
+++ b/block/quorum.c
@@ -608,7 +608,7 @@ static void read_quorum_children_entry(void *opaque)
 static int read_quorum_children(QuorumAIOCB *acb)
 {
     BDRVQuorumState *s = acb->bs->opaque;
-    int i, ret;
+    int i;
 
     acb->children_read = s->num_children;
     for (i = 0; i < s->num_children; i++) {
@@ -643,9 +643,7 @@ static int read_quorum_children(QuorumAIOCB *acb)
         qemu_coroutine_yield();
     }
 
-    ret = acb->vote_ret;
-
-    return ret;
+    return acb->vote_ret;
 }
 
 static int read_fifo_child(QuorumAIOCB *acb)
diff --git a/hw/arm/exynos4210.c b/hw/arm/exynos4210.c
index 06f9d1ffa4..d5ce275b21 100644
--- a/hw/arm/exynos4210.c
+++ b/hw/arm/exynos4210.c
@@ -156,12 +156,7 @@ void exynos4210_write_secondary(ARMCPU *cpu,
 
 static uint64_t exynos4210_calc_affinity(int cpu)
 {
-    uint64_t mp_affinity;
-
-    /* Exynos4210 has 0x9 as cluster ID */
-    mp_affinity = (0x9 << ARM_AFF1_SHIFT) | cpu;
-
-    return mp_affinity;
+    return (0x9 << ARM_AFF1_SHIFT) | cpu;
 }
 
 Exynos4210State *exynos4210_init(MemoryRegion *system_mem)
diff --git a/hw/block/vhost-user-blk.c b/hw/block/vhost-user-blk.c
index f840f07dfe..3f41ca9e26 100644
--- a/hw/block/vhost-user-blk.c
+++ b/hw/block/vhost-user-blk.c
@@ -196,7 +196,6 @@ static uint64_t vhost_user_blk_get_features(VirtIODevice *vdev,
                                             Error **errp)
 {
     VHostUserBlk *s = VHOST_USER_BLK(vdev);
-    uint64_t get_features;
 
     /* Turn on pre-defined features */
     virtio_add_feature(&features, VIRTIO_BLK_F_SEG_MAX);
@@ -215,9 +214,7 @@ static uint64_t vhost_user_blk_get_features(VirtIODevice *vdev,
         virtio_add_feature(&features, VIRTIO_BLK_F_MQ);
     }
 
-    get_features = vhost_get_features(&s->dev, user_feature_bits, features);
-
-    return get_features;
+    return vhost_get_features(&s->dev, user_feature_bits, features);
 }
 
 static void vhost_user_blk_handle_output(VirtIODevice *vdev, VirtQueue *vq)
diff --git a/hw/hppa/dino.c b/hw/hppa/dino.c
index 15aefde09c..c5dcf3104d 100644
--- a/hw/hppa/dino.c
+++ b/hw/hppa/dino.c
@@ -403,13 +403,10 @@ static void dino_set_irq(void *opaque, int irq, int level)
 static int dino_pci_map_irq(PCIDevice *d, int irq_num)
 {
     int slot = d->devfn >> 3;
-    int local_irq;
 
     assert(irq_num >= 0 && irq_num <= 3);
 
-    local_irq = slot & 0x03;
-
-    return local_irq;
+    return slot & 0x03;
 }
 
 static void dino_set_timer_irq(void *opaque, int irq, int level)
diff --git a/hw/misc/mos6522.c b/hw/misc/mos6522.c
index 8ad9fc831e..606532aa65 100644
--- a/hw/misc/mos6522.c
+++ b/hw/misc/mos6522.c
@@ -176,12 +176,8 @@ static void mos6522_set_sr_int(MOS6522State *s)
 
 static uint64_t mos6522_get_counter_value(MOS6522State *s, MOS6522Timer *ti)
 {
-    uint64_t d;
-
-    d = muldiv64(qemu_clock_get_ns(QEMU_CLOCK_VIRTUAL) - ti->load_time,
+    return muldiv64(qemu_clock_get_ns(QEMU_CLOCK_VIRTUAL) - ti->load_time,
                  ti->frequency, NANOSECONDS_PER_SECOND);
-
-    return d;
 }
 
 static uint64_t mos6522_get_load_time(MOS6522State *s, MOS6522Timer *ti)
diff --git a/hw/net/ftgmac100.c b/hw/net/ftgmac100.c
index 704f452067..3300e8ef4a 100644
--- a/hw/net/ftgmac100.c
+++ b/hw/net/ftgmac100.c
@@ -511,7 +511,6 @@ static uint32_t ftgmac100_rxpoll(FTGMAC100State *s)
 
     uint32_t cnt = 1024 * FTGMAC100_APTC_RXPOLL_CNT(s->aptcr);
     uint32_t speed = (s->maccr & FTGMAC100_MACCR_FAST_MODE) ? 1 : 0;
-    uint32_t period;
 
     if (s->aptcr & FTGMAC100_APTC_RXPOLL_TIME_SEL) {
         cnt <<= 4;
@@ -521,9 +520,7 @@ static uint32_t ftgmac100_rxpoll(FTGMAC100State *s)
         speed = 2;
     }
 
-    period = cnt / div[speed];
-
-    return period;
+    return cnt / div[speed];
 }
 
 static void ftgmac100_reset(DeviceState *d)
diff --git a/hw/ppc/pnv_lpc.c b/hw/ppc/pnv_lpc.c
index c42b4a8f6c..a77e20368e 100644
--- a/hw/ppc/pnv_lpc.c
+++ b/hw/ppc/pnv_lpc.c
@@ -125,25 +125,15 @@ static int pnv_lpc_dt_xscom(PnvXScomInterface *dev, void *fdt, int xscom_offset)
 static bool opb_read(PnvLpcController *lpc, uint32_t addr, uint8_t *data,
                      int sz)
 {
-    bool success;
-
-    /* XXX Handle access size limits and FW read caching here */
-    success = !address_space_rw(&lpc->opb_as, addr, MEMTXATTRS_UNSPECIFIED,
+    return !address_space_rw(&lpc->opb_as, addr, MEMTXATTRS_UNSPECIFIED,
                                 data, sz, false);
-
-    return success;
 }
 
 static bool opb_write(PnvLpcController *lpc, uint32_t addr, uint8_t *data,
                       int sz)
 {
-    bool success;
-
-    /* XXX Handle access size limits here */
-    success = !address_space_rw(&lpc->opb_as, addr, MEMTXATTRS_UNSPECIFIED,
+    return !address_space_rw(&lpc->opb_as, addr, MEMTXATTRS_UNSPECIFIED,
                                 data, sz, true);
-
-    return success;
 }
 
 #define ECCB_CTL_READ           PPC_BIT(15)
diff --git a/io/net-listener.c b/io/net-listener.c
index 555e8acaa4..3317aa6e5f 100644
--- a/io/net-listener.c
+++ b/io/net-listener.c
@@ -25,11 +25,7 @@
 
 QIONetListener *qio_net_listener_new(void)
 {
-    QIONetListener *ret;
-
-    ret = QIO_NET_LISTENER(object_new(TYPE_QIO_NET_LISTENER));
-
-    return ret;
+    return QIO_NET_LISTENER(object_new(TYPE_QIO_NET_LISTENER));
 }
 
 void qio_net_listener_set_name(QIONetListener *listener,
diff --git a/target/i386/hax-darwin.c b/target/i386/hax-darwin.c
index acdde476a0..a5426a6dac 100644
--- a/target/i386/hax-darwin.c
+++ b/target/i386/hax-darwin.c
@@ -257,10 +257,7 @@ int hax_host_setup_vcpu_channel(struct hax_vcpu_state *vcpu)
 
 int hax_vcpu_run(struct hax_vcpu_state *vcpu)
 {
-    int ret;
-
-    ret = ioctl(vcpu->fd, HAX_VCPU_IOCTL_RUN, NULL);
-    return ret;
+    return ioctl(vcpu->fd, HAX_VCPU_IOCTL_RUN, NULL);
 }
 
 int hax_sync_fpu(CPUArchState *env, struct fx_layout *fl, int set)
@@ -315,13 +312,12 @@ int hax_sync_vcpu_state(CPUArchState *env, struct vcpu_state_t *state, int set)
 
 int hax_inject_interrupt(CPUArchState *env, int vector)
 {
-    int ret, fd;
+    int fd;
 
     fd = hax_vcpu_get_fd(env);
     if (fd <= 0) {
         return -1;
     }
 
-    ret = ioctl(fd, HAX_VCPU_IOCTL_INTERRUPT, &vector);
-    return ret;
+    return ioctl(fd, HAX_VCPU_IOCTL_INTERRUPT, &vector);
 }
diff --git a/target/mips/dsp_helper.c b/target/mips/dsp_helper.c
index f152fea34a..739b69dd45 100644
--- a/target/mips/dsp_helper.c
+++ b/target/mips/dsp_helper.c
@@ -3274,14 +3274,11 @@ target_ulong helper_dextr_l(target_ulong ac, target_ulong shift,
                             CPUMIPSState *env)
 {
     uint64_t temp[3];
-    target_ulong result;
 
     shift = shift & 0x3F;
 
     mipsdsp_rndrashift_acc(temp, ac, shift, env);
-    result = (temp[1] << 63) | (temp[0] >> 1);
-
-    return result;
+    return (temp[1] << 63) | (temp[0] >> 1);
 }
 
 target_ulong helper_dextr_r_l(target_ulong ac, target_ulong shift,
@@ -3289,7 +3286,6 @@ target_ulong helper_dextr_r_l(target_ulong ac, target_ulong shift,
 {
     uint64_t temp[3];
     uint32_t temp128;
-    target_ulong result;
 
     shift = shift & 0x3F;
     mipsdsp_rndrashift_acc(temp, ac, shift, env);
@@ -3309,9 +3305,7 @@ target_ulong helper_dextr_r_l(target_ulong ac, target_ulong shift,
         set_DSPControl_overflow_flag(1, 23, env);
     }
 
-    result = (temp[1] << 63) | (temp[0] >> 1);
-
-    return result;
+    return (temp[1] << 63) | (temp[0] >> 1);
 }
 
 target_ulong helper_dextr_rs_l(target_ulong ac, target_ulong shift,
@@ -3319,7 +3313,6 @@ target_ulong helper_dextr_rs_l(target_ulong ac, target_ulong shift,
 {
     uint64_t temp[3];
     uint32_t temp128;
-    target_ulong result;
 
     shift = shift & 0x3F;
     mipsdsp_rndrashift_acc(temp, ac, shift, env);
@@ -3345,9 +3338,7 @@ target_ulong helper_dextr_rs_l(target_ulong ac, target_ulong shift,
         }
         set_DSPControl_overflow_flag(1, 23, env);
     }
-    result = (temp[1] << 63) | (temp[0] >> 1);
-
-    return result;
+    return (temp[1] << 63) | (temp[0] >> 1);
 }
 #endif
 
diff --git a/target/xtensa/core-dc232b/xtensa-modules.c b/target/xtensa/core-dc232b/xtensa-modules.c
index d322c3f52a..164df3b1a4 100644
--- a/target/xtensa/core-dc232b/xtensa-modules.c
+++ b/target/xtensa/core-dc232b/xtensa-modules.c
@@ -1736,9 +1736,7 @@ Operand_arr_decode (uint32 *valp ATTRIBUTE_UNUSED)
 static int
 Operand_arr_encode (uint32 *valp)
 {
-  int error;
-  error = (*valp & ~0xf) != 0;
-  return error;
+  return (*valp & ~0xf) != 0;
 }
 
 static int
@@ -1750,9 +1748,7 @@ Operand_ars_decode (uint32 *valp ATTRIBUTE_UNUSED)
 static int
 Operand_ars_encode (uint32 *valp)
 {
-  int error;
-  error = (*valp & ~0xf) != 0;
-  return error;
+  return (*valp & ~0xf) != 0;
 }
 
 static int
@@ -1764,9 +1760,7 @@ Operand_art_decode (uint32 *valp ATTRIBUTE_UNUSED)
 static int
 Operand_art_encode (uint32 *valp)
 {
-  int error;
-  error = (*valp & ~0xf) != 0;
-  return error;
+  return (*valp & ~0xf) != 0;
 }
 
 static int
@@ -1778,9 +1772,7 @@ Operand_ar0_decode (uint32 *valp ATTRIBUTE_UNUSED)
 static int
 Operand_ar0_encode (uint32 *valp)
 {
-  int error;
-  error = (*valp & ~0x1f) != 0;
-  return error;
+  return (*valp & ~0x1f) != 0;
 }
 
 static int
@@ -1792,9 +1784,7 @@ Operand_ar4_decode (uint32 *valp ATTRIBUTE_UNUSED)
 static int
 Operand_ar4_encode (uint32 *valp)
 {
-  int error;
-  error = (*valp & ~0x1f) != 0;
-  return error;
+  return (*valp & ~0x1f) != 0;
 }
 
 static int
@@ -1806,9 +1796,7 @@ Operand_ar8_decode (uint32 *valp ATTRIBUTE_UNUSED)
 static int
 Operand_ar8_encode (uint32 *valp)
 {
-  int error;
-  error = (*valp & ~0x1f) != 0;
-  return error;
+  return (*valp & ~0x1f) != 0;
 }
 
 static int
@@ -1820,9 +1808,7 @@ Operand_ar12_decode (uint32 *valp ATTRIBUTE_UNUSED)
 static int
 Operand_ar12_encode (uint32 *valp)
 {
-  int error;
-  error = (*valp & ~0x1f) != 0;
-  return error;
+  return (*valp & ~0x1f) != 0;
 }
 
 static int
@@ -1834,9 +1820,7 @@ Operand_ars_entry_decode (uint32 *valp ATTRIBUTE_UNUSED)
 static int
 Operand_ars_entry_encode (uint32 *valp)
 {
-  int error;
-  error = (*valp & ~0x1f) != 0;
-  return error;
+  return (*valp & ~0x1f) != 0;
 }
 
 static int
@@ -2406,9 +2390,7 @@ Operand_mx_decode (uint32 *valp ATTRIBUTE_UNUSED)
 static int
 Operand_mx_encode (uint32 *valp)
 {
-  int error;
-  error = (*valp & ~0x3) != 0;
-  return error;
+  return (*valp & ~0x3) != 0;
 }
 
 static int
@@ -2436,9 +2418,7 @@ Operand_mw_decode (uint32 *valp ATTRIBUTE_UNUSED)
 static int
 Operand_mw_encode (uint32 *valp)
 {
-  int error;
-  error = (*valp & ~0x3) != 0;
-  return error;
+  return (*valp & ~0x3) != 0;
 }
 
 static int
@@ -2450,9 +2430,7 @@ Operand_mr0_decode (uint32 *valp ATTRIBUTE_UNUSED)
 static int
 Operand_mr0_encode (uint32 *valp)
 {
-  int error;
-  error = (*valp & ~0x3) != 0;
-  return error;
+  return (*valp & ~0x3) != 0;
 }
 
 static int
@@ -2464,9 +2442,7 @@ Operand_mr1_decode (uint32 *valp ATTRIBUTE_UNUSED)
 static int
 Operand_mr1_encode (uint32 *valp)
 {
-  int error;
-  error = (*valp & ~0x3) != 0;
-  return error;
+  return (*valp & ~0x3) != 0;
 }
 
 static int
@@ -2478,9 +2454,7 @@ Operand_mr2_decode (uint32 *valp ATTRIBUTE_UNUSED)
 static int
 Operand_mr2_encode (uint32 *valp)
 {
-  int error;
-  error = (*valp & ~0x3) != 0;
-  return error;
+  return (*valp & ~0x3) != 0;
 }
 
 static int
@@ -2492,9 +2466,7 @@ Operand_mr3_decode (uint32 *valp ATTRIBUTE_UNUSED)
 static int
 Operand_mr3_encode (uint32 *valp)
 {
-  int error;
-  error = (*valp & ~0x3) != 0;
-  return error;
+  return (*valp & ~0x3) != 0;
 }
 
 static int
diff --git a/target/xtensa/core-dc233c/xtensa-modules.c b/target/xtensa/core-dc233c/xtensa-modules.c
index 7c20f82349..0f32f0804a 100644
--- a/target/xtensa/core-dc233c/xtensa-modules.c
+++ b/target/xtensa/core-dc233c/xtensa-modules.c
@@ -1817,9 +1817,7 @@ Operand_arr_decode (uint32 *valp ATTRIBUTE_UNUSED)
 static int
 Operand_arr_encode (uint32 *valp)
 {
-  int error;
-  error = (*valp & ~0xf) != 0;
-  return error;
+  return (*valp & ~0xf) != 0;
 }
 
 static int
@@ -1831,9 +1829,7 @@ Operand_ars_decode (uint32 *valp ATTRIBUTE_UNUSED)
 static int
 Operand_ars_encode (uint32 *valp)
 {
-  int error;
-  error = (*valp & ~0xf) != 0;
-  return error;
+  return (*valp & ~0xf) != 0;
 }
 
 static int
@@ -1845,9 +1841,7 @@ Operand_art_decode (uint32 *valp ATTRIBUTE_UNUSED)
 static int
 Operand_art_encode (uint32 *valp)
 {
-  int error;
-  error = (*valp & ~0xf) != 0;
-  return error;
+  return (*valp & ~0xf) != 0;
 }
 
 static int
@@ -1859,9 +1853,7 @@ Operand_ar0_decode (uint32 *valp ATTRIBUTE_UNUSED)
 static int
 Operand_ar0_encode (uint32 *valp)
 {
-  int error;
-  error = (*valp & ~0x1f) != 0;
-  return error;
+  return (*valp & ~0x1f) != 0;
 }
 
 static int
@@ -1873,9 +1865,7 @@ Operand_ar4_decode (uint32 *valp ATTRIBUTE_UNUSED)
 static int
 Operand_ar4_encode (uint32 *valp)
 {
-  int error;
-  error = (*valp & ~0x1f) != 0;
-  return error;
+  return (*valp & ~0x1f) != 0;
 }
 
 static int
@@ -1887,9 +1877,7 @@ Operand_ar8_decode (uint32 *valp ATTRIBUTE_UNUSED)
 static int
 Operand_ar8_encode (uint32 *valp)
 {
-  int error;
-  error = (*valp & ~0x1f) != 0;
-  return error;
+  return (*valp & ~0x1f) != 0;
 }
 
 static int
@@ -1901,9 +1889,7 @@ Operand_ar12_decode (uint32 *valp ATTRIBUTE_UNUSED)
 static int
 Operand_ar12_encode (uint32 *valp)
 {
-  int error;
-  error = (*valp & ~0x1f) != 0;
-  return error;
+  return (*valp & ~0x1f) != 0;
 }
 
 static int
@@ -1915,9 +1901,7 @@ Operand_ars_entry_decode (uint32 *valp ATTRIBUTE_UNUSED)
 static int
 Operand_ars_entry_encode (uint32 *valp)
 {
-  int error;
-  error = (*valp & ~0x1f) != 0;
-  return error;
+  return (*valp & ~0x1f) != 0;
 }
 
 static int
@@ -2487,9 +2471,7 @@ Operand_mx_decode (uint32 *valp ATTRIBUTE_UNUSED)
 static int
 Operand_mx_encode (uint32 *valp)
 {
-  int error;
-  error = (*valp & ~0x3) != 0;
-  return error;
+  return (*valp & ~0x3) != 0;
 }
 
 static int
@@ -2517,9 +2499,7 @@ Operand_mw_decode (uint32 *valp ATTRIBUTE_UNUSED)
 static int
 Operand_mw_encode (uint32 *valp)
 {
-  int error;
-  error = (*valp & ~0x3) != 0;
-  return error;
+  return (*valp & ~0x3) != 0;
 }
 
 static int
@@ -2531,9 +2511,7 @@ Operand_mr0_decode (uint32 *valp ATTRIBUTE_UNUSED)
 static int
 Operand_mr0_encode (uint32 *valp)
 {
-  int error;
-  error = (*valp & ~0x3) != 0;
-  return error;
+  return (*valp & ~0x3) != 0;
 }
 
 static int
@@ -2545,9 +2523,7 @@ Operand_mr1_decode (uint32 *valp ATTRIBUTE_UNUSED)
 static int
 Operand_mr1_encode (uint32 *valp)
 {
-  int error;
-  error = (*valp & ~0x3) != 0;
-  return error;
+  return (*valp & ~0x3) != 0;
 }
 
 static int
@@ -2559,9 +2535,7 @@ Operand_mr2_decode (uint32 *valp ATTRIBUTE_UNUSED)
 static int
 Operand_mr2_encode (uint32 *valp)
 {
-  int error;
-  error = (*valp & ~0x3) != 0;
-  return error;
+  return (*valp & ~0x3) != 0;
 }
 
 static int
@@ -2573,9 +2547,7 @@ Operand_mr3_decode (uint32 *valp ATTRIBUTE_UNUSED)
 static int
 Operand_mr3_encode (uint32 *valp)
 {
-  int error;
-  error = (*valp & ~0x3) != 0;
-  return error;
+  return (*valp & ~0x3) != 0;
 }
 
 static int
diff --git a/target/xtensa/core-de212/xtensa-modules.c b/target/xtensa/core-de212/xtensa-modules.c
index ef7674de3a..480c68d3c6 100644
--- a/target/xtensa/core-de212/xtensa-modules.c
+++ b/target/xtensa/core-de212/xtensa-modules.c
@@ -1798,9 +1798,7 @@ OperandSem_opnd_sem_AR_decode (uint32 *valp ATTRIBUTE_UNUSED)
 static int
 OperandSem_opnd_sem_AR_encode (uint32 *valp)
 {
-  int error;
-  error = (*valp >= 32);
-  return error;
+  return (*valp >= 32);
 }
 
 static int
@@ -1812,9 +1810,7 @@ OperandSem_opnd_sem_AR_0_decode (uint32 *valp ATTRIBUTE_UNUSED)
 static int
 OperandSem_opnd_sem_AR_0_encode (uint32 *valp)
 {
-  int error;
-  error = (*valp >= 32);
-  return error;
+  return (*valp >= 32);
 }
 
 static int
@@ -1826,9 +1822,7 @@ OperandSem_opnd_sem_AR_1_decode (uint32 *valp ATTRIBUTE_UNUSED)
 static int
 OperandSem_opnd_sem_AR_1_encode (uint32 *valp)
 {
-  int error;
-  error = (*valp >= 32);
-  return error;
+  return (*valp >= 32);
 }
 
 static int
@@ -1840,9 +1834,7 @@ OperandSem_opnd_sem_AR_2_decode (uint32 *valp ATTRIBUTE_UNUSED)
 static int
 OperandSem_opnd_sem_AR_2_encode (uint32 *valp)
 {
-  int error;
-  error = (*valp >= 32);
-  return error;
+  return (*valp >= 32);
 }
 
 static int
@@ -1854,9 +1846,7 @@ OperandSem_opnd_sem_AR_3_decode (uint32 *valp ATTRIBUTE_UNUSED)
 static int
 OperandSem_opnd_sem_AR_3_encode (uint32 *valp)
 {
-  int error;
-  error = (*valp >= 32);
-  return error;
+  return (*valp >= 32);
 }
 
 static int
@@ -1868,9 +1858,7 @@ OperandSem_opnd_sem_AR_4_decode (uint32 *valp ATTRIBUTE_UNUSED)
 static int
 OperandSem_opnd_sem_AR_4_encode (uint32 *valp)
 {
-  int error;
-  error = (*valp >= 32);
-  return error;
+  return (*valp >= 32);
 }
 
 static int
@@ -2464,9 +2452,7 @@ OperandSem_opnd_sem_MR_decode (uint32 *valp ATTRIBUTE_UNUSED)
 static int
 OperandSem_opnd_sem_MR_encode (uint32 *valp)
 {
-  int error;
-  error = (*valp >= 4);
-  return error;
+  return (*valp >= 4);
 }
 
 static int
@@ -2478,9 +2464,7 @@ OperandSem_opnd_sem_MR_1_decode (uint32 *valp ATTRIBUTE_UNUSED)
 static int
 OperandSem_opnd_sem_MR_1_encode (uint32 *valp)
 {
-  int error;
-  error = (*valp >= 4);
-  return error;
+  return (*valp >= 4);
 }
 
 static int
@@ -2492,9 +2476,7 @@ OperandSem_opnd_sem_MR_2_decode (uint32 *valp ATTRIBUTE_UNUSED)
 static int
 OperandSem_opnd_sem_MR_2_encode (uint32 *valp)
 {
-  int error;
-  error = (*valp >= 4);
-  return error;
+  return (*valp >= 4);
 }
 
 static int
@@ -2506,9 +2488,7 @@ OperandSem_opnd_sem_MR_3_decode (uint32 *valp ATTRIBUTE_UNUSED)
 static int
 OperandSem_opnd_sem_MR_3_encode (uint32 *valp)
 {
-  int error;
-  error = (*valp >= 4);
-  return error;
+  return (*valp >= 4);
 }
 
 static int
@@ -2520,9 +2500,7 @@ OperandSem_opnd_sem_MR_4_decode (uint32 *valp ATTRIBUTE_UNUSED)
 static int
 OperandSem_opnd_sem_MR_4_encode (uint32 *valp)
 {
-  int error;
-  error = (*valp >= 4);
-  return error;
+  return (*valp >= 4);
 }
 
 static int
@@ -2534,9 +2512,7 @@ OperandSem_opnd_sem_MR_5_decode (uint32 *valp ATTRIBUTE_UNUSED)
 static int
 OperandSem_opnd_sem_MR_5_encode (uint32 *valp)
 {
-  int error;
-  error = (*valp >= 4);
-  return error;
+  return (*valp >= 4);
 }
 
 static int
diff --git a/target/xtensa/core-fsf/xtensa-modules.c b/target/xtensa/core-fsf/xtensa-modules.c
index f7de2dec15..c32683ff77 100644
--- a/target/xtensa/core-fsf/xtensa-modules.c
+++ b/target/xtensa/core-fsf/xtensa-modules.c
@@ -1379,9 +1379,7 @@ Operand_arr_decode (uint32 *valp ATTRIBUTE_UNUSED)
 static int
 Operand_arr_encode (uint32 *valp)
 {
-  int error;
-  error = (*valp & ~0xf) != 0;
-  return error;
+  return (*valp & ~0xf) != 0;
 }
 
 static int
@@ -1393,9 +1391,7 @@ Operand_ars_decode (uint32 *valp ATTRIBUTE_UNUSED)
 static int
 Operand_ars_encode (uint32 *valp)
 {
-  int error;
-  error = (*valp & ~0xf) != 0;
-  return error;
+  return (*valp & ~0xf) != 0;
 }
 
 static int
@@ -1407,9 +1403,7 @@ Operand_art_decode (uint32 *valp ATTRIBUTE_UNUSED)
 static int
 Operand_art_encode (uint32 *valp)
 {
-  int error;
-  error = (*valp & ~0xf) != 0;
-  return error;
+  return (*valp & ~0xf) != 0;
 }
 
 static int
@@ -1421,9 +1415,7 @@ Operand_ar0_decode (uint32 *valp ATTRIBUTE_UNUSED)
 static int
 Operand_ar0_encode (uint32 *valp)
 {
-  int error;
-  error = (*valp & ~0x3f) != 0;
-  return error;
+  return (*valp & ~0x3f) != 0;
 }
 
 static int
@@ -1435,9 +1427,7 @@ Operand_ar4_decode (uint32 *valp ATTRIBUTE_UNUSED)
 static int
 Operand_ar4_encode (uint32 *valp)
 {
-  int error;
-  error = (*valp & ~0x3f) != 0;
-  return error;
+  return (*valp & ~0x3f) != 0;
 }
 
 static int
@@ -1449,9 +1439,7 @@ Operand_ar8_decode (uint32 *valp ATTRIBUTE_UNUSED)
 static int
 Operand_ar8_encode (uint32 *valp)
 {
-  int error;
-  error = (*valp & ~0x3f) != 0;
-  return error;
+  return (*valp & ~0x3f) != 0;
 }
 
 static int
@@ -1463,9 +1451,7 @@ Operand_ar12_decode (uint32 *valp ATTRIBUTE_UNUSED)
 static int
 Operand_ar12_encode (uint32 *valp)
 {
-  int error;
-  error = (*valp & ~0x3f) != 0;
-  return error;
+  return (*valp & ~0x3f) != 0;
 }
 
 static int
@@ -1477,9 +1463,7 @@ Operand_ars_entry_decode (uint32 *valp ATTRIBUTE_UNUSED)
 static int
 Operand_ars_entry_encode (uint32 *valp)
 {
-  int error;
-  error = (*valp & ~0x3f) != 0;
-  return error;
+  return (*valp & ~0x3f) != 0;
 }
 
 static int
diff --git a/target/xtensa/core-sample_controller/xtensa-modules.c b/target/xtensa/core-sample_controller/xtensa-modules.c
index fba41b99ae..7e87d216bd 100644
--- a/target/xtensa/core-sample_controller/xtensa-modules.c
+++ b/target/xtensa/core-sample_controller/xtensa-modules.c
@@ -1570,9 +1570,7 @@ OperandSem_opnd_sem_AR_decode (uint32 *valp ATTRIBUTE_UNUSED)
 static int
 OperandSem_opnd_sem_AR_encode (uint32 *valp)
 {
-  int error;
-  error = (*valp >= 32);
-  return error;
+  return (*valp >= 32);
 }
 
 static int
@@ -1584,9 +1582,7 @@ OperandSem_opnd_sem_AR_0_decode (uint32 *valp ATTRIBUTE_UNUSED)
 static int
 OperandSem_opnd_sem_AR_0_encode (uint32 *valp)
 {
-  int error;
-  error = (*valp >= 32);
-  return error;
+  return (*valp >= 32);
 }
 
 static int
@@ -1598,9 +1594,7 @@ OperandSem_opnd_sem_AR_1_decode (uint32 *valp ATTRIBUTE_UNUSED)
 static int
 OperandSem_opnd_sem_AR_1_encode (uint32 *valp)
 {
-  int error;
-  error = (*valp >= 32);
-  return error;
+  return (*valp >= 32);
 }
 
 static int
@@ -1612,9 +1606,7 @@ OperandSem_opnd_sem_AR_2_decode (uint32 *valp ATTRIBUTE_UNUSED)
 static int
 OperandSem_opnd_sem_AR_2_encode (uint32 *valp)
 {
-  int error;
-  error = (*valp >= 32);
-  return error;
+  return (*valp >= 32);
 }
 
 static int
@@ -1626,9 +1618,7 @@ OperandSem_opnd_sem_AR_3_decode (uint32 *valp ATTRIBUTE_UNUSED)
 static int
 OperandSem_opnd_sem_AR_3_encode (uint32 *valp)
 {
-  int error;
-  error = (*valp >= 32);
-  return error;
+  return (*valp >= 32);
 }
 
 static int
@@ -1640,9 +1630,7 @@ OperandSem_opnd_sem_AR_4_decode (uint32 *valp ATTRIBUTE_UNUSED)
 static int
 OperandSem_opnd_sem_AR_4_encode (uint32 *valp)
 {
-  int error;
-  error = (*valp >= 32);
-  return error;
+  return (*valp >= 32);
 }
 
 static int
diff --git a/target/xtensa/translate.c b/target/xtensa/translate.c
index 4f6d03059f..f88cdbeecd 100644
--- a/target/xtensa/translate.c
+++ b/target/xtensa/translate.c
@@ -1272,11 +1272,8 @@ XtensaOpcodeOps *
 xtensa_find_opcode_ops(const XtensaOpcodeTranslators *t,
                        const char *name)
 {
-    XtensaOpcodeOps *ops;
-
-    ops = bsearch(name, t->opcode, t->num_opcodes,
+    return bsearch(name, t->opcode, t->num_opcodes,
                   sizeof(XtensaOpcodeOps), compare_opcode_ops);
-    return ops;
 }
 
 static void translate_abs(DisasContext *dc, const uint32_t arg[],
diff --git a/tests/m48t59-test.c b/tests/m48t59-test.c
index 26af7d6e8e..5b695971c7 100644
--- a/tests/m48t59-test.c
+++ b/tests/m48t59-test.c
@@ -256,8 +256,6 @@ static void base_setup(void)
 
 int main(int argc, char **argv)
 {
-    int ret;
-
     base_setup();
 
     g_test_init(&argc, &argv, NULL);
@@ -267,7 +265,5 @@ int main(int argc, char **argv)
         qtest_add_func("/rtc/bcd-check-time", bcd_check_time);
     }
     qtest_add_func("/rtc/fuzz-registers", fuzz_registers);
-    ret = g_test_run();
-
-    return ret;
+    return g_test_run();
 }
diff --git a/tests/test-thread-pool.c b/tests/test-thread-pool.c
index 91b4ec5524..9cdccb3a47 100644
--- a/tests/test-thread-pool.c
+++ b/tests/test-thread-pool.c
@@ -224,8 +224,6 @@ static void test_cancel_async(void)
 
 int main(int argc, char **argv)
 {
-    int ret;
-
     qemu_init_main_loop(&error_abort);
     ctx = qemu_get_current_aio_context();
     pool = aio_get_thread_pool(ctx);
@@ -238,7 +236,5 @@ int main(int argc, char **argv)
     g_test_add_func("/thread-pool/cancel", test_cancel);
     g_test_add_func("/thread-pool/cancel-async", test_cancel_async);
 
-    ret = g_test_run();
-
-    return ret;
+    return g_test_run();
 }
diff --git a/util/uri.c b/util/uri.c
index 93ecefdaaf..8624a7ac23 100644
--- a/util/uri.c
+++ b/util/uri.c
@@ -1065,10 +1065,7 @@ URI *uri_parse_raw(const char *str, int raw)
  */
 URI *uri_new(void)
 {
-    URI *ret;
-
-    ret = g_new0(URI, 1);
-    return ret;
+    return g_new0(URI, 1);
 }
 
 /**
-- 
2.14.3

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

* Re: [Qemu-devel] [PATCH 3/4] qdict: remove useless cast
  2018-03-22 16:12 ` [Qemu-devel] [PATCH 3/4] qdict: remove useless cast Laurent Vivier
@ 2018-03-22 16:23   ` Dr. David Alan Gilbert
  2018-03-27  3:01   ` Fam Zheng
  1 sibling, 0 replies; 31+ messages in thread
From: Dr. David Alan Gilbert @ 2018-03-22 16:23 UTC (permalink / raw)
  To: Laurent Vivier
  Cc: qemu-devel, Peter Crosthwaite, Daniel P. Berrangé,
	Paolo Bonzini, David Gibson, Kevin Wolf, Richard Henderson,
	qemu-arm, Eric Blake, Jason Wang, Max Reitz, Fam Zheng,
	qemu-trivial, Alexander Graf, qemu-ppc, Peter Maydell,
	Alberto Garcia, qemu-block, Igor Mitsyanko, Yongbok Kim,
	Michael S. Tsirkin, Aurelien Jarno, Eduardo Habkost,
	Max Filippov, Markus Armbruster

* Laurent Vivier (lvivier@redhat.com) wrote:
> Re-run Coccinelle script scripts/coccinelle/qobject.cocci
> 
> Signed-off-by: Laurent Vivier <lvivier@redhat.com>
> ---
>  block/nvme.c | 11 +++++------
>  monitor.c    |  2 +-
>  2 files changed, 6 insertions(+), 7 deletions(-)
> 
> diff --git a/block/nvme.c b/block/nvme.c
> index 8bca57aae6..c4f3a7bc94 100644
> --- a/block/nvme.c
> +++ b/block/nvme.c
> @@ -695,12 +695,11 @@ static void nvme_parse_filename(const char *filename, QDict *options,
>          unsigned long ns;
>          const char *slash = strchr(tmp, '/');
>          if (!slash) {
> -            qdict_put(options, NVME_BLOCK_OPT_DEVICE,
> -                      qstring_from_str(tmp));
> +            qdict_put_str(options, NVME_BLOCK_OPT_DEVICE, tmp);
>              return;
>          }
>          device = g_strndup(tmp, slash - tmp);
> -        qdict_put(options, NVME_BLOCK_OPT_DEVICE, qstring_from_str(device));
> +        qdict_put_str(options, NVME_BLOCK_OPT_DEVICE, device);
>          g_free(device);
>          namespace = slash + 1;
>          if (*namespace && qemu_strtoul(namespace, NULL, 10, &ns)) {
> @@ -708,8 +707,8 @@ static void nvme_parse_filename(const char *filename, QDict *options,
>                         namespace);
>              return;
>          }
> -        qdict_put(options, NVME_BLOCK_OPT_NAMESPACE,
> -                  qstring_from_str(*namespace ? namespace : "1"));
> +        qdict_put_str(options, NVME_BLOCK_OPT_NAMESPACE,
> +                      *namespace ? namespace : "1");
>      }
>  }
>  
> @@ -1082,7 +1081,7 @@ static void nvme_refresh_filename(BlockDriverState *bs, QDict *opts)
>                   bs->drv->format_name);
>      }
>  
> -    qdict_put(opts, "driver", qstring_from_str(bs->drv->format_name));
> +    qdict_put_str(opts, "driver", bs->drv->format_name);
>      bs->full_open_options = opts;
>  }
>  
> diff --git a/monitor.c b/monitor.c
> index 6ccd2fc089..6e7667d82f 100644
> --- a/monitor.c
> +++ b/monitor.c
> @@ -4316,7 +4316,7 @@ static QObject *get_qmp_greeting(Monitor *mon)
>              /* Monitors that are not using IOThread won't support OOB */
>              continue;
>          }
> -        qlist_append(cap_list, qstring_from_str(QMPCapability_str(cap)));
> +        qlist_append_str(cap_list, QMPCapability_str(cap));
>      }
>  
>      return qobject_from_jsonf("{'QMP': {'version': %p, 'capabilities': %p}}",

For monitor:

Acked-by: Dr. David Alan Gilbert <dgilbert@redhat.com>

> -- 
> 2.14.3
> 
--
Dr. David Alan Gilbert / dgilbert@redhat.com / Manchester, UK

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

* Re: [Qemu-devel] [PATCH 0/4] coccinelle: re-run scripts from scripts/coccinelle
  2018-03-22 16:12 [Qemu-devel] [PATCH 0/4] coccinelle: re-run scripts from scripts/coccinelle Laurent Vivier
                   ` (3 preceding siblings ...)
  2018-03-22 16:12 ` [Qemu-devel] [PATCH 4/4] Remove unnecessary variables for function return value Laurent Vivier
@ 2018-03-22 16:27 ` Eric Blake
  2018-03-22 16:45 ` Eric Blake
                   ` (2 subsequent siblings)
  7 siblings, 0 replies; 31+ messages in thread
From: Eric Blake @ 2018-03-22 16:27 UTC (permalink / raw)
  To: Laurent Vivier, qemu-devel
  Cc: Peter Crosthwaite, Daniel P. Berrangé,
	Dr. David Alan Gilbert, Paolo Bonzini, David Gibson, Kevin Wolf,
	Richard Henderson, qemu-arm, Jason Wang, Max Reitz, Fam Zheng,
	qemu-trivial, Alexander Graf, qemu-ppc, Peter Maydell,
	Alberto Garcia, qemu-block, Igor Mitsyanko, Yongbok Kim,
	Michael S. Tsirkin, Aurelien Jarno, Eduardo Habkost,
	Max Filippov, Markus Armbruster

On 03/22/2018 11:12 AM, Laurent Vivier wrote:
> I've re-run some scripts from the coccinelle directory,
> and they have found some problems.
> 
> This series fixes them.
> 
> Laurent Vivier (4):
>    error: Strip trailing '\n' from error string arguments (again again)

This is user-visible, so appropriate during freeze as a bug fix.  It's 
closes to the error/qapi code that Markus normally maintains (and where 
I'm filling in while he is out), so I'll queue this one on my QAPI tree.

>    error: Remove NULL checks on error_propagate() calls
>    qdict: remove useless cast
>    Remove unnecessary variables for function return value

These are cosmetic; they should be no-ops.  2 and 3 are again best 
through error/qapi, while 4 is more generic, but there's little reason 
to split up the series just because 4 is not as closely related.  Unless 
anyone has an opinion otherwise, I'm planning to also include them in my 
QAPI tree for 2.12.

-- 
Eric Blake, Principal Software Engineer
Red Hat, Inc.           +1-919-301-3266
Virtualization:  qemu.org | libvirt.org

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

* Re: [Qemu-devel] [PATCH 4/4] Remove unnecessary variables for function return value
  2018-03-22 16:12 ` [Qemu-devel] [PATCH 4/4] Remove unnecessary variables for function return value Laurent Vivier
@ 2018-03-22 16:45   ` Eric Blake
  2018-03-22 16:51   ` Max Filippov
                     ` (3 subsequent siblings)
  4 siblings, 0 replies; 31+ messages in thread
From: Eric Blake @ 2018-03-22 16:45 UTC (permalink / raw)
  To: Laurent Vivier, qemu-devel
  Cc: Peter Crosthwaite, Daniel P. Berrangé,
	Dr. David Alan Gilbert, Paolo Bonzini, David Gibson, Kevin Wolf,
	Richard Henderson, qemu-arm, Jason Wang, Max Reitz, Fam Zheng,
	qemu-trivial, Alexander Graf, qemu-ppc, Peter Maydell,
	Alberto Garcia, qemu-block, Igor Mitsyanko, Yongbok Kim,
	Michael S. Tsirkin, Aurelien Jarno, Eduardo Habkost,
	Max Filippov, Markus Armbruster

On 03/22/2018 11:12 AM, Laurent Vivier wrote:
> Re-run Coccinelle script scripts/coccinelle/return_directly.cocci
> 
> Signed-off-by: Laurent Vivier <lvivier@redhat.com>
> ---

> +++ b/hw/arm/exynos4210.c
> @@ -156,12 +156,7 @@ void exynos4210_write_secondary(ARMCPU *cpu,
>   
>   static uint64_t exynos4210_calc_affinity(int cpu)
>   {
> -    uint64_t mp_affinity;
> -
> -    /* Exynos4210 has 0x9 as cluster ID */
> -    mp_affinity = (0x9 << ARM_AFF1_SHIFT) | cpu;
> -
> -    return mp_affinity;
> +    return (0x9 << ARM_AFF1_SHIFT) | cpu;

Unchanged by this rewrite, but since this is converting a signed 32-bit 
int to an unsigned 64-bit value, are we sure that the upper 32 bits are 
always set correctly?  (Using unsigned values earlier in the expression 
would require less head-scratching on whether it is correct).  Any 
changes should be a separate fix by the file's maintainer.


> +++ b/hw/misc/mos6522.c
> @@ -176,12 +176,8 @@ static void mos6522_set_sr_int(MOS6522State *s)
>   
>   static uint64_t mos6522_get_counter_value(MOS6522State *s, MOS6522Timer *ti)
>   {
> -    uint64_t d;
> -
> -    d = muldiv64(qemu_clock_get_ns(QEMU_CLOCK_VIRTUAL) - ti->load_time,
> +    return muldiv64(qemu_clock_get_ns(QEMU_CLOCK_VIRTUAL) - ti->load_time,
>                    ti->frequency, NANOSECONDS_PER_SECOND);

Coccinelle missed that indentation is now off here.

> +++ b/hw/ppc/pnv_lpc.c
> @@ -125,25 +125,15 @@ static int pnv_lpc_dt_xscom(PnvXScomInterface *dev, void *fdt, int xscom_offset)
>   static bool opb_read(PnvLpcController *lpc, uint32_t addr, uint8_t *data,
>                        int sz)
>   {
> -    bool success;
> -
> -    /* XXX Handle access size limits and FW read caching here */
> -    success = !address_space_rw(&lpc->opb_as, addr, MEMTXATTRS_UNSPECIFIED,
> +    return !address_space_rw(&lpc->opb_as, addr, MEMTXATTRS_UNSPECIFIED,
>                                   data, sz, false);

and here.

> +++ b/target/xtensa/translate.c
> @@ -1272,11 +1272,8 @@ XtensaOpcodeOps *
>   xtensa_find_opcode_ops(const XtensaOpcodeTranslators *t,
>                          const char *name)
>   {
> -    XtensaOpcodeOps *ops;
> -
> -    ops = bsearch(name, t->opcode, t->num_opcodes,
> +    return bsearch(name, t->opcode, t->num_opcodes,
>                     sizeof(XtensaOpcodeOps), compare_opcode_ops);

and here


-- 
Eric Blake, Principal Software Engineer
Red Hat, Inc.           +1-919-301-3266
Virtualization:  qemu.org | libvirt.org

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

* Re: [Qemu-devel] [PATCH 0/4] coccinelle: re-run scripts from scripts/coccinelle
  2018-03-22 16:12 [Qemu-devel] [PATCH 0/4] coccinelle: re-run scripts from scripts/coccinelle Laurent Vivier
                   ` (4 preceding siblings ...)
  2018-03-22 16:27 ` [Qemu-devel] [PATCH 0/4] coccinelle: re-run scripts from scripts/coccinelle Eric Blake
@ 2018-03-22 16:45 ` Eric Blake
  2018-03-22 17:57 ` no-reply
  2018-03-23 12:37 ` Michael Tokarev
  7 siblings, 0 replies; 31+ messages in thread
From: Eric Blake @ 2018-03-22 16:45 UTC (permalink / raw)
  To: Laurent Vivier, qemu-devel
  Cc: Peter Crosthwaite, Daniel P. Berrangé,
	Dr. David Alan Gilbert, Paolo Bonzini, David Gibson, Kevin Wolf,
	Richard Henderson, qemu-arm, Jason Wang, Max Reitz, Fam Zheng,
	qemu-trivial, Alexander Graf, qemu-ppc, Peter Maydell,
	Alberto Garcia, qemu-block, Igor Mitsyanko, Yongbok Kim,
	Michael S. Tsirkin, Aurelien Jarno, Eduardo Habkost,
	Max Filippov, Markus Armbruster

On 03/22/2018 11:12 AM, Laurent Vivier wrote:
> I've re-run some scripts from the coccinelle directory,
> and they have found some problems.
> 
> This series fixes them.
> 
> Laurent Vivier (4):
>    error: Strip trailing '\n' from error string arguments (again again)
>    error: Remove NULL checks on error_propagate() calls
>    qdict: remove useless cast
>    Remove unnecessary variables for function return value

I've gone through all the patches to double-check for no surprises; and 
found some formatting nits on 4 that can be touched up on pull request. 
Series:
Reviewed-by: Eric Blake <eblake@redhat.com>

-- 
Eric Blake, Principal Software Engineer
Red Hat, Inc.           +1-919-301-3266
Virtualization:  qemu.org | libvirt.org

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

* Re: [Qemu-devel] [PATCH 4/4] Remove unnecessary variables for function return value
  2018-03-22 16:12 ` [Qemu-devel] [PATCH 4/4] Remove unnecessary variables for function return value Laurent Vivier
  2018-03-22 16:45   ` Eric Blake
@ 2018-03-22 16:51   ` Max Filippov
  2018-03-22 16:58     ` Laurent Vivier
  2018-03-22 16:59     ` Eric Blake
  2018-03-22 23:06   ` David Gibson
                     ` (2 subsequent siblings)
  4 siblings, 2 replies; 31+ messages in thread
From: Max Filippov @ 2018-03-22 16:51 UTC (permalink / raw)
  To: Laurent Vivier
  Cc: qemu-devel, Peter Crosthwaite, Daniel P. Berrangé,
	Dr. David Alan Gilbert, Paolo Bonzini, David Gibson, Kevin Wolf,
	Richard Henderson, qemu-arm, Eric Blake, Jason Wang, Max Reitz,
	Fam Zheng, QEMU Trivial, Alexander Graf, qemu-ppc, Peter Maydell,
	Alberto Garcia, qemu-block, Igor Mitsyanko, Yongbok Kim,
	Michael S. Tsirkin, Aurelien Jarno, Eduardo Habkost,
	Markus Armbruster

On Thu, Mar 22, 2018 at 9:12 AM, Laurent Vivier <lvivier@redhat.com> wrote:
> Re-run Coccinelle script scripts/coccinelle/return_directly.cocci
>
> Signed-off-by: Laurent Vivier <lvivier@redhat.com>
> ---
>  target/xtensa/core-dc232b/xtensa-modules.c         | 56 ++++++----------------
>  target/xtensa/core-dc233c/xtensa-modules.c         | 56 ++++++----------------
>  target/xtensa/core-de212/xtensa-modules.c          | 48 +++++--------------
>  target/xtensa/core-fsf/xtensa-modules.c            | 32 ++++---------
>  .../xtensa/core-sample_controller/xtensa-modules.c | 24 +++-------

These files were autogenerated, fixing them doesn't make much sense.

-- 
Thanks.
-- Max

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

* Re: [Qemu-devel] [PATCH 4/4] Remove unnecessary variables for function return value
  2018-03-22 16:51   ` Max Filippov
@ 2018-03-22 16:58     ` Laurent Vivier
  2018-03-22 17:19       ` Max Filippov
  2018-03-22 16:59     ` Eric Blake
  1 sibling, 1 reply; 31+ messages in thread
From: Laurent Vivier @ 2018-03-22 16:58 UTC (permalink / raw)
  To: Max Filippov
  Cc: qemu-devel, Peter Crosthwaite, Daniel P. Berrangé,
	Dr. David Alan Gilbert, Paolo Bonzini, David Gibson, Kevin Wolf,
	Richard Henderson, qemu-arm, Eric Blake, Jason Wang, Max Reitz,
	Fam Zheng, QEMU Trivial, Alexander Graf, qemu-ppc, Peter Maydell,
	Alberto Garcia, qemu-block, Igor Mitsyanko, Yongbok Kim,
	Michael S. Tsirkin, Aurelien Jarno, Eduardo Habkost,
	Markus Armbruster

On 22/03/2018 17:51, Max Filippov wrote:
> On Thu, Mar 22, 2018 at 9:12 AM, Laurent Vivier <lvivier@redhat.com> wrote:
>> Re-run Coccinelle script scripts/coccinelle/return_directly.cocci
>>
>> Signed-off-by: Laurent Vivier <lvivier@redhat.com>
>> ---
>>  target/xtensa/core-dc232b/xtensa-modules.c         | 56 ++++++----------------
>>  target/xtensa/core-dc233c/xtensa-modules.c         | 56 ++++++----------------
>>  target/xtensa/core-de212/xtensa-modules.c          | 48 +++++--------------
>>  target/xtensa/core-fsf/xtensa-modules.c            | 32 ++++---------
>>  .../xtensa/core-sample_controller/xtensa-modules.c | 24 +++-------
> 
> These files were autogenerated, fixing them doesn't make much sense.

Good to know. They have been already updated by a couple of patches:

8f0a3716e4 Clean up includes
d8e39b7062 Use #include "..." for our own headers, <...> for others

Perhaps import_core.sh can be updated?

Thanks,
Laurent

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

* Re: [Qemu-devel] [PATCH 4/4] Remove unnecessary variables for function return value
  2018-03-22 16:51   ` Max Filippov
  2018-03-22 16:58     ` Laurent Vivier
@ 2018-03-22 16:59     ` Eric Blake
  2018-03-22 17:06       ` Max Filippov
  1 sibling, 1 reply; 31+ messages in thread
From: Eric Blake @ 2018-03-22 16:59 UTC (permalink / raw)
  To: Max Filippov, Laurent Vivier
  Cc: qemu-devel, Peter Crosthwaite, Daniel P. Berrangé,
	Dr. David Alan Gilbert, Paolo Bonzini, David Gibson, Kevin Wolf,
	Richard Henderson, qemu-arm, Jason Wang, Max Reitz, Fam Zheng,
	QEMU Trivial, Alexander Graf, qemu-ppc, Peter Maydell,
	Alberto Garcia, qemu-block, Igor Mitsyanko, Yongbok Kim,
	Michael S. Tsirkin, Aurelien Jarno, Eduardo Habkost,
	Markus Armbruster

On 03/22/2018 11:51 AM, Max Filippov wrote:
> On Thu, Mar 22, 2018 at 9:12 AM, Laurent Vivier <lvivier@redhat.com> wrote:
>> Re-run Coccinelle script scripts/coccinelle/return_directly.cocci
>>
>> Signed-off-by: Laurent Vivier <lvivier@redhat.com>
>> ---
>>   target/xtensa/core-dc232b/xtensa-modules.c         | 56 ++++++----------------
>>   target/xtensa/core-dc233c/xtensa-modules.c         | 56 ++++++----------------
>>   target/xtensa/core-de212/xtensa-modules.c          | 48 +++++--------------
>>   target/xtensa/core-fsf/xtensa-modules.c            | 32 ++++---------
>>   .../xtensa/core-sample_controller/xtensa-modules.c | 24 +++-------
> 
> These files were autogenerated, fixing them doesn't make much sense.

How frequently is the generator rerun?  Is it something where we are 
likely to revert the change because it needs to be rerun soon?  If so, 
then is it worth fixing the generator to output more concise code?

Conversely, if they were generated up front, but likely to remain 
unchanged into the future, then fixing them (even though the fix differs 
from the generator) will mean they no longer show up as false positives 
in future runs of the Coccinelle script.

I'm also fine removing the changes to these files as part of preparing 
the PULL request, if that's what you would prefer.

-- 
Eric Blake, Principal Software Engineer
Red Hat, Inc.           +1-919-301-3266
Virtualization:  qemu.org | libvirt.org

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

* Re: [Qemu-devel] [PATCH 4/4] Remove unnecessary variables for function return value
  2018-03-22 16:59     ` Eric Blake
@ 2018-03-22 17:06       ` Max Filippov
  0 siblings, 0 replies; 31+ messages in thread
From: Max Filippov @ 2018-03-22 17:06 UTC (permalink / raw)
  To: Eric Blake
  Cc: Laurent Vivier, qemu-devel, Peter Crosthwaite,
	Daniel P. Berrangé,
	Dr. David Alan Gilbert, Paolo Bonzini, David Gibson, Kevin Wolf,
	Richard Henderson, qemu-arm, Jason Wang, Max Reitz, Fam Zheng,
	QEMU Trivial, Alexander Graf, qemu-ppc, Peter Maydell,
	Alberto Garcia, qemu-block, Igor Mitsyanko, Yongbok Kim,
	Michael S. Tsirkin, Aurelien Jarno, Eduardo Habkost,
	Markus Armbruster

On Thu, Mar 22, 2018 at 9:59 AM, Eric Blake <eblake@redhat.com> wrote:
> On 03/22/2018 11:51 AM, Max Filippov wrote:
>>
>> On Thu, Mar 22, 2018 at 9:12 AM, Laurent Vivier <lvivier@redhat.com>
>> wrote:
>>>
>>> Re-run Coccinelle script scripts/coccinelle/return_directly.cocci
>>>
>>> Signed-off-by: Laurent Vivier <lvivier@redhat.com>
>>> ---
>>>   target/xtensa/core-dc232b/xtensa-modules.c         | 56
>>> ++++++----------------
>>>   target/xtensa/core-dc233c/xtensa-modules.c         | 56
>>> ++++++----------------
>>>   target/xtensa/core-de212/xtensa-modules.c          | 48
>>> +++++--------------
>>>   target/xtensa/core-fsf/xtensa-modules.c            | 32 ++++---------
>>>   .../xtensa/core-sample_controller/xtensa-modules.c | 24 +++-------
>>
>>
>> These files were autogenerated, fixing them doesn't make much sense.
>
>
> How frequently is the generator rerun?  Is it something where we are likely
> to revert the change because it needs to be rerun soon?  If so, then is it
> worth fixing the generator to output more concise code?

They were generated once and are not supposed to be regenerated.

> Conversely, if they were generated up front, but likely to remain unchanged
> into the future, then fixing them (even though the fix differs from the
> generator) will mean they no longer show up as false positives in future
> runs of the Coccinelle script.

Ok.

> I'm also fine removing the changes to these files as part of preparing the
> PULL request, if that's what you would prefer.

The changes are fine, if they make maintenance easier they should stay.

-- 
Thanks.
-- Max

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

* Re: [Qemu-devel] [PATCH 4/4] Remove unnecessary variables for function return value
  2018-03-22 16:58     ` Laurent Vivier
@ 2018-03-22 17:19       ` Max Filippov
  2018-03-22 17:23         ` Peter Maydell
  2018-03-22 17:30         ` Eric Blake
  0 siblings, 2 replies; 31+ messages in thread
From: Max Filippov @ 2018-03-22 17:19 UTC (permalink / raw)
  To: Laurent Vivier
  Cc: qemu-devel, Peter Crosthwaite, Daniel P. Berrangé,
	Dr. David Alan Gilbert, Paolo Bonzini, David Gibson, Kevin Wolf,
	Richard Henderson, qemu-arm, Eric Blake, Jason Wang, Max Reitz,
	Fam Zheng, QEMU Trivial, Alexander Graf, qemu-ppc, Peter Maydell,
	Alberto Garcia, qemu-block, Igor Mitsyanko, Yongbok Kim,
	Michael S. Tsirkin, Aurelien Jarno, Eduardo Habkost,
	Markus Armbruster

On Thu, Mar 22, 2018 at 9:58 AM, Laurent Vivier <lvivier@redhat.com> wrote:
> On 22/03/2018 17:51, Max Filippov wrote:
>> On Thu, Mar 22, 2018 at 9:12 AM, Laurent Vivier <lvivier@redhat.com> wrote:
>>> Re-run Coccinelle script scripts/coccinelle/return_directly.cocci
>>>
>>> Signed-off-by: Laurent Vivier <lvivier@redhat.com>
>>> ---
>>>  target/xtensa/core-dc232b/xtensa-modules.c         | 56 ++++++----------------
>>>  target/xtensa/core-dc233c/xtensa-modules.c         | 56 ++++++----------------
>>>  target/xtensa/core-de212/xtensa-modules.c          | 48 +++++--------------
>>>  target/xtensa/core-fsf/xtensa-modules.c            | 32 ++++---------
>>>  .../xtensa/core-sample_controller/xtensa-modules.c | 24 +++-------
>>
>> These files were autogenerated, fixing them doesn't make much sense.
>
> Good to know. They have been already updated by a couple of patches:
>
> 8f0a3716e4 Clean up includes
> d8e39b7062 Use #include "..." for our own headers, <...> for others
>
> Perhaps import_core.sh can be updated?

Ok, I can add a fixup that changes #include <xtensa-isa.h> to #include
"xtensa-isa.h".
Adding #include "qemu/osdep.h" there seems pointless to me.

-- 
Thanks.
-- Max

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

* Re: [Qemu-devel] [PATCH 4/4] Remove unnecessary variables for function return value
  2018-03-22 17:19       ` Max Filippov
@ 2018-03-22 17:23         ` Peter Maydell
  2018-03-22 17:26           ` Max Filippov
  2018-03-22 17:30         ` Eric Blake
  1 sibling, 1 reply; 31+ messages in thread
From: Peter Maydell @ 2018-03-22 17:23 UTC (permalink / raw)
  To: Max Filippov
  Cc: Laurent Vivier, qemu-devel, Peter Crosthwaite,
	Daniel P. Berrangé,
	Dr. David Alan Gilbert, Paolo Bonzini, David Gibson, Kevin Wolf,
	Richard Henderson, qemu-arm, Eric Blake, Jason Wang, Max Reitz,
	Fam Zheng, QEMU Trivial, Alexander Graf, qemu-ppc,
	Alberto Garcia, Qemu-block, Igor Mitsyanko, Yongbok Kim,
	Michael S. Tsirkin, Aurelien Jarno, Eduardo Habkost,
	Markus Armbruster

On 22 March 2018 at 17:19, Max Filippov <jcmvbkbc@gmail.com> wrote:
> Ok, I can add a fixup that changes #include <xtensa-isa.h> to #include
> "xtensa-isa.h".
> Adding #include "qemu/osdep.h" there seems pointless to me.

Every top level .c file must start with including osdep.h.
Other headers that it might include rely on that.
It looks like these files aren't actually top level .c files,
but are only compiled by being #included from some other file.
Our convention for that kind of thing is to give the file
a .inc.c extension. If you follow that then clean-includes
will skip the file rather than trying to apply the requirements
for a top level .c file to it.

thanks
-- PMM

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

* Re: [Qemu-devel] [PATCH 4/4] Remove unnecessary variables for function return value
  2018-03-22 17:23         ` Peter Maydell
@ 2018-03-22 17:26           ` Max Filippov
  0 siblings, 0 replies; 31+ messages in thread
From: Max Filippov @ 2018-03-22 17:26 UTC (permalink / raw)
  To: Peter Maydell
  Cc: Laurent Vivier, qemu-devel, Peter Crosthwaite,
	Daniel P. Berrangé,
	Dr. David Alan Gilbert, Paolo Bonzini, David Gibson, Kevin Wolf,
	Richard Henderson, qemu-arm, Eric Blake, Jason Wang, Max Reitz,
	Fam Zheng, QEMU Trivial, Alexander Graf, qemu-ppc,
	Alberto Garcia, Qemu-block, Igor Mitsyanko, Yongbok Kim,
	Michael S. Tsirkin, Aurelien Jarno, Eduardo Habkost,
	Markus Armbruster

On Thu, Mar 22, 2018 at 10:23 AM, Peter Maydell
<peter.maydell@linaro.org> wrote:
> On 22 March 2018 at 17:19, Max Filippov <jcmvbkbc@gmail.com> wrote:
>> Ok, I can add a fixup that changes #include <xtensa-isa.h> to #include
>> "xtensa-isa.h".
>> Adding #include "qemu/osdep.h" there seems pointless to me.
>
> Every top level .c file must start with including osdep.h.
> Other headers that it might include rely on that.
> It looks like these files aren't actually top level .c files,
> but are only compiled by being #included from some other file.
> Our convention for that kind of thing is to give the file
> a .inc.c extension. If you follow that then clean-includes
> will skip the file rather than trying to apply the requirements
> for a top level .c file to it.

Ok, thanks. Will do that too.

-- 
Thanks.
-- Max

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

* Re: [Qemu-devel] [PATCH 4/4] Remove unnecessary variables for function return value
  2018-03-22 17:19       ` Max Filippov
  2018-03-22 17:23         ` Peter Maydell
@ 2018-03-22 17:30         ` Eric Blake
  2018-03-22 17:40           ` Peter Maydell
  1 sibling, 1 reply; 31+ messages in thread
From: Eric Blake @ 2018-03-22 17:30 UTC (permalink / raw)
  To: Max Filippov, Laurent Vivier
  Cc: qemu-devel, Peter Crosthwaite, Daniel P. Berrangé,
	Dr. David Alan Gilbert, Paolo Bonzini, David Gibson, Kevin Wolf,
	Richard Henderson, qemu-arm, Jason Wang, Max Reitz, Fam Zheng,
	QEMU Trivial, Alexander Graf, qemu-ppc, Peter Maydell,
	Alberto Garcia, qemu-block, Igor Mitsyanko, Yongbok Kim,
	Michael S. Tsirkin, Aurelien Jarno, Eduardo Habkost,
	Markus Armbruster

On 03/22/2018 12:19 PM, Max Filippov wrote:

>>> These files were autogenerated, fixing them doesn't make much sense.
>>
>> Good to know. They have been already updated by a couple of patches:
>>
>> 8f0a3716e4 Clean up includes
>> d8e39b7062 Use #include "..." for our own headers, <...> for others
>>
>> Perhaps import_core.sh can be updated?
> 
> Ok, I can add a fixup that changes #include <xtensa-isa.h> to #include
> "xtensa-isa.h".
> Adding #include "qemu/osdep.h" there seems pointless to me.

Or we can add more exceptions to our tooling to recognize the files as 
generated.  The scripts/clean-includes script knows to leave certain 
files alone, so add your files to that list.

I'm less certain of whether our Coccinelle scripts have easy ways to 
exclude specific files.  We already have scripts/cocci-macro-file.h to 
help Coccinelle not choke on some our existing files, but I'm not sure 
if Coccinelle has a config-file like way that is easy to maintain as a 
data file in-tree for blacklist files to leave alone (right now, when I 
run Coccinelle, I have to manually remember to pass a long command line 
cribbed out of the commit message of an earlier run to pick up things 
like cocci-macro-file.h, instead of an easy formula that points to a 
single config file to pull in all the usual options).

-- 
Eric Blake, Principal Software Engineer
Red Hat, Inc.           +1-919-301-3266
Virtualization:  qemu.org | libvirt.org

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

* Re: [Qemu-devel] [PATCH 4/4] Remove unnecessary variables for function return value
  2018-03-22 17:30         ` Eric Blake
@ 2018-03-22 17:40           ` Peter Maydell
  0 siblings, 0 replies; 31+ messages in thread
From: Peter Maydell @ 2018-03-22 17:40 UTC (permalink / raw)
  To: Eric Blake
  Cc: Max Filippov, Laurent Vivier, qemu-devel, Peter Crosthwaite,
	Daniel P. Berrangé,
	Dr. David Alan Gilbert, Paolo Bonzini, David Gibson, Kevin Wolf,
	Richard Henderson, qemu-arm, Jason Wang, Max Reitz, Fam Zheng,
	QEMU Trivial, Alexander Graf, qemu-ppc, Alberto Garcia,
	Qemu-block, Igor Mitsyanko, Yongbok Kim, Michael S. Tsirkin,
	Aurelien Jarno, Eduardo Habkost, Markus Armbruster

On 22 March 2018 at 17:30, Eric Blake <eblake@redhat.com> wrote:
> I'm less certain of whether our Coccinelle scripts have easy ways to exclude
> specific files.  We already have scripts/cocci-macro-file.h to help
> Coccinelle not choke on some our existing files, but I'm not sure if
> Coccinelle has a config-file like way that is easy to maintain as a data
> file in-tree for blacklist files to leave alone (right now, when I run
> Coccinelle, I have to manually remember to pass a long command line cribbed
> out of the commit message of an earlier run to pick up things like
> cocci-macro-file.h, instead of an easy formula that points to a single
> config file to pull in all the usual options).

Coccinelle itself doesn't seem to have a config file mechanism.
We could probably approximate one by using a wrapper script
that skips some files and run the passed spatch file on the rest;
scripts/clean-includes has some "skip files we don't want to try
to run on" code that could perhaps be generalized.

thanks
-- PMM

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

* Re: [Qemu-devel] [PATCH 0/4] coccinelle: re-run scripts from scripts/coccinelle
  2018-03-22 16:12 [Qemu-devel] [PATCH 0/4] coccinelle: re-run scripts from scripts/coccinelle Laurent Vivier
                   ` (5 preceding siblings ...)
  2018-03-22 16:45 ` Eric Blake
@ 2018-03-22 17:57 ` no-reply
  2018-03-22 18:00   ` Peter Maydell
  2018-03-23 12:37 ` Michael Tokarev
  7 siblings, 1 reply; 31+ messages in thread
From: no-reply @ 2018-03-22 17:57 UTC (permalink / raw)
  To: lvivier
  Cc: famz, qemu-devel, peter.maydell, mst, jasowang, armbru, jcmvbkbc,
	yongbok.kim, berto, qemu-block, qemu-trivial, agraf, david

Hi,

This series seems to have some coding style problems. See output below for
more information:

Type: series
Message-id: 20180322161226.29796-1-lvivier@redhat.com
Subject: [Qemu-devel] [PATCH 0/4] coccinelle: re-run scripts from scripts/coccinelle

=== TEST SCRIPT BEGIN ===
#!/bin/bash

BASE=base
n=1
total=$(git log --oneline $BASE.. | wc -l)
failed=0

git config --local diff.renamelimit 0
git config --local diff.renames True
git config --local diff.algorithm histogram

commits="$(git log --format=%H --reverse $BASE..)"
for c in $commits; do
    echo "Checking PATCH $n/$total: $(git log -n 1 --format=%s $c)..."
    if ! git show $c --format=email | ./scripts/checkpatch.pl --mailback -; then
        failed=1
        echo
    fi
    n=$((n+1))
done

exit $failed
=== TEST SCRIPT END ===

Updating 3c8cf5a9c21ff8782164d1def7f44bd888713384
From https://github.com/patchew-project/qemu
 t [tag update]            patchew/20180321144107.22770-1-kwolf@redhat.com -> patchew/20180321144107.22770-1-kwolf@redhat.com
Switched to a new branch 'test'
a1c7275b57 Remove unnecessary variables for function return value
a530fa5a72 qdict: remove useless cast
c1bfe26b11 error: Remove NULL checks on error_propagate() calls
db3d55e58e error: Strip trailing '\n' from error string arguments (again again)

=== OUTPUT BEGIN ===
Checking PATCH 1/4: error: Strip trailing '\n' from error string arguments (again again)...
Checking PATCH 2/4: error: Remove NULL checks on error_propagate() calls...
Checking PATCH 3/4: qdict: remove useless cast...
Checking PATCH 4/4: Remove unnecessary variables for function return value...
ERROR: return is not a function, parentheses are not required
#251: FILE: target/mips/dsp_helper.c:3281:
+    return (temp[1] << 63) | (temp[0] >> 1);

ERROR: return is not a function, parentheses are not required
#270: FILE: target/mips/dsp_helper.c:3308:
+    return (temp[1] << 63) | (temp[0] >> 1);

ERROR: return is not a function, parentheses are not required
#289: FILE: target/mips/dsp_helper.c:3341:
+    return (temp[1] << 63) | (temp[0] >> 1);

total: 3 errors, 0 warnings, 813 lines checked

Your patch has style problems, please review.  If any of these errors
are false positives report them to the maintainer, see
CHECKPATCH in MAINTAINERS.

=== OUTPUT END ===

Test command exited with code: 1


---
Email generated automatically by Patchew [http://patchew.org/].
Please send your feedback to patchew-devel@freelists.org

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

* Re: [Qemu-devel] [PATCH 0/4] coccinelle: re-run scripts from scripts/coccinelle
  2018-03-22 17:57 ` no-reply
@ 2018-03-22 18:00   ` Peter Maydell
  2018-03-22 19:12     ` Eric Blake
  0 siblings, 1 reply; 31+ messages in thread
From: Peter Maydell @ 2018-03-22 18:00 UTC (permalink / raw)
  To: QEMU Developers
  Cc: Laurent Vivier, Fam Zheng, Michael S. Tsirkin, Jason Wang,
	Markus Armbruster, Max Filippov, Yongbok Kim, Alberto Garcia,
	Qemu-block, QEMU Trivial, Alexander Graf, David Gibson,
	Eduardo Habkost, Dr. David Alan Gilbert, qemu-arm,
	Richard Henderson, Kevin Wolf, Peter Crosthwaite, Igor Mitsyanko,
	Max Reitz, qemu-ppc, Paolo Bonzini, Aurelien Jarno

On 22 March 2018 at 17:57,  <no-reply@patchew.org> wrote:
> Checking PATCH 4/4: Remove unnecessary variables for function return value...
> ERROR: return is not a function, parentheses are not required
> #251: FILE: target/mips/dsp_helper.c:3281:
> +    return (temp[1] << 63) | (temp[0] >> 1);

This looks like a bug in checkpatch. I guess to fix it you'd need
to make checkpatch count opening and closing parens in the line
to see if it goes to 0 somewhere other than just before the ';'...

thanks
-- PMM

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

* Re: [Qemu-devel] [PATCH 0/4] coccinelle: re-run scripts from scripts/coccinelle
  2018-03-22 18:00   ` Peter Maydell
@ 2018-03-22 19:12     ` Eric Blake
  2018-03-22 19:17       ` Peter Maydell
  0 siblings, 1 reply; 31+ messages in thread
From: Eric Blake @ 2018-03-22 19:12 UTC (permalink / raw)
  To: Peter Maydell, QEMU Developers
  Cc: Michael S. Tsirkin, Jason Wang, Alexander Graf, Max Filippov,
	Yongbok Kim, Alberto Garcia, Qemu-block, QEMU Trivial,
	Markus Armbruster, David Gibson, Laurent Vivier, Fam Zheng,
	Eduardo Habkost, Dr. David Alan Gilbert, qemu-arm,
	Richard Henderson, Kevin Wolf, Peter Crosthwaite, Igor Mitsyanko,
	Max Reitz, qemu-ppc, Paolo Bonzini, Aurelien Jarno

On 03/22/2018 01:00 PM, Peter Maydell wrote:
> On 22 March 2018 at 17:57,  <no-reply@patchew.org> wrote:
>> Checking PATCH 4/4: Remove unnecessary variables for function return value...
>> ERROR: return is not a function, parentheses are not required
>> #251: FILE: target/mips/dsp_helper.c:3281:
>> +    return (temp[1] << 63) | (temp[0] >> 1);
> 
> This looks like a bug in checkpatch. I guess to fix it you'd need
> to make checkpatch count opening and closing parens in the line
> to see if it goes to 0 somewhere other than just before the ';'...

Or if we don't patch the false negative, you can bypass checkpatch with 
an ugly hack:

return 0 + (...) | (...);

(I'm NOT going to do that bypass - it's too ugly for my taste)

-- 
Eric Blake, Principal Software Engineer
Red Hat, Inc.           +1-919-301-3266
Virtualization:  qemu.org | libvirt.org

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

* Re: [Qemu-devel] [PATCH 0/4] coccinelle: re-run scripts from scripts/coccinelle
  2018-03-22 19:12     ` Eric Blake
@ 2018-03-22 19:17       ` Peter Maydell
  0 siblings, 0 replies; 31+ messages in thread
From: Peter Maydell @ 2018-03-22 19:17 UTC (permalink / raw)
  To: Eric Blake
  Cc: QEMU Developers, Michael S. Tsirkin, Jason Wang, Alexander Graf,
	Max Filippov, Yongbok Kim, Alberto Garcia, Qemu-block,
	QEMU Trivial, Markus Armbruster, David Gibson, Laurent Vivier,
	Fam Zheng, Eduardo Habkost, Dr. David Alan Gilbert, qemu-arm,
	Richard Henderson, Kevin Wolf, Peter Crosthwaite, Igor Mitsyanko,
	Max Reitz, qemu-ppc, Paolo Bonzini, Aurelien Jarno

On 22 March 2018 at 19:12, Eric Blake <eblake@redhat.com> wrote:
> Or if we don't patch the false negative, you can bypass checkpatch with an
> ugly hack:
>
> return 0 + (...) | (...);
>
> (I'm NOT going to do that bypass - it's too ugly for my taste)

Yeah, that's definitely not something we should be doing.
checkpatch has plenty of false positives anyway, ignoring one
more is no big deal.

thanks
-- PMM

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

* Re: [Qemu-devel] [PATCH 4/4] Remove unnecessary variables for function return value
  2018-03-22 16:12 ` [Qemu-devel] [PATCH 4/4] Remove unnecessary variables for function return value Laurent Vivier
  2018-03-22 16:45   ` Eric Blake
  2018-03-22 16:51   ` Max Filippov
@ 2018-03-22 23:06   ` David Gibson
  2018-03-23  2:14   ` [Qemu-devel] [Qemu-arm] " Philippe Mathieu-Daudé
  2018-03-23 10:44   ` [Qemu-devel] " Alberto Garcia
  4 siblings, 0 replies; 31+ messages in thread
From: David Gibson @ 2018-03-22 23:06 UTC (permalink / raw)
  To: Laurent Vivier
  Cc: qemu-devel, Peter Crosthwaite, Daniel P. Berrangé,
	Dr. David Alan Gilbert, Paolo Bonzini, Kevin Wolf,
	Richard Henderson, qemu-arm, Eric Blake, Jason Wang, Max Reitz,
	Fam Zheng, qemu-trivial, Alexander Graf, qemu-ppc, Peter Maydell,
	Alberto Garcia, qemu-block, Igor Mitsyanko, Yongbok Kim,
	Michael S. Tsirkin, Aurelien Jarno, Eduardo Habkost,
	Max Filippov, Markus Armbruster

[-- Attachment #1: Type: text/plain, Size: 29724 bytes --]

On Thu, Mar 22, 2018 at 05:12:26PM +0100, Laurent Vivier wrote:
> Re-run Coccinelle script scripts/coccinelle/return_directly.cocci
> 
> Signed-off-by: Laurent Vivier <lvivier@redhat.com>
> ---
>  accel/tcg/translate-all.c                          |  5 +-
>  block/quorum.c                                     |  6 +--
>  hw/arm/exynos4210.c                                |  7 +--
>  hw/block/vhost-user-blk.c                          |  5 +-
>  hw/hppa/dino.c                                     |  5 +-
>  hw/misc/mos6522.c                                  |  6 +--
>  hw/net/ftgmac100.c                                 |  5 +-
>  hw/ppc/pnv_lpc.c                                   | 14 +-----
>  io/net-listener.c                                  |  6 +--
>  target/i386/hax-darwin.c                           | 10 ++--
>  target/mips/dsp_helper.c                           | 15 ++----
>  target/xtensa/core-dc232b/xtensa-modules.c         | 56 ++++++----------------
>  target/xtensa/core-dc233c/xtensa-modules.c         | 56 ++++++----------------
>  target/xtensa/core-de212/xtensa-modules.c          | 48 +++++--------------
>  target/xtensa/core-fsf/xtensa-modules.c            | 32 ++++---------
>  .../xtensa/core-sample_controller/xtensa-modules.c | 24 +++-------
>  target/xtensa/translate.c                          |  5 +-
>  tests/m48t59-test.c                                |  6 +--
>  tests/test-thread-pool.c                           |  6 +--
>  util/uri.c                                         |  5 +-
>  20 files changed, 75 insertions(+), 247 deletions(-)

ppc part

Acked-by: David Gibson <david@gibson.dropbear.id.au>

> 
> diff --git a/accel/tcg/translate-all.c b/accel/tcg/translate-all.c
> index 5ad1b919bc..55d822d410 100644
> --- a/accel/tcg/translate-all.c
> +++ b/accel/tcg/translate-all.c
> @@ -644,11 +644,8 @@ static inline void *alloc_code_gen_buffer(void)
>  static inline void *alloc_code_gen_buffer(void)
>  {
>      size_t size = tcg_ctx->code_gen_buffer_size;
> -    void *buf;
> -
> -    buf = VirtualAlloc(NULL, size, MEM_RESERVE | MEM_COMMIT,
> +    return VirtualAlloc(NULL, size, MEM_RESERVE | MEM_COMMIT,
>                          PAGE_EXECUTE_READWRITE);
> -    return buf;
>  }
>  #else
>  static inline void *alloc_code_gen_buffer(void)
> diff --git a/block/quorum.c b/block/quorum.c
> index 14333c18aa..304442ef65 100644
> --- a/block/quorum.c
> +++ b/block/quorum.c
> @@ -608,7 +608,7 @@ static void read_quorum_children_entry(void *opaque)
>  static int read_quorum_children(QuorumAIOCB *acb)
>  {
>      BDRVQuorumState *s = acb->bs->opaque;
> -    int i, ret;
> +    int i;
>  
>      acb->children_read = s->num_children;
>      for (i = 0; i < s->num_children; i++) {
> @@ -643,9 +643,7 @@ static int read_quorum_children(QuorumAIOCB *acb)
>          qemu_coroutine_yield();
>      }
>  
> -    ret = acb->vote_ret;
> -
> -    return ret;
> +    return acb->vote_ret;
>  }
>  
>  static int read_fifo_child(QuorumAIOCB *acb)
> diff --git a/hw/arm/exynos4210.c b/hw/arm/exynos4210.c
> index 06f9d1ffa4..d5ce275b21 100644
> --- a/hw/arm/exynos4210.c
> +++ b/hw/arm/exynos4210.c
> @@ -156,12 +156,7 @@ void exynos4210_write_secondary(ARMCPU *cpu,
>  
>  static uint64_t exynos4210_calc_affinity(int cpu)
>  {
> -    uint64_t mp_affinity;
> -
> -    /* Exynos4210 has 0x9 as cluster ID */
> -    mp_affinity = (0x9 << ARM_AFF1_SHIFT) | cpu;
> -
> -    return mp_affinity;
> +    return (0x9 << ARM_AFF1_SHIFT) | cpu;
>  }
>  
>  Exynos4210State *exynos4210_init(MemoryRegion *system_mem)
> diff --git a/hw/block/vhost-user-blk.c b/hw/block/vhost-user-blk.c
> index f840f07dfe..3f41ca9e26 100644
> --- a/hw/block/vhost-user-blk.c
> +++ b/hw/block/vhost-user-blk.c
> @@ -196,7 +196,6 @@ static uint64_t vhost_user_blk_get_features(VirtIODevice *vdev,
>                                              Error **errp)
>  {
>      VHostUserBlk *s = VHOST_USER_BLK(vdev);
> -    uint64_t get_features;
>  
>      /* Turn on pre-defined features */
>      virtio_add_feature(&features, VIRTIO_BLK_F_SEG_MAX);
> @@ -215,9 +214,7 @@ static uint64_t vhost_user_blk_get_features(VirtIODevice *vdev,
>          virtio_add_feature(&features, VIRTIO_BLK_F_MQ);
>      }
>  
> -    get_features = vhost_get_features(&s->dev, user_feature_bits, features);
> -
> -    return get_features;
> +    return vhost_get_features(&s->dev, user_feature_bits, features);
>  }
>  
>  static void vhost_user_blk_handle_output(VirtIODevice *vdev, VirtQueue *vq)
> diff --git a/hw/hppa/dino.c b/hw/hppa/dino.c
> index 15aefde09c..c5dcf3104d 100644
> --- a/hw/hppa/dino.c
> +++ b/hw/hppa/dino.c
> @@ -403,13 +403,10 @@ static void dino_set_irq(void *opaque, int irq, int level)
>  static int dino_pci_map_irq(PCIDevice *d, int irq_num)
>  {
>      int slot = d->devfn >> 3;
> -    int local_irq;
>  
>      assert(irq_num >= 0 && irq_num <= 3);
>  
> -    local_irq = slot & 0x03;
> -
> -    return local_irq;
> +    return slot & 0x03;
>  }
>  
>  static void dino_set_timer_irq(void *opaque, int irq, int level)
> diff --git a/hw/misc/mos6522.c b/hw/misc/mos6522.c
> index 8ad9fc831e..606532aa65 100644
> --- a/hw/misc/mos6522.c
> +++ b/hw/misc/mos6522.c
> @@ -176,12 +176,8 @@ static void mos6522_set_sr_int(MOS6522State *s)
>  
>  static uint64_t mos6522_get_counter_value(MOS6522State *s, MOS6522Timer *ti)
>  {
> -    uint64_t d;
> -
> -    d = muldiv64(qemu_clock_get_ns(QEMU_CLOCK_VIRTUAL) - ti->load_time,
> +    return muldiv64(qemu_clock_get_ns(QEMU_CLOCK_VIRTUAL) - ti->load_time,
>                   ti->frequency, NANOSECONDS_PER_SECOND);
> -
> -    return d;
>  }
>  
>  static uint64_t mos6522_get_load_time(MOS6522State *s, MOS6522Timer *ti)
> diff --git a/hw/net/ftgmac100.c b/hw/net/ftgmac100.c
> index 704f452067..3300e8ef4a 100644
> --- a/hw/net/ftgmac100.c
> +++ b/hw/net/ftgmac100.c
> @@ -511,7 +511,6 @@ static uint32_t ftgmac100_rxpoll(FTGMAC100State *s)
>  
>      uint32_t cnt = 1024 * FTGMAC100_APTC_RXPOLL_CNT(s->aptcr);
>      uint32_t speed = (s->maccr & FTGMAC100_MACCR_FAST_MODE) ? 1 : 0;
> -    uint32_t period;
>  
>      if (s->aptcr & FTGMAC100_APTC_RXPOLL_TIME_SEL) {
>          cnt <<= 4;
> @@ -521,9 +520,7 @@ static uint32_t ftgmac100_rxpoll(FTGMAC100State *s)
>          speed = 2;
>      }
>  
> -    period = cnt / div[speed];
> -
> -    return period;
> +    return cnt / div[speed];
>  }
>  
>  static void ftgmac100_reset(DeviceState *d)
> diff --git a/hw/ppc/pnv_lpc.c b/hw/ppc/pnv_lpc.c
> index c42b4a8f6c..a77e20368e 100644
> --- a/hw/ppc/pnv_lpc.c
> +++ b/hw/ppc/pnv_lpc.c
> @@ -125,25 +125,15 @@ static int pnv_lpc_dt_xscom(PnvXScomInterface *dev, void *fdt, int xscom_offset)
>  static bool opb_read(PnvLpcController *lpc, uint32_t addr, uint8_t *data,
>                       int sz)
>  {
> -    bool success;
> -
> -    /* XXX Handle access size limits and FW read caching here */
> -    success = !address_space_rw(&lpc->opb_as, addr, MEMTXATTRS_UNSPECIFIED,
> +    return !address_space_rw(&lpc->opb_as, addr, MEMTXATTRS_UNSPECIFIED,
>                                  data, sz, false);
> -
> -    return success;
>  }
>  
>  static bool opb_write(PnvLpcController *lpc, uint32_t addr, uint8_t *data,
>                        int sz)
>  {
> -    bool success;
> -
> -    /* XXX Handle access size limits here */
> -    success = !address_space_rw(&lpc->opb_as, addr, MEMTXATTRS_UNSPECIFIED,
> +    return !address_space_rw(&lpc->opb_as, addr, MEMTXATTRS_UNSPECIFIED,
>                                  data, sz, true);
> -
> -    return success;
>  }
>  
>  #define ECCB_CTL_READ           PPC_BIT(15)
> diff --git a/io/net-listener.c b/io/net-listener.c
> index 555e8acaa4..3317aa6e5f 100644
> --- a/io/net-listener.c
> +++ b/io/net-listener.c
> @@ -25,11 +25,7 @@
>  
>  QIONetListener *qio_net_listener_new(void)
>  {
> -    QIONetListener *ret;
> -
> -    ret = QIO_NET_LISTENER(object_new(TYPE_QIO_NET_LISTENER));
> -
> -    return ret;
> +    return QIO_NET_LISTENER(object_new(TYPE_QIO_NET_LISTENER));
>  }
>  
>  void qio_net_listener_set_name(QIONetListener *listener,
> diff --git a/target/i386/hax-darwin.c b/target/i386/hax-darwin.c
> index acdde476a0..a5426a6dac 100644
> --- a/target/i386/hax-darwin.c
> +++ b/target/i386/hax-darwin.c
> @@ -257,10 +257,7 @@ int hax_host_setup_vcpu_channel(struct hax_vcpu_state *vcpu)
>  
>  int hax_vcpu_run(struct hax_vcpu_state *vcpu)
>  {
> -    int ret;
> -
> -    ret = ioctl(vcpu->fd, HAX_VCPU_IOCTL_RUN, NULL);
> -    return ret;
> +    return ioctl(vcpu->fd, HAX_VCPU_IOCTL_RUN, NULL);
>  }
>  
>  int hax_sync_fpu(CPUArchState *env, struct fx_layout *fl, int set)
> @@ -315,13 +312,12 @@ int hax_sync_vcpu_state(CPUArchState *env, struct vcpu_state_t *state, int set)
>  
>  int hax_inject_interrupt(CPUArchState *env, int vector)
>  {
> -    int ret, fd;
> +    int fd;
>  
>      fd = hax_vcpu_get_fd(env);
>      if (fd <= 0) {
>          return -1;
>      }
>  
> -    ret = ioctl(fd, HAX_VCPU_IOCTL_INTERRUPT, &vector);
> -    return ret;
> +    return ioctl(fd, HAX_VCPU_IOCTL_INTERRUPT, &vector);
>  }
> diff --git a/target/mips/dsp_helper.c b/target/mips/dsp_helper.c
> index f152fea34a..739b69dd45 100644
> --- a/target/mips/dsp_helper.c
> +++ b/target/mips/dsp_helper.c
> @@ -3274,14 +3274,11 @@ target_ulong helper_dextr_l(target_ulong ac, target_ulong shift,
>                              CPUMIPSState *env)
>  {
>      uint64_t temp[3];
> -    target_ulong result;
>  
>      shift = shift & 0x3F;
>  
>      mipsdsp_rndrashift_acc(temp, ac, shift, env);
> -    result = (temp[1] << 63) | (temp[0] >> 1);
> -
> -    return result;
> +    return (temp[1] << 63) | (temp[0] >> 1);
>  }
>  
>  target_ulong helper_dextr_r_l(target_ulong ac, target_ulong shift,
> @@ -3289,7 +3286,6 @@ target_ulong helper_dextr_r_l(target_ulong ac, target_ulong shift,
>  {
>      uint64_t temp[3];
>      uint32_t temp128;
> -    target_ulong result;
>  
>      shift = shift & 0x3F;
>      mipsdsp_rndrashift_acc(temp, ac, shift, env);
> @@ -3309,9 +3305,7 @@ target_ulong helper_dextr_r_l(target_ulong ac, target_ulong shift,
>          set_DSPControl_overflow_flag(1, 23, env);
>      }
>  
> -    result = (temp[1] << 63) | (temp[0] >> 1);
> -
> -    return result;
> +    return (temp[1] << 63) | (temp[0] >> 1);
>  }
>  
>  target_ulong helper_dextr_rs_l(target_ulong ac, target_ulong shift,
> @@ -3319,7 +3313,6 @@ target_ulong helper_dextr_rs_l(target_ulong ac, target_ulong shift,
>  {
>      uint64_t temp[3];
>      uint32_t temp128;
> -    target_ulong result;
>  
>      shift = shift & 0x3F;
>      mipsdsp_rndrashift_acc(temp, ac, shift, env);
> @@ -3345,9 +3338,7 @@ target_ulong helper_dextr_rs_l(target_ulong ac, target_ulong shift,
>          }
>          set_DSPControl_overflow_flag(1, 23, env);
>      }
> -    result = (temp[1] << 63) | (temp[0] >> 1);
> -
> -    return result;
> +    return (temp[1] << 63) | (temp[0] >> 1);
>  }
>  #endif
>  
> diff --git a/target/xtensa/core-dc232b/xtensa-modules.c b/target/xtensa/core-dc232b/xtensa-modules.c
> index d322c3f52a..164df3b1a4 100644
> --- a/target/xtensa/core-dc232b/xtensa-modules.c
> +++ b/target/xtensa/core-dc232b/xtensa-modules.c
> @@ -1736,9 +1736,7 @@ Operand_arr_decode (uint32 *valp ATTRIBUTE_UNUSED)
>  static int
>  Operand_arr_encode (uint32 *valp)
>  {
> -  int error;
> -  error = (*valp & ~0xf) != 0;
> -  return error;
> +  return (*valp & ~0xf) != 0;
>  }
>  
>  static int
> @@ -1750,9 +1748,7 @@ Operand_ars_decode (uint32 *valp ATTRIBUTE_UNUSED)
>  static int
>  Operand_ars_encode (uint32 *valp)
>  {
> -  int error;
> -  error = (*valp & ~0xf) != 0;
> -  return error;
> +  return (*valp & ~0xf) != 0;
>  }
>  
>  static int
> @@ -1764,9 +1760,7 @@ Operand_art_decode (uint32 *valp ATTRIBUTE_UNUSED)
>  static int
>  Operand_art_encode (uint32 *valp)
>  {
> -  int error;
> -  error = (*valp & ~0xf) != 0;
> -  return error;
> +  return (*valp & ~0xf) != 0;
>  }
>  
>  static int
> @@ -1778,9 +1772,7 @@ Operand_ar0_decode (uint32 *valp ATTRIBUTE_UNUSED)
>  static int
>  Operand_ar0_encode (uint32 *valp)
>  {
> -  int error;
> -  error = (*valp & ~0x1f) != 0;
> -  return error;
> +  return (*valp & ~0x1f) != 0;
>  }
>  
>  static int
> @@ -1792,9 +1784,7 @@ Operand_ar4_decode (uint32 *valp ATTRIBUTE_UNUSED)
>  static int
>  Operand_ar4_encode (uint32 *valp)
>  {
> -  int error;
> -  error = (*valp & ~0x1f) != 0;
> -  return error;
> +  return (*valp & ~0x1f) != 0;
>  }
>  
>  static int
> @@ -1806,9 +1796,7 @@ Operand_ar8_decode (uint32 *valp ATTRIBUTE_UNUSED)
>  static int
>  Operand_ar8_encode (uint32 *valp)
>  {
> -  int error;
> -  error = (*valp & ~0x1f) != 0;
> -  return error;
> +  return (*valp & ~0x1f) != 0;
>  }
>  
>  static int
> @@ -1820,9 +1808,7 @@ Operand_ar12_decode (uint32 *valp ATTRIBUTE_UNUSED)
>  static int
>  Operand_ar12_encode (uint32 *valp)
>  {
> -  int error;
> -  error = (*valp & ~0x1f) != 0;
> -  return error;
> +  return (*valp & ~0x1f) != 0;
>  }
>  
>  static int
> @@ -1834,9 +1820,7 @@ Operand_ars_entry_decode (uint32 *valp ATTRIBUTE_UNUSED)
>  static int
>  Operand_ars_entry_encode (uint32 *valp)
>  {
> -  int error;
> -  error = (*valp & ~0x1f) != 0;
> -  return error;
> +  return (*valp & ~0x1f) != 0;
>  }
>  
>  static int
> @@ -2406,9 +2390,7 @@ Operand_mx_decode (uint32 *valp ATTRIBUTE_UNUSED)
>  static int
>  Operand_mx_encode (uint32 *valp)
>  {
> -  int error;
> -  error = (*valp & ~0x3) != 0;
> -  return error;
> +  return (*valp & ~0x3) != 0;
>  }
>  
>  static int
> @@ -2436,9 +2418,7 @@ Operand_mw_decode (uint32 *valp ATTRIBUTE_UNUSED)
>  static int
>  Operand_mw_encode (uint32 *valp)
>  {
> -  int error;
> -  error = (*valp & ~0x3) != 0;
> -  return error;
> +  return (*valp & ~0x3) != 0;
>  }
>  
>  static int
> @@ -2450,9 +2430,7 @@ Operand_mr0_decode (uint32 *valp ATTRIBUTE_UNUSED)
>  static int
>  Operand_mr0_encode (uint32 *valp)
>  {
> -  int error;
> -  error = (*valp & ~0x3) != 0;
> -  return error;
> +  return (*valp & ~0x3) != 0;
>  }
>  
>  static int
> @@ -2464,9 +2442,7 @@ Operand_mr1_decode (uint32 *valp ATTRIBUTE_UNUSED)
>  static int
>  Operand_mr1_encode (uint32 *valp)
>  {
> -  int error;
> -  error = (*valp & ~0x3) != 0;
> -  return error;
> +  return (*valp & ~0x3) != 0;
>  }
>  
>  static int
> @@ -2478,9 +2454,7 @@ Operand_mr2_decode (uint32 *valp ATTRIBUTE_UNUSED)
>  static int
>  Operand_mr2_encode (uint32 *valp)
>  {
> -  int error;
> -  error = (*valp & ~0x3) != 0;
> -  return error;
> +  return (*valp & ~0x3) != 0;
>  }
>  
>  static int
> @@ -2492,9 +2466,7 @@ Operand_mr3_decode (uint32 *valp ATTRIBUTE_UNUSED)
>  static int
>  Operand_mr3_encode (uint32 *valp)
>  {
> -  int error;
> -  error = (*valp & ~0x3) != 0;
> -  return error;
> +  return (*valp & ~0x3) != 0;
>  }
>  
>  static int
> diff --git a/target/xtensa/core-dc233c/xtensa-modules.c b/target/xtensa/core-dc233c/xtensa-modules.c
> index 7c20f82349..0f32f0804a 100644
> --- a/target/xtensa/core-dc233c/xtensa-modules.c
> +++ b/target/xtensa/core-dc233c/xtensa-modules.c
> @@ -1817,9 +1817,7 @@ Operand_arr_decode (uint32 *valp ATTRIBUTE_UNUSED)
>  static int
>  Operand_arr_encode (uint32 *valp)
>  {
> -  int error;
> -  error = (*valp & ~0xf) != 0;
> -  return error;
> +  return (*valp & ~0xf) != 0;
>  }
>  
>  static int
> @@ -1831,9 +1829,7 @@ Operand_ars_decode (uint32 *valp ATTRIBUTE_UNUSED)
>  static int
>  Operand_ars_encode (uint32 *valp)
>  {
> -  int error;
> -  error = (*valp & ~0xf) != 0;
> -  return error;
> +  return (*valp & ~0xf) != 0;
>  }
>  
>  static int
> @@ -1845,9 +1841,7 @@ Operand_art_decode (uint32 *valp ATTRIBUTE_UNUSED)
>  static int
>  Operand_art_encode (uint32 *valp)
>  {
> -  int error;
> -  error = (*valp & ~0xf) != 0;
> -  return error;
> +  return (*valp & ~0xf) != 0;
>  }
>  
>  static int
> @@ -1859,9 +1853,7 @@ Operand_ar0_decode (uint32 *valp ATTRIBUTE_UNUSED)
>  static int
>  Operand_ar0_encode (uint32 *valp)
>  {
> -  int error;
> -  error = (*valp & ~0x1f) != 0;
> -  return error;
> +  return (*valp & ~0x1f) != 0;
>  }
>  
>  static int
> @@ -1873,9 +1865,7 @@ Operand_ar4_decode (uint32 *valp ATTRIBUTE_UNUSED)
>  static int
>  Operand_ar4_encode (uint32 *valp)
>  {
> -  int error;
> -  error = (*valp & ~0x1f) != 0;
> -  return error;
> +  return (*valp & ~0x1f) != 0;
>  }
>  
>  static int
> @@ -1887,9 +1877,7 @@ Operand_ar8_decode (uint32 *valp ATTRIBUTE_UNUSED)
>  static int
>  Operand_ar8_encode (uint32 *valp)
>  {
> -  int error;
> -  error = (*valp & ~0x1f) != 0;
> -  return error;
> +  return (*valp & ~0x1f) != 0;
>  }
>  
>  static int
> @@ -1901,9 +1889,7 @@ Operand_ar12_decode (uint32 *valp ATTRIBUTE_UNUSED)
>  static int
>  Operand_ar12_encode (uint32 *valp)
>  {
> -  int error;
> -  error = (*valp & ~0x1f) != 0;
> -  return error;
> +  return (*valp & ~0x1f) != 0;
>  }
>  
>  static int
> @@ -1915,9 +1901,7 @@ Operand_ars_entry_decode (uint32 *valp ATTRIBUTE_UNUSED)
>  static int
>  Operand_ars_entry_encode (uint32 *valp)
>  {
> -  int error;
> -  error = (*valp & ~0x1f) != 0;
> -  return error;
> +  return (*valp & ~0x1f) != 0;
>  }
>  
>  static int
> @@ -2487,9 +2471,7 @@ Operand_mx_decode (uint32 *valp ATTRIBUTE_UNUSED)
>  static int
>  Operand_mx_encode (uint32 *valp)
>  {
> -  int error;
> -  error = (*valp & ~0x3) != 0;
> -  return error;
> +  return (*valp & ~0x3) != 0;
>  }
>  
>  static int
> @@ -2517,9 +2499,7 @@ Operand_mw_decode (uint32 *valp ATTRIBUTE_UNUSED)
>  static int
>  Operand_mw_encode (uint32 *valp)
>  {
> -  int error;
> -  error = (*valp & ~0x3) != 0;
> -  return error;
> +  return (*valp & ~0x3) != 0;
>  }
>  
>  static int
> @@ -2531,9 +2511,7 @@ Operand_mr0_decode (uint32 *valp ATTRIBUTE_UNUSED)
>  static int
>  Operand_mr0_encode (uint32 *valp)
>  {
> -  int error;
> -  error = (*valp & ~0x3) != 0;
> -  return error;
> +  return (*valp & ~0x3) != 0;
>  }
>  
>  static int
> @@ -2545,9 +2523,7 @@ Operand_mr1_decode (uint32 *valp ATTRIBUTE_UNUSED)
>  static int
>  Operand_mr1_encode (uint32 *valp)
>  {
> -  int error;
> -  error = (*valp & ~0x3) != 0;
> -  return error;
> +  return (*valp & ~0x3) != 0;
>  }
>  
>  static int
> @@ -2559,9 +2535,7 @@ Operand_mr2_decode (uint32 *valp ATTRIBUTE_UNUSED)
>  static int
>  Operand_mr2_encode (uint32 *valp)
>  {
> -  int error;
> -  error = (*valp & ~0x3) != 0;
> -  return error;
> +  return (*valp & ~0x3) != 0;
>  }
>  
>  static int
> @@ -2573,9 +2547,7 @@ Operand_mr3_decode (uint32 *valp ATTRIBUTE_UNUSED)
>  static int
>  Operand_mr3_encode (uint32 *valp)
>  {
> -  int error;
> -  error = (*valp & ~0x3) != 0;
> -  return error;
> +  return (*valp & ~0x3) != 0;
>  }
>  
>  static int
> diff --git a/target/xtensa/core-de212/xtensa-modules.c b/target/xtensa/core-de212/xtensa-modules.c
> index ef7674de3a..480c68d3c6 100644
> --- a/target/xtensa/core-de212/xtensa-modules.c
> +++ b/target/xtensa/core-de212/xtensa-modules.c
> @@ -1798,9 +1798,7 @@ OperandSem_opnd_sem_AR_decode (uint32 *valp ATTRIBUTE_UNUSED)
>  static int
>  OperandSem_opnd_sem_AR_encode (uint32 *valp)
>  {
> -  int error;
> -  error = (*valp >= 32);
> -  return error;
> +  return (*valp >= 32);
>  }
>  
>  static int
> @@ -1812,9 +1810,7 @@ OperandSem_opnd_sem_AR_0_decode (uint32 *valp ATTRIBUTE_UNUSED)
>  static int
>  OperandSem_opnd_sem_AR_0_encode (uint32 *valp)
>  {
> -  int error;
> -  error = (*valp >= 32);
> -  return error;
> +  return (*valp >= 32);
>  }
>  
>  static int
> @@ -1826,9 +1822,7 @@ OperandSem_opnd_sem_AR_1_decode (uint32 *valp ATTRIBUTE_UNUSED)
>  static int
>  OperandSem_opnd_sem_AR_1_encode (uint32 *valp)
>  {
> -  int error;
> -  error = (*valp >= 32);
> -  return error;
> +  return (*valp >= 32);
>  }
>  
>  static int
> @@ -1840,9 +1834,7 @@ OperandSem_opnd_sem_AR_2_decode (uint32 *valp ATTRIBUTE_UNUSED)
>  static int
>  OperandSem_opnd_sem_AR_2_encode (uint32 *valp)
>  {
> -  int error;
> -  error = (*valp >= 32);
> -  return error;
> +  return (*valp >= 32);
>  }
>  
>  static int
> @@ -1854,9 +1846,7 @@ OperandSem_opnd_sem_AR_3_decode (uint32 *valp ATTRIBUTE_UNUSED)
>  static int
>  OperandSem_opnd_sem_AR_3_encode (uint32 *valp)
>  {
> -  int error;
> -  error = (*valp >= 32);
> -  return error;
> +  return (*valp >= 32);
>  }
>  
>  static int
> @@ -1868,9 +1858,7 @@ OperandSem_opnd_sem_AR_4_decode (uint32 *valp ATTRIBUTE_UNUSED)
>  static int
>  OperandSem_opnd_sem_AR_4_encode (uint32 *valp)
>  {
> -  int error;
> -  error = (*valp >= 32);
> -  return error;
> +  return (*valp >= 32);
>  }
>  
>  static int
> @@ -2464,9 +2452,7 @@ OperandSem_opnd_sem_MR_decode (uint32 *valp ATTRIBUTE_UNUSED)
>  static int
>  OperandSem_opnd_sem_MR_encode (uint32 *valp)
>  {
> -  int error;
> -  error = (*valp >= 4);
> -  return error;
> +  return (*valp >= 4);
>  }
>  
>  static int
> @@ -2478,9 +2464,7 @@ OperandSem_opnd_sem_MR_1_decode (uint32 *valp ATTRIBUTE_UNUSED)
>  static int
>  OperandSem_opnd_sem_MR_1_encode (uint32 *valp)
>  {
> -  int error;
> -  error = (*valp >= 4);
> -  return error;
> +  return (*valp >= 4);
>  }
>  
>  static int
> @@ -2492,9 +2476,7 @@ OperandSem_opnd_sem_MR_2_decode (uint32 *valp ATTRIBUTE_UNUSED)
>  static int
>  OperandSem_opnd_sem_MR_2_encode (uint32 *valp)
>  {
> -  int error;
> -  error = (*valp >= 4);
> -  return error;
> +  return (*valp >= 4);
>  }
>  
>  static int
> @@ -2506,9 +2488,7 @@ OperandSem_opnd_sem_MR_3_decode (uint32 *valp ATTRIBUTE_UNUSED)
>  static int
>  OperandSem_opnd_sem_MR_3_encode (uint32 *valp)
>  {
> -  int error;
> -  error = (*valp >= 4);
> -  return error;
> +  return (*valp >= 4);
>  }
>  
>  static int
> @@ -2520,9 +2500,7 @@ OperandSem_opnd_sem_MR_4_decode (uint32 *valp ATTRIBUTE_UNUSED)
>  static int
>  OperandSem_opnd_sem_MR_4_encode (uint32 *valp)
>  {
> -  int error;
> -  error = (*valp >= 4);
> -  return error;
> +  return (*valp >= 4);
>  }
>  
>  static int
> @@ -2534,9 +2512,7 @@ OperandSem_opnd_sem_MR_5_decode (uint32 *valp ATTRIBUTE_UNUSED)
>  static int
>  OperandSem_opnd_sem_MR_5_encode (uint32 *valp)
>  {
> -  int error;
> -  error = (*valp >= 4);
> -  return error;
> +  return (*valp >= 4);
>  }
>  
>  static int
> diff --git a/target/xtensa/core-fsf/xtensa-modules.c b/target/xtensa/core-fsf/xtensa-modules.c
> index f7de2dec15..c32683ff77 100644
> --- a/target/xtensa/core-fsf/xtensa-modules.c
> +++ b/target/xtensa/core-fsf/xtensa-modules.c
> @@ -1379,9 +1379,7 @@ Operand_arr_decode (uint32 *valp ATTRIBUTE_UNUSED)
>  static int
>  Operand_arr_encode (uint32 *valp)
>  {
> -  int error;
> -  error = (*valp & ~0xf) != 0;
> -  return error;
> +  return (*valp & ~0xf) != 0;
>  }
>  
>  static int
> @@ -1393,9 +1391,7 @@ Operand_ars_decode (uint32 *valp ATTRIBUTE_UNUSED)
>  static int
>  Operand_ars_encode (uint32 *valp)
>  {
> -  int error;
> -  error = (*valp & ~0xf) != 0;
> -  return error;
> +  return (*valp & ~0xf) != 0;
>  }
>  
>  static int
> @@ -1407,9 +1403,7 @@ Operand_art_decode (uint32 *valp ATTRIBUTE_UNUSED)
>  static int
>  Operand_art_encode (uint32 *valp)
>  {
> -  int error;
> -  error = (*valp & ~0xf) != 0;
> -  return error;
> +  return (*valp & ~0xf) != 0;
>  }
>  
>  static int
> @@ -1421,9 +1415,7 @@ Operand_ar0_decode (uint32 *valp ATTRIBUTE_UNUSED)
>  static int
>  Operand_ar0_encode (uint32 *valp)
>  {
> -  int error;
> -  error = (*valp & ~0x3f) != 0;
> -  return error;
> +  return (*valp & ~0x3f) != 0;
>  }
>  
>  static int
> @@ -1435,9 +1427,7 @@ Operand_ar4_decode (uint32 *valp ATTRIBUTE_UNUSED)
>  static int
>  Operand_ar4_encode (uint32 *valp)
>  {
> -  int error;
> -  error = (*valp & ~0x3f) != 0;
> -  return error;
> +  return (*valp & ~0x3f) != 0;
>  }
>  
>  static int
> @@ -1449,9 +1439,7 @@ Operand_ar8_decode (uint32 *valp ATTRIBUTE_UNUSED)
>  static int
>  Operand_ar8_encode (uint32 *valp)
>  {
> -  int error;
> -  error = (*valp & ~0x3f) != 0;
> -  return error;
> +  return (*valp & ~0x3f) != 0;
>  }
>  
>  static int
> @@ -1463,9 +1451,7 @@ Operand_ar12_decode (uint32 *valp ATTRIBUTE_UNUSED)
>  static int
>  Operand_ar12_encode (uint32 *valp)
>  {
> -  int error;
> -  error = (*valp & ~0x3f) != 0;
> -  return error;
> +  return (*valp & ~0x3f) != 0;
>  }
>  
>  static int
> @@ -1477,9 +1463,7 @@ Operand_ars_entry_decode (uint32 *valp ATTRIBUTE_UNUSED)
>  static int
>  Operand_ars_entry_encode (uint32 *valp)
>  {
> -  int error;
> -  error = (*valp & ~0x3f) != 0;
> -  return error;
> +  return (*valp & ~0x3f) != 0;
>  }
>  
>  static int
> diff --git a/target/xtensa/core-sample_controller/xtensa-modules.c b/target/xtensa/core-sample_controller/xtensa-modules.c
> index fba41b99ae..7e87d216bd 100644
> --- a/target/xtensa/core-sample_controller/xtensa-modules.c
> +++ b/target/xtensa/core-sample_controller/xtensa-modules.c
> @@ -1570,9 +1570,7 @@ OperandSem_opnd_sem_AR_decode (uint32 *valp ATTRIBUTE_UNUSED)
>  static int
>  OperandSem_opnd_sem_AR_encode (uint32 *valp)
>  {
> -  int error;
> -  error = (*valp >= 32);
> -  return error;
> +  return (*valp >= 32);
>  }
>  
>  static int
> @@ -1584,9 +1582,7 @@ OperandSem_opnd_sem_AR_0_decode (uint32 *valp ATTRIBUTE_UNUSED)
>  static int
>  OperandSem_opnd_sem_AR_0_encode (uint32 *valp)
>  {
> -  int error;
> -  error = (*valp >= 32);
> -  return error;
> +  return (*valp >= 32);
>  }
>  
>  static int
> @@ -1598,9 +1594,7 @@ OperandSem_opnd_sem_AR_1_decode (uint32 *valp ATTRIBUTE_UNUSED)
>  static int
>  OperandSem_opnd_sem_AR_1_encode (uint32 *valp)
>  {
> -  int error;
> -  error = (*valp >= 32);
> -  return error;
> +  return (*valp >= 32);
>  }
>  
>  static int
> @@ -1612,9 +1606,7 @@ OperandSem_opnd_sem_AR_2_decode (uint32 *valp ATTRIBUTE_UNUSED)
>  static int
>  OperandSem_opnd_sem_AR_2_encode (uint32 *valp)
>  {
> -  int error;
> -  error = (*valp >= 32);
> -  return error;
> +  return (*valp >= 32);
>  }
>  
>  static int
> @@ -1626,9 +1618,7 @@ OperandSem_opnd_sem_AR_3_decode (uint32 *valp ATTRIBUTE_UNUSED)
>  static int
>  OperandSem_opnd_sem_AR_3_encode (uint32 *valp)
>  {
> -  int error;
> -  error = (*valp >= 32);
> -  return error;
> +  return (*valp >= 32);
>  }
>  
>  static int
> @@ -1640,9 +1630,7 @@ OperandSem_opnd_sem_AR_4_decode (uint32 *valp ATTRIBUTE_UNUSED)
>  static int
>  OperandSem_opnd_sem_AR_4_encode (uint32 *valp)
>  {
> -  int error;
> -  error = (*valp >= 32);
> -  return error;
> +  return (*valp >= 32);
>  }
>  
>  static int
> diff --git a/target/xtensa/translate.c b/target/xtensa/translate.c
> index 4f6d03059f..f88cdbeecd 100644
> --- a/target/xtensa/translate.c
> +++ b/target/xtensa/translate.c
> @@ -1272,11 +1272,8 @@ XtensaOpcodeOps *
>  xtensa_find_opcode_ops(const XtensaOpcodeTranslators *t,
>                         const char *name)
>  {
> -    XtensaOpcodeOps *ops;
> -
> -    ops = bsearch(name, t->opcode, t->num_opcodes,
> +    return bsearch(name, t->opcode, t->num_opcodes,
>                    sizeof(XtensaOpcodeOps), compare_opcode_ops);
> -    return ops;
>  }
>  
>  static void translate_abs(DisasContext *dc, const uint32_t arg[],
> diff --git a/tests/m48t59-test.c b/tests/m48t59-test.c
> index 26af7d6e8e..5b695971c7 100644
> --- a/tests/m48t59-test.c
> +++ b/tests/m48t59-test.c
> @@ -256,8 +256,6 @@ static void base_setup(void)
>  
>  int main(int argc, char **argv)
>  {
> -    int ret;
> -
>      base_setup();
>  
>      g_test_init(&argc, &argv, NULL);
> @@ -267,7 +265,5 @@ int main(int argc, char **argv)
>          qtest_add_func("/rtc/bcd-check-time", bcd_check_time);
>      }
>      qtest_add_func("/rtc/fuzz-registers", fuzz_registers);
> -    ret = g_test_run();
> -
> -    return ret;
> +    return g_test_run();
>  }
> diff --git a/tests/test-thread-pool.c b/tests/test-thread-pool.c
> index 91b4ec5524..9cdccb3a47 100644
> --- a/tests/test-thread-pool.c
> +++ b/tests/test-thread-pool.c
> @@ -224,8 +224,6 @@ static void test_cancel_async(void)
>  
>  int main(int argc, char **argv)
>  {
> -    int ret;
> -
>      qemu_init_main_loop(&error_abort);
>      ctx = qemu_get_current_aio_context();
>      pool = aio_get_thread_pool(ctx);
> @@ -238,7 +236,5 @@ int main(int argc, char **argv)
>      g_test_add_func("/thread-pool/cancel", test_cancel);
>      g_test_add_func("/thread-pool/cancel-async", test_cancel_async);
>  
> -    ret = g_test_run();
> -
> -    return ret;
> +    return g_test_run();
>  }
> diff --git a/util/uri.c b/util/uri.c
> index 93ecefdaaf..8624a7ac23 100644
> --- a/util/uri.c
> +++ b/util/uri.c
> @@ -1065,10 +1065,7 @@ URI *uri_parse_raw(const char *str, int raw)
>   */
>  URI *uri_new(void)
>  {
> -    URI *ret;
> -
> -    ret = g_new0(URI, 1);
> -    return ret;
> +    return g_new0(URI, 1);
>  }
>  
>  /**

-- 
David Gibson			| I'll have my music baroque, and my code
david AT gibson.dropbear.id.au	| minimalist, thank you.  NOT _the_ _other_
				| _way_ _around_!
http://www.ozlabs.org/~dgibson

[-- Attachment #2: signature.asc --]
[-- Type: application/pgp-signature, Size: 833 bytes --]

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

* Re: [Qemu-devel] [Qemu-arm] [PATCH 4/4] Remove unnecessary variables for function return value
  2018-03-22 16:12 ` [Qemu-devel] [PATCH 4/4] Remove unnecessary variables for function return value Laurent Vivier
                     ` (2 preceding siblings ...)
  2018-03-22 23:06   ` David Gibson
@ 2018-03-23  2:14   ` Philippe Mathieu-Daudé
  2018-03-23 10:44   ` [Qemu-devel] " Alberto Garcia
  4 siblings, 0 replies; 31+ messages in thread
From: Philippe Mathieu-Daudé @ 2018-03-23  2:14 UTC (permalink / raw)
  To: Laurent Vivier, qemu-devel
  Cc: Peter Maydell, Michael S. Tsirkin, Jason Wang, Markus Armbruster,
	Max Filippov, Yongbok Kim, Alberto Garcia, qemu-block,
	qemu-trivial, Eric Blake, Alexander Graf, David Gibson,
	Fam Zheng, Eduardo Habkost, Dr. David Alan Gilbert, qemu-arm,
	Richard Henderson, Kevin Wolf, Daniel P. Berrangé,
	Igor Mitsyanko, Max Reitz, qemu-ppc, Paolo Bonzini,
	Aurelien Jarno

Hi Laurent,

On 03/22/2018 01:12 PM, Laurent Vivier wrote:
> Re-run Coccinelle script scripts/coccinelle/return_directly.cocci
> 
> Signed-off-by: Laurent Vivier <lvivier@redhat.com>
> ---
>  accel/tcg/translate-all.c                          |  5 +-
>  block/quorum.c                                     |  6 +--
>  hw/arm/exynos4210.c                                |  7 +--
>  hw/block/vhost-user-blk.c                          |  5 +-
>  hw/hppa/dino.c                                     |  5 +-
>  hw/misc/mos6522.c                                  |  6 +--
>  hw/net/ftgmac100.c                                 |  5 +-
>  hw/ppc/pnv_lpc.c                                   | 14 +-----
>  io/net-listener.c                                  |  6 +--
>  target/i386/hax-darwin.c                           | 10 ++--
>  target/mips/dsp_helper.c                           | 15 ++----
>  target/xtensa/core-dc232b/xtensa-modules.c         | 56 ++++++----------------
>  target/xtensa/core-dc233c/xtensa-modules.c         | 56 ++++++----------------
>  target/xtensa/core-de212/xtensa-modules.c          | 48 +++++--------------
>  target/xtensa/core-fsf/xtensa-modules.c            | 32 ++++---------
>  .../xtensa/core-sample_controller/xtensa-modules.c | 24 +++-------
>  target/xtensa/translate.c                          |  5 +-
>  tests/m48t59-test.c                                |  6 +--
>  tests/test-thread-pool.c                           |  6 +--
>  util/uri.c                                         |  5 +-
>  20 files changed, 75 insertions(+), 247 deletions(-)
> 
> diff --git a/accel/tcg/translate-all.c b/accel/tcg/translate-all.c
> index 5ad1b919bc..55d822d410 100644
> --- a/accel/tcg/translate-all.c
> +++ b/accel/tcg/translate-all.c
> @@ -644,11 +644,8 @@ static inline void *alloc_code_gen_buffer(void)
>  static inline void *alloc_code_gen_buffer(void)
>  {
>      size_t size = tcg_ctx->code_gen_buffer_size;
> -    void *buf;
> -
> -    buf = VirtualAlloc(NULL, size, MEM_RESERVE | MEM_COMMIT,
> +    return VirtualAlloc(NULL, size, MEM_RESERVE | MEM_COMMIT,
>                          PAGE_EXECUTE_READWRITE);
> -    return buf;
>  }
>  #else
>  static inline void *alloc_code_gen_buffer(void)
> diff --git a/block/quorum.c b/block/quorum.c
> index 14333c18aa..304442ef65 100644
> --- a/block/quorum.c
> +++ b/block/quorum.c
> @@ -608,7 +608,7 @@ static void read_quorum_children_entry(void *opaque)
>  static int read_quorum_children(QuorumAIOCB *acb)
>  {
>      BDRVQuorumState *s = acb->bs->opaque;
> -    int i, ret;
> +    int i;
>  
>      acb->children_read = s->num_children;
>      for (i = 0; i < s->num_children; i++) {
> @@ -643,9 +643,7 @@ static int read_quorum_children(QuorumAIOCB *acb)
>          qemu_coroutine_yield();
>      }
>  
> -    ret = acb->vote_ret;
> -
> -    return ret;
> +    return acb->vote_ret;
>  }
>  
>  static int read_fifo_child(QuorumAIOCB *acb)
> diff --git a/hw/arm/exynos4210.c b/hw/arm/exynos4210.c
> index 06f9d1ffa4..d5ce275b21 100644
> --- a/hw/arm/exynos4210.c
> +++ b/hw/arm/exynos4210.c
> @@ -156,12 +156,7 @@ void exynos4210_write_secondary(ARMCPU *cpu,
>  
>  static uint64_t exynos4210_calc_affinity(int cpu)
>  {
> -    uint64_t mp_affinity;
> -
> -    /* Exynos4210 has 0x9 as cluster ID */
> -    mp_affinity = (0x9 << ARM_AFF1_SHIFT) | cpu;
> -
> -    return mp_affinity;
> +    return (0x9 << ARM_AFF1_SHIFT) | cpu;

You should run spatch with --keep-comments.

>  }
>  
>  Exynos4210State *exynos4210_init(MemoryRegion *system_mem)
> diff --git a/hw/block/vhost-user-blk.c b/hw/block/vhost-user-blk.c
> index f840f07dfe..3f41ca9e26 100644
> --- a/hw/block/vhost-user-blk.c
> +++ b/hw/block/vhost-user-blk.c
> @@ -196,7 +196,6 @@ static uint64_t vhost_user_blk_get_features(VirtIODevice *vdev,
>                                              Error **errp)
>  {
>      VHostUserBlk *s = VHOST_USER_BLK(vdev);
> -    uint64_t get_features;
>  
>      /* Turn on pre-defined features */
>      virtio_add_feature(&features, VIRTIO_BLK_F_SEG_MAX);
> @@ -215,9 +214,7 @@ static uint64_t vhost_user_blk_get_features(VirtIODevice *vdev,
>          virtio_add_feature(&features, VIRTIO_BLK_F_MQ);
>      }
>  
> -    get_features = vhost_get_features(&s->dev, user_feature_bits, features);
> -
> -    return get_features;
> +    return vhost_get_features(&s->dev, user_feature_bits, features);
>  }
>  
>  static void vhost_user_blk_handle_output(VirtIODevice *vdev, VirtQueue *vq)
> diff --git a/hw/hppa/dino.c b/hw/hppa/dino.c
> index 15aefde09c..c5dcf3104d 100644
> --- a/hw/hppa/dino.c
> +++ b/hw/hppa/dino.c
> @@ -403,13 +403,10 @@ static void dino_set_irq(void *opaque, int irq, int level)
>  static int dino_pci_map_irq(PCIDevice *d, int irq_num)
>  {
>      int slot = d->devfn >> 3;
> -    int local_irq;
>  
>      assert(irq_num >= 0 && irq_num <= 3);
>  
> -    local_irq = slot & 0x03;
> -
> -    return local_irq;
> +    return slot & 0x03;
>  }
>  
>  static void dino_set_timer_irq(void *opaque, int irq, int level)
> diff --git a/hw/misc/mos6522.c b/hw/misc/mos6522.c
> index 8ad9fc831e..606532aa65 100644
> --- a/hw/misc/mos6522.c
> +++ b/hw/misc/mos6522.c
> @@ -176,12 +176,8 @@ static void mos6522_set_sr_int(MOS6522State *s)
>  
>  static uint64_t mos6522_get_counter_value(MOS6522State *s, MOS6522Timer *ti)
>  {
> -    uint64_t d;
> -
> -    d = muldiv64(qemu_clock_get_ns(QEMU_CLOCK_VIRTUAL) - ti->load_time,
> +    return muldiv64(qemu_clock_get_ns(QEMU_CLOCK_VIRTUAL) - ti->load_time,
>                   ti->frequency, NANOSECONDS_PER_SECOND);
> -
> -    return d;
>  }
>  
>  static uint64_t mos6522_get_load_time(MOS6522State *s, MOS6522Timer *ti)
> diff --git a/hw/net/ftgmac100.c b/hw/net/ftgmac100.c
> index 704f452067..3300e8ef4a 100644
> --- a/hw/net/ftgmac100.c
> +++ b/hw/net/ftgmac100.c
> @@ -511,7 +511,6 @@ static uint32_t ftgmac100_rxpoll(FTGMAC100State *s)
>  
>      uint32_t cnt = 1024 * FTGMAC100_APTC_RXPOLL_CNT(s->aptcr);
>      uint32_t speed = (s->maccr & FTGMAC100_MACCR_FAST_MODE) ? 1 : 0;
> -    uint32_t period;
>  
>      if (s->aptcr & FTGMAC100_APTC_RXPOLL_TIME_SEL) {
>          cnt <<= 4;
> @@ -521,9 +520,7 @@ static uint32_t ftgmac100_rxpoll(FTGMAC100State *s)
>          speed = 2;
>      }
>  
> -    period = cnt / div[speed];
> -
> -    return period;
> +    return cnt / div[speed];
>  }
>  
>  static void ftgmac100_reset(DeviceState *d)
> diff --git a/hw/ppc/pnv_lpc.c b/hw/ppc/pnv_lpc.c
> index c42b4a8f6c..a77e20368e 100644
> --- a/hw/ppc/pnv_lpc.c
> +++ b/hw/ppc/pnv_lpc.c
> @@ -125,25 +125,15 @@ static int pnv_lpc_dt_xscom(PnvXScomInterface *dev, void *fdt, int xscom_offset)
>  static bool opb_read(PnvLpcController *lpc, uint32_t addr, uint8_t *data,
>                       int sz)
>  {
> -    bool success;
> -
> -    /* XXX Handle access size limits and FW read caching here */

Ditto.

> -    success = !address_space_rw(&lpc->opb_as, addr, MEMTXATTRS_UNSPECIFIED,
> +    return !address_space_rw(&lpc->opb_as, addr, MEMTXATTRS_UNSPECIFIED,
>                                  data, sz, false);
> -
> -    return success;
>  }
>  
>  static bool opb_write(PnvLpcController *lpc, uint32_t addr, uint8_t *data,
>                        int sz)
>  {
> -    bool success;
> -
> -    /* XXX Handle access size limits here */

Ditto.

> -    success = !address_space_rw(&lpc->opb_as, addr, MEMTXATTRS_UNSPECIFIED,
> +    return !address_space_rw(&lpc->opb_as, addr, MEMTXATTRS_UNSPECIFIED,
>                                  data, sz, true);
> -
> -    return success;
>  }
>  
>  #define ECCB_CTL_READ           PPC_BIT(15)
> diff --git a/io/net-listener.c b/io/net-listener.c
> index 555e8acaa4..3317aa6e5f 100644
> --- a/io/net-listener.c
> +++ b/io/net-listener.c
> @@ -25,11 +25,7 @@
>  
>  QIONetListener *qio_net_listener_new(void)
>  {
> -    QIONetListener *ret;
> -
> -    ret = QIO_NET_LISTENER(object_new(TYPE_QIO_NET_LISTENER));
> -
> -    return ret;
> +    return QIO_NET_LISTENER(object_new(TYPE_QIO_NET_LISTENER));
>  }
>  
>  void qio_net_listener_set_name(QIONetListener *listener,
> diff --git a/target/i386/hax-darwin.c b/target/i386/hax-darwin.c
> index acdde476a0..a5426a6dac 100644
> --- a/target/i386/hax-darwin.c
> +++ b/target/i386/hax-darwin.c
> @@ -257,10 +257,7 @@ int hax_host_setup_vcpu_channel(struct hax_vcpu_state *vcpu)
>  
>  int hax_vcpu_run(struct hax_vcpu_state *vcpu)
>  {
> -    int ret;
> -
> -    ret = ioctl(vcpu->fd, HAX_VCPU_IOCTL_RUN, NULL);
> -    return ret;
> +    return ioctl(vcpu->fd, HAX_VCPU_IOCTL_RUN, NULL);
>  }
>  
>  int hax_sync_fpu(CPUArchState *env, struct fx_layout *fl, int set)
> @@ -315,13 +312,12 @@ int hax_sync_vcpu_state(CPUArchState *env, struct vcpu_state_t *state, int set)
>  
>  int hax_inject_interrupt(CPUArchState *env, int vector)
>  {
> -    int ret, fd;
> +    int fd;
>  
>      fd = hax_vcpu_get_fd(env);
>      if (fd <= 0) {
>          return -1;
>      }
>  
> -    ret = ioctl(fd, HAX_VCPU_IOCTL_INTERRUPT, &vector);
> -    return ret;
> +    return ioctl(fd, HAX_VCPU_IOCTL_INTERRUPT, &vector);
>  }
> diff --git a/target/mips/dsp_helper.c b/target/mips/dsp_helper.c
> index f152fea34a..739b69dd45 100644
> --- a/target/mips/dsp_helper.c
> +++ b/target/mips/dsp_helper.c
> @@ -3274,14 +3274,11 @@ target_ulong helper_dextr_l(target_ulong ac, target_ulong shift,
>                              CPUMIPSState *env)
>  {
>      uint64_t temp[3];
> -    target_ulong result;
>  
>      shift = shift & 0x3F;
>  
>      mipsdsp_rndrashift_acc(temp, ac, shift, env);
> -    result = (temp[1] << 63) | (temp[0] >> 1);
> -
> -    return result;
> +    return (temp[1] << 63) | (temp[0] >> 1);
>  }
>  
>  target_ulong helper_dextr_r_l(target_ulong ac, target_ulong shift,
> @@ -3289,7 +3286,6 @@ target_ulong helper_dextr_r_l(target_ulong ac, target_ulong shift,
>  {
>      uint64_t temp[3];
>      uint32_t temp128;
> -    target_ulong result;
>  
>      shift = shift & 0x3F;
>      mipsdsp_rndrashift_acc(temp, ac, shift, env);
> @@ -3309,9 +3305,7 @@ target_ulong helper_dextr_r_l(target_ulong ac, target_ulong shift,
>          set_DSPControl_overflow_flag(1, 23, env);
>      }
>  
> -    result = (temp[1] << 63) | (temp[0] >> 1);
> -
> -    return result;
> +    return (temp[1] << 63) | (temp[0] >> 1);
>  }
>  
>  target_ulong helper_dextr_rs_l(target_ulong ac, target_ulong shift,
> @@ -3319,7 +3313,6 @@ target_ulong helper_dextr_rs_l(target_ulong ac, target_ulong shift,
>  {
>      uint64_t temp[3];
>      uint32_t temp128;
> -    target_ulong result;
>  
>      shift = shift & 0x3F;
>      mipsdsp_rndrashift_acc(temp, ac, shift, env);
> @@ -3345,9 +3338,7 @@ target_ulong helper_dextr_rs_l(target_ulong ac, target_ulong shift,
>          }
>          set_DSPControl_overflow_flag(1, 23, env);
>      }
> -    result = (temp[1] << 63) | (temp[0] >> 1);
> -
> -    return result;
> +    return (temp[1] << 63) | (temp[0] >> 1);
>  }
>  #endif
>  
> diff --git a/target/xtensa/core-dc232b/xtensa-modules.c b/target/xtensa/core-dc232b/xtensa-modules.c
> index d322c3f52a..164df3b1a4 100644
> --- a/target/xtensa/core-dc232b/xtensa-modules.c
> +++ b/target/xtensa/core-dc232b/xtensa-modules.c
> @@ -1736,9 +1736,7 @@ Operand_arr_decode (uint32 *valp ATTRIBUTE_UNUSED)
>  static int
>  Operand_arr_encode (uint32 *valp)
>  {
> -  int error;
> -  error = (*valp & ~0xf) != 0;
> -  return error;
> +  return (*valp & ~0xf) != 0;
>  }
>  
>  static int
> @@ -1750,9 +1748,7 @@ Operand_ars_decode (uint32 *valp ATTRIBUTE_UNUSED)
>  static int
>  Operand_ars_encode (uint32 *valp)
>  {
> -  int error;
> -  error = (*valp & ~0xf) != 0;
> -  return error;
> +  return (*valp & ~0xf) != 0;
>  }
>  
>  static int
> @@ -1764,9 +1760,7 @@ Operand_art_decode (uint32 *valp ATTRIBUTE_UNUSED)
>  static int
>  Operand_art_encode (uint32 *valp)
>  {
> -  int error;
> -  error = (*valp & ~0xf) != 0;
> -  return error;
> +  return (*valp & ~0xf) != 0;
>  }
>  
>  static int
> @@ -1778,9 +1772,7 @@ Operand_ar0_decode (uint32 *valp ATTRIBUTE_UNUSED)
>  static int
>  Operand_ar0_encode (uint32 *valp)
>  {
> -  int error;
> -  error = (*valp & ~0x1f) != 0;
> -  return error;
> +  return (*valp & ~0x1f) != 0;
>  }
>  
>  static int
> @@ -1792,9 +1784,7 @@ Operand_ar4_decode (uint32 *valp ATTRIBUTE_UNUSED)
>  static int
>  Operand_ar4_encode (uint32 *valp)
>  {
> -  int error;
> -  error = (*valp & ~0x1f) != 0;
> -  return error;
> +  return (*valp & ~0x1f) != 0;
>  }
>  
>  static int
> @@ -1806,9 +1796,7 @@ Operand_ar8_decode (uint32 *valp ATTRIBUTE_UNUSED)
>  static int
>  Operand_ar8_encode (uint32 *valp)
>  {
> -  int error;
> -  error = (*valp & ~0x1f) != 0;
> -  return error;
> +  return (*valp & ~0x1f) != 0;
>  }
>  
>  static int
> @@ -1820,9 +1808,7 @@ Operand_ar12_decode (uint32 *valp ATTRIBUTE_UNUSED)
>  static int
>  Operand_ar12_encode (uint32 *valp)
>  {
> -  int error;
> -  error = (*valp & ~0x1f) != 0;
> -  return error;
> +  return (*valp & ~0x1f) != 0;
>  }
>  
>  static int
> @@ -1834,9 +1820,7 @@ Operand_ars_entry_decode (uint32 *valp ATTRIBUTE_UNUSED)
>  static int
>  Operand_ars_entry_encode (uint32 *valp)
>  {
> -  int error;
> -  error = (*valp & ~0x1f) != 0;
> -  return error;
> +  return (*valp & ~0x1f) != 0;
>  }
>  
>  static int
> @@ -2406,9 +2390,7 @@ Operand_mx_decode (uint32 *valp ATTRIBUTE_UNUSED)
>  static int
>  Operand_mx_encode (uint32 *valp)
>  {
> -  int error;
> -  error = (*valp & ~0x3) != 0;
> -  return error;
> +  return (*valp & ~0x3) != 0;
>  }
>  
>  static int
> @@ -2436,9 +2418,7 @@ Operand_mw_decode (uint32 *valp ATTRIBUTE_UNUSED)
>  static int
>  Operand_mw_encode (uint32 *valp)
>  {
> -  int error;
> -  error = (*valp & ~0x3) != 0;
> -  return error;
> +  return (*valp & ~0x3) != 0;
>  }
>  
>  static int
> @@ -2450,9 +2430,7 @@ Operand_mr0_decode (uint32 *valp ATTRIBUTE_UNUSED)
>  static int
>  Operand_mr0_encode (uint32 *valp)
>  {
> -  int error;
> -  error = (*valp & ~0x3) != 0;
> -  return error;
> +  return (*valp & ~0x3) != 0;
>  }
>  
>  static int
> @@ -2464,9 +2442,7 @@ Operand_mr1_decode (uint32 *valp ATTRIBUTE_UNUSED)
>  static int
>  Operand_mr1_encode (uint32 *valp)
>  {
> -  int error;
> -  error = (*valp & ~0x3) != 0;
> -  return error;
> +  return (*valp & ~0x3) != 0;
>  }
>  
>  static int
> @@ -2478,9 +2454,7 @@ Operand_mr2_decode (uint32 *valp ATTRIBUTE_UNUSED)
>  static int
>  Operand_mr2_encode (uint32 *valp)
>  {
> -  int error;
> -  error = (*valp & ~0x3) != 0;
> -  return error;
> +  return (*valp & ~0x3) != 0;
>  }
>  
>  static int
> @@ -2492,9 +2466,7 @@ Operand_mr3_decode (uint32 *valp ATTRIBUTE_UNUSED)
>  static int
>  Operand_mr3_encode (uint32 *valp)
>  {
> -  int error;
> -  error = (*valp & ~0x3) != 0;
> -  return error;
> +  return (*valp & ~0x3) != 0;
>  }
>  
>  static int
> diff --git a/target/xtensa/core-dc233c/xtensa-modules.c b/target/xtensa/core-dc233c/xtensa-modules.c
> index 7c20f82349..0f32f0804a 100644
> --- a/target/xtensa/core-dc233c/xtensa-modules.c
> +++ b/target/xtensa/core-dc233c/xtensa-modules.c
> @@ -1817,9 +1817,7 @@ Operand_arr_decode (uint32 *valp ATTRIBUTE_UNUSED)
>  static int
>  Operand_arr_encode (uint32 *valp)
>  {
> -  int error;
> -  error = (*valp & ~0xf) != 0;
> -  return error;
> +  return (*valp & ~0xf) != 0;
>  }
>  
>  static int
> @@ -1831,9 +1829,7 @@ Operand_ars_decode (uint32 *valp ATTRIBUTE_UNUSED)
>  static int
>  Operand_ars_encode (uint32 *valp)
>  {
> -  int error;
> -  error = (*valp & ~0xf) != 0;
> -  return error;
> +  return (*valp & ~0xf) != 0;
>  }
>  
>  static int
> @@ -1845,9 +1841,7 @@ Operand_art_decode (uint32 *valp ATTRIBUTE_UNUSED)
>  static int
>  Operand_art_encode (uint32 *valp)
>  {
> -  int error;
> -  error = (*valp & ~0xf) != 0;
> -  return error;
> +  return (*valp & ~0xf) != 0;
>  }
>  
>  static int
> @@ -1859,9 +1853,7 @@ Operand_ar0_decode (uint32 *valp ATTRIBUTE_UNUSED)
>  static int
>  Operand_ar0_encode (uint32 *valp)
>  {
> -  int error;
> -  error = (*valp & ~0x1f) != 0;
> -  return error;
> +  return (*valp & ~0x1f) != 0;
>  }
>  
>  static int
> @@ -1873,9 +1865,7 @@ Operand_ar4_decode (uint32 *valp ATTRIBUTE_UNUSED)
>  static int
>  Operand_ar4_encode (uint32 *valp)
>  {
> -  int error;
> -  error = (*valp & ~0x1f) != 0;
> -  return error;
> +  return (*valp & ~0x1f) != 0;
>  }
>  
>  static int
> @@ -1887,9 +1877,7 @@ Operand_ar8_decode (uint32 *valp ATTRIBUTE_UNUSED)
>  static int
>  Operand_ar8_encode (uint32 *valp)
>  {
> -  int error;
> -  error = (*valp & ~0x1f) != 0;
> -  return error;
> +  return (*valp & ~0x1f) != 0;
>  }
>  
>  static int
> @@ -1901,9 +1889,7 @@ Operand_ar12_decode (uint32 *valp ATTRIBUTE_UNUSED)
>  static int
>  Operand_ar12_encode (uint32 *valp)
>  {
> -  int error;
> -  error = (*valp & ~0x1f) != 0;
> -  return error;
> +  return (*valp & ~0x1f) != 0;
>  }
>  
>  static int
> @@ -1915,9 +1901,7 @@ Operand_ars_entry_decode (uint32 *valp ATTRIBUTE_UNUSED)
>  static int
>  Operand_ars_entry_encode (uint32 *valp)
>  {
> -  int error;
> -  error = (*valp & ~0x1f) != 0;
> -  return error;
> +  return (*valp & ~0x1f) != 0;
>  }
>  
>  static int
> @@ -2487,9 +2471,7 @@ Operand_mx_decode (uint32 *valp ATTRIBUTE_UNUSED)
>  static int
>  Operand_mx_encode (uint32 *valp)
>  {
> -  int error;
> -  error = (*valp & ~0x3) != 0;
> -  return error;
> +  return (*valp & ~0x3) != 0;
>  }
>  
>  static int
> @@ -2517,9 +2499,7 @@ Operand_mw_decode (uint32 *valp ATTRIBUTE_UNUSED)
>  static int
>  Operand_mw_encode (uint32 *valp)
>  {
> -  int error;
> -  error = (*valp & ~0x3) != 0;
> -  return error;
> +  return (*valp & ~0x3) != 0;
>  }
>  
>  static int
> @@ -2531,9 +2511,7 @@ Operand_mr0_decode (uint32 *valp ATTRIBUTE_UNUSED)
>  static int
>  Operand_mr0_encode (uint32 *valp)
>  {
> -  int error;
> -  error = (*valp & ~0x3) != 0;
> -  return error;
> +  return (*valp & ~0x3) != 0;
>  }
>  
>  static int
> @@ -2545,9 +2523,7 @@ Operand_mr1_decode (uint32 *valp ATTRIBUTE_UNUSED)
>  static int
>  Operand_mr1_encode (uint32 *valp)
>  {
> -  int error;
> -  error = (*valp & ~0x3) != 0;
> -  return error;
> +  return (*valp & ~0x3) != 0;
>  }
>  
>  static int
> @@ -2559,9 +2535,7 @@ Operand_mr2_decode (uint32 *valp ATTRIBUTE_UNUSED)
>  static int
>  Operand_mr2_encode (uint32 *valp)
>  {
> -  int error;
> -  error = (*valp & ~0x3) != 0;
> -  return error;
> +  return (*valp & ~0x3) != 0;
>  }
>  
>  static int
> @@ -2573,9 +2547,7 @@ Operand_mr3_decode (uint32 *valp ATTRIBUTE_UNUSED)
>  static int
>  Operand_mr3_encode (uint32 *valp)
>  {
> -  int error;
> -  error = (*valp & ~0x3) != 0;
> -  return error;
> +  return (*valp & ~0x3) != 0;
>  }
>  
>  static int
> diff --git a/target/xtensa/core-de212/xtensa-modules.c b/target/xtensa/core-de212/xtensa-modules.c
> index ef7674de3a..480c68d3c6 100644
> --- a/target/xtensa/core-de212/xtensa-modules.c
> +++ b/target/xtensa/core-de212/xtensa-modules.c
> @@ -1798,9 +1798,7 @@ OperandSem_opnd_sem_AR_decode (uint32 *valp ATTRIBUTE_UNUSED)
>  static int
>  OperandSem_opnd_sem_AR_encode (uint32 *valp)
>  {
> -  int error;
> -  error = (*valp >= 32);
> -  return error;
> +  return (*valp >= 32);
>  }
>  
>  static int
> @@ -1812,9 +1810,7 @@ OperandSem_opnd_sem_AR_0_decode (uint32 *valp ATTRIBUTE_UNUSED)
>  static int
>  OperandSem_opnd_sem_AR_0_encode (uint32 *valp)
>  {
> -  int error;
> -  error = (*valp >= 32);
> -  return error;
> +  return (*valp >= 32);
>  }
>  
>  static int
> @@ -1826,9 +1822,7 @@ OperandSem_opnd_sem_AR_1_decode (uint32 *valp ATTRIBUTE_UNUSED)
>  static int
>  OperandSem_opnd_sem_AR_1_encode (uint32 *valp)
>  {
> -  int error;
> -  error = (*valp >= 32);
> -  return error;
> +  return (*valp >= 32);
>  }
>  
>  static int
> @@ -1840,9 +1834,7 @@ OperandSem_opnd_sem_AR_2_decode (uint32 *valp ATTRIBUTE_UNUSED)
>  static int
>  OperandSem_opnd_sem_AR_2_encode (uint32 *valp)
>  {
> -  int error;
> -  error = (*valp >= 32);
> -  return error;
> +  return (*valp >= 32);
>  }
>  
>  static int
> @@ -1854,9 +1846,7 @@ OperandSem_opnd_sem_AR_3_decode (uint32 *valp ATTRIBUTE_UNUSED)
>  static int
>  OperandSem_opnd_sem_AR_3_encode (uint32 *valp)
>  {
> -  int error;
> -  error = (*valp >= 32);
> -  return error;
> +  return (*valp >= 32);
>  }
>  
>  static int
> @@ -1868,9 +1858,7 @@ OperandSem_opnd_sem_AR_4_decode (uint32 *valp ATTRIBUTE_UNUSED)
>  static int
>  OperandSem_opnd_sem_AR_4_encode (uint32 *valp)
>  {
> -  int error;
> -  error = (*valp >= 32);
> -  return error;
> +  return (*valp >= 32);
>  }
>  
>  static int
> @@ -2464,9 +2452,7 @@ OperandSem_opnd_sem_MR_decode (uint32 *valp ATTRIBUTE_UNUSED)
>  static int
>  OperandSem_opnd_sem_MR_encode (uint32 *valp)
>  {
> -  int error;
> -  error = (*valp >= 4);
> -  return error;
> +  return (*valp >= 4);
>  }
>  
>  static int
> @@ -2478,9 +2464,7 @@ OperandSem_opnd_sem_MR_1_decode (uint32 *valp ATTRIBUTE_UNUSED)
>  static int
>  OperandSem_opnd_sem_MR_1_encode (uint32 *valp)
>  {
> -  int error;
> -  error = (*valp >= 4);
> -  return error;
> +  return (*valp >= 4);
>  }
>  
>  static int
> @@ -2492,9 +2476,7 @@ OperandSem_opnd_sem_MR_2_decode (uint32 *valp ATTRIBUTE_UNUSED)
>  static int
>  OperandSem_opnd_sem_MR_2_encode (uint32 *valp)
>  {
> -  int error;
> -  error = (*valp >= 4);
> -  return error;
> +  return (*valp >= 4);
>  }
>  
>  static int
> @@ -2506,9 +2488,7 @@ OperandSem_opnd_sem_MR_3_decode (uint32 *valp ATTRIBUTE_UNUSED)
>  static int
>  OperandSem_opnd_sem_MR_3_encode (uint32 *valp)
>  {
> -  int error;
> -  error = (*valp >= 4);
> -  return error;
> +  return (*valp >= 4);
>  }
>  
>  static int
> @@ -2520,9 +2500,7 @@ OperandSem_opnd_sem_MR_4_decode (uint32 *valp ATTRIBUTE_UNUSED)
>  static int
>  OperandSem_opnd_sem_MR_4_encode (uint32 *valp)
>  {
> -  int error;
> -  error = (*valp >= 4);
> -  return error;
> +  return (*valp >= 4);
>  }
>  
>  static int
> @@ -2534,9 +2512,7 @@ OperandSem_opnd_sem_MR_5_decode (uint32 *valp ATTRIBUTE_UNUSED)
>  static int
>  OperandSem_opnd_sem_MR_5_encode (uint32 *valp)
>  {
> -  int error;
> -  error = (*valp >= 4);
> -  return error;
> +  return (*valp >= 4);
>  }
>  
>  static int
> diff --git a/target/xtensa/core-fsf/xtensa-modules.c b/target/xtensa/core-fsf/xtensa-modules.c
> index f7de2dec15..c32683ff77 100644
> --- a/target/xtensa/core-fsf/xtensa-modules.c
> +++ b/target/xtensa/core-fsf/xtensa-modules.c
> @@ -1379,9 +1379,7 @@ Operand_arr_decode (uint32 *valp ATTRIBUTE_UNUSED)
>  static int
>  Operand_arr_encode (uint32 *valp)
>  {
> -  int error;
> -  error = (*valp & ~0xf) != 0;
> -  return error;
> +  return (*valp & ~0xf) != 0;
>  }
>  
>  static int
> @@ -1393,9 +1391,7 @@ Operand_ars_decode (uint32 *valp ATTRIBUTE_UNUSED)
>  static int
>  Operand_ars_encode (uint32 *valp)
>  {
> -  int error;
> -  error = (*valp & ~0xf) != 0;
> -  return error;
> +  return (*valp & ~0xf) != 0;
>  }
>  
>  static int
> @@ -1407,9 +1403,7 @@ Operand_art_decode (uint32 *valp ATTRIBUTE_UNUSED)
>  static int
>  Operand_art_encode (uint32 *valp)
>  {
> -  int error;
> -  error = (*valp & ~0xf) != 0;
> -  return error;
> +  return (*valp & ~0xf) != 0;
>  }
>  
>  static int
> @@ -1421,9 +1415,7 @@ Operand_ar0_decode (uint32 *valp ATTRIBUTE_UNUSED)
>  static int
>  Operand_ar0_encode (uint32 *valp)
>  {
> -  int error;
> -  error = (*valp & ~0x3f) != 0;
> -  return error;
> +  return (*valp & ~0x3f) != 0;
>  }
>  
>  static int
> @@ -1435,9 +1427,7 @@ Operand_ar4_decode (uint32 *valp ATTRIBUTE_UNUSED)
>  static int
>  Operand_ar4_encode (uint32 *valp)
>  {
> -  int error;
> -  error = (*valp & ~0x3f) != 0;
> -  return error;
> +  return (*valp & ~0x3f) != 0;
>  }
>  
>  static int
> @@ -1449,9 +1439,7 @@ Operand_ar8_decode (uint32 *valp ATTRIBUTE_UNUSED)
>  static int
>  Operand_ar8_encode (uint32 *valp)
>  {
> -  int error;
> -  error = (*valp & ~0x3f) != 0;
> -  return error;
> +  return (*valp & ~0x3f) != 0;
>  }
>  
>  static int
> @@ -1463,9 +1451,7 @@ Operand_ar12_decode (uint32 *valp ATTRIBUTE_UNUSED)
>  static int
>  Operand_ar12_encode (uint32 *valp)
>  {
> -  int error;
> -  error = (*valp & ~0x3f) != 0;
> -  return error;
> +  return (*valp & ~0x3f) != 0;
>  }
>  
>  static int
> @@ -1477,9 +1463,7 @@ Operand_ars_entry_decode (uint32 *valp ATTRIBUTE_UNUSED)
>  static int
>  Operand_ars_entry_encode (uint32 *valp)
>  {
> -  int error;
> -  error = (*valp & ~0x3f) != 0;
> -  return error;
> +  return (*valp & ~0x3f) != 0;
>  }
>  
>  static int
> diff --git a/target/xtensa/core-sample_controller/xtensa-modules.c b/target/xtensa/core-sample_controller/xtensa-modules.c
> index fba41b99ae..7e87d216bd 100644
> --- a/target/xtensa/core-sample_controller/xtensa-modules.c
> +++ b/target/xtensa/core-sample_controller/xtensa-modules.c
> @@ -1570,9 +1570,7 @@ OperandSem_opnd_sem_AR_decode (uint32 *valp ATTRIBUTE_UNUSED)
>  static int
>  OperandSem_opnd_sem_AR_encode (uint32 *valp)
>  {
> -  int error;
> -  error = (*valp >= 32);
> -  return error;
> +  return (*valp >= 32);
>  }
>  
>  static int
> @@ -1584,9 +1582,7 @@ OperandSem_opnd_sem_AR_0_decode (uint32 *valp ATTRIBUTE_UNUSED)
>  static int
>  OperandSem_opnd_sem_AR_0_encode (uint32 *valp)
>  {
> -  int error;
> -  error = (*valp >= 32);
> -  return error;
> +  return (*valp >= 32);
>  }
>  
>  static int
> @@ -1598,9 +1594,7 @@ OperandSem_opnd_sem_AR_1_decode (uint32 *valp ATTRIBUTE_UNUSED)
>  static int
>  OperandSem_opnd_sem_AR_1_encode (uint32 *valp)
>  {
> -  int error;
> -  error = (*valp >= 32);
> -  return error;
> +  return (*valp >= 32);
>  }
>  
>  static int
> @@ -1612,9 +1606,7 @@ OperandSem_opnd_sem_AR_2_decode (uint32 *valp ATTRIBUTE_UNUSED)
>  static int
>  OperandSem_opnd_sem_AR_2_encode (uint32 *valp)
>  {
> -  int error;
> -  error = (*valp >= 32);
> -  return error;
> +  return (*valp >= 32);
>  }
>  
>  static int
> @@ -1626,9 +1618,7 @@ OperandSem_opnd_sem_AR_3_decode (uint32 *valp ATTRIBUTE_UNUSED)
>  static int
>  OperandSem_opnd_sem_AR_3_encode (uint32 *valp)
>  {
> -  int error;
> -  error = (*valp >= 32);
> -  return error;
> +  return (*valp >= 32);
>  }
>  
>  static int
> @@ -1640,9 +1630,7 @@ OperandSem_opnd_sem_AR_4_decode (uint32 *valp ATTRIBUTE_UNUSED)
>  static int
>  OperandSem_opnd_sem_AR_4_encode (uint32 *valp)
>  {
> -  int error;
> -  error = (*valp >= 32);
> -  return error;
> +  return (*valp >= 32);
>  }
>  
>  static int
> diff --git a/target/xtensa/translate.c b/target/xtensa/translate.c
> index 4f6d03059f..f88cdbeecd 100644
> --- a/target/xtensa/translate.c
> +++ b/target/xtensa/translate.c
> @@ -1272,11 +1272,8 @@ XtensaOpcodeOps *
>  xtensa_find_opcode_ops(const XtensaOpcodeTranslators *t,
>                         const char *name)
>  {
> -    XtensaOpcodeOps *ops;
> -
> -    ops = bsearch(name, t->opcode, t->num_opcodes,
> +    return bsearch(name, t->opcode, t->num_opcodes,
>                    sizeof(XtensaOpcodeOps), compare_opcode_ops);
> -    return ops;
>  }
>  
>  static void translate_abs(DisasContext *dc, const uint32_t arg[],
> diff --git a/tests/m48t59-test.c b/tests/m48t59-test.c
> index 26af7d6e8e..5b695971c7 100644
> --- a/tests/m48t59-test.c
> +++ b/tests/m48t59-test.c
> @@ -256,8 +256,6 @@ static void base_setup(void)
>  
>  int main(int argc, char **argv)
>  {
> -    int ret;
> -
>      base_setup();
>  
>      g_test_init(&argc, &argv, NULL);
> @@ -267,7 +265,5 @@ int main(int argc, char **argv)
>          qtest_add_func("/rtc/bcd-check-time", bcd_check_time);
>      }
>      qtest_add_func("/rtc/fuzz-registers", fuzz_registers);
> -    ret = g_test_run();
> -
> -    return ret;
> +    return g_test_run();
>  }
> diff --git a/tests/test-thread-pool.c b/tests/test-thread-pool.c
> index 91b4ec5524..9cdccb3a47 100644
> --- a/tests/test-thread-pool.c
> +++ b/tests/test-thread-pool.c
> @@ -224,8 +224,6 @@ static void test_cancel_async(void)
>  
>  int main(int argc, char **argv)
>  {
> -    int ret;
> -
>      qemu_init_main_loop(&error_abort);
>      ctx = qemu_get_current_aio_context();
>      pool = aio_get_thread_pool(ctx);
> @@ -238,7 +236,5 @@ int main(int argc, char **argv)
>      g_test_add_func("/thread-pool/cancel", test_cancel);
>      g_test_add_func("/thread-pool/cancel-async", test_cancel_async);
>  
> -    ret = g_test_run();
> -
> -    return ret;
> +    return g_test_run();
>  }
> diff --git a/util/uri.c b/util/uri.c
> index 93ecefdaaf..8624a7ac23 100644
> --- a/util/uri.c
> +++ b/util/uri.c
> @@ -1065,10 +1065,7 @@ URI *uri_parse_raw(const char *str, int raw)
>   */
>  URI *uri_new(void)
>  {
> -    URI *ret;
> -
> -    ret = g_new0(URI, 1);
> -    return ret;
> +    return g_new0(URI, 1);
>  }
>  
>  /**
> 

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

* Re: [Qemu-devel] [PATCH 4/4] Remove unnecessary variables for function return value
  2018-03-22 16:12 ` [Qemu-devel] [PATCH 4/4] Remove unnecessary variables for function return value Laurent Vivier
                     ` (3 preceding siblings ...)
  2018-03-23  2:14   ` [Qemu-devel] [Qemu-arm] " Philippe Mathieu-Daudé
@ 2018-03-23 10:44   ` Alberto Garcia
  4 siblings, 0 replies; 31+ messages in thread
From: Alberto Garcia @ 2018-03-23 10:44 UTC (permalink / raw)
  To: Laurent Vivier, qemu-devel
  Cc: Peter Crosthwaite, Daniel P. Berrangé,
	Dr. David Alan Gilbert, Paolo Bonzini, David Gibson, Kevin Wolf,
	Richard Henderson, qemu-arm, Eric Blake, Jason Wang, Max Reitz,
	Fam Zheng, qemu-trivial, Alexander Graf, qemu-ppc, Peter Maydell,
	qemu-block, Igor Mitsyanko, Yongbok Kim, Michael S. Tsirkin,
	Aurelien Jarno, Eduardo Habkost, Max Filippov, Markus Armbruster

On Thu 22 Mar 2018 05:12:26 PM CET, Laurent Vivier wrote:

> diff --git a/block/quorum.c b/block/quorum.c
> index 14333c18aa..304442ef65 100644
> --- a/block/quorum.c
> +++ b/block/quorum.c
> @@ -608,7 +608,7 @@ static void read_quorum_children_entry(void *opaque)
>  static int read_quorum_children(QuorumAIOCB *acb)
>  {
>      BDRVQuorumState *s = acb->bs->opaque;
> -    int i, ret;
> +    int i;
>  
>      acb->children_read = s->num_children;
>      for (i = 0; i < s->num_children; i++) {
> @@ -643,9 +643,7 @@ static int read_quorum_children(QuorumAIOCB *acb)
>          qemu_coroutine_yield();
>      }
>  
> -    ret = acb->vote_ret;
> -
> -    return ret;
> +    return acb->vote_ret;
>  }

The Quorum part,

Reviewed-by: Alberto Garcia <berto@igalia.com>

Berto

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

* Re: [Qemu-devel] [PATCH 0/4] coccinelle: re-run scripts from scripts/coccinelle
  2018-03-22 16:12 [Qemu-devel] [PATCH 0/4] coccinelle: re-run scripts from scripts/coccinelle Laurent Vivier
                   ` (6 preceding siblings ...)
  2018-03-22 17:57 ` no-reply
@ 2018-03-23 12:37 ` Michael Tokarev
  2018-03-23 12:40   ` Laurent Vivier
  2018-03-23 17:42   ` Eric Blake
  7 siblings, 2 replies; 31+ messages in thread
From: Michael Tokarev @ 2018-03-23 12:37 UTC (permalink / raw)
  To: Laurent Vivier, qemu-devel
  Cc: Peter Maydell, Michael S. Tsirkin, Jason Wang, Markus Armbruster,
	Max Filippov, Yongbok Kim, Alberto Garcia, qemu-block,
	qemu-trivial, Eric Blake, Alexander Graf, David Gibson,
	Fam Zheng, Eduardo Habkost, Dr. David Alan Gilbert, qemu-arm,
	Richard Henderson, Kevin Wolf, Daniel P. Berrangé,
	Peter Crosthwaite, Igor Mitsyanko, Max Reitz, qemu-ppc,
	Paolo Bonzini

22.03.2018 19:12, Laurent Vivier wrote:
> I've re-run some scripts from the coccinelle directory,
> and they have found some problems.
> 
> This series fixes them.
> 
> Laurent Vivier (4):
>   error: Strip trailing '\n' from error string arguments (again again)
>   error: Remove NULL checks on error_propagate() calls
>   qdict: remove useless cast
>   Remove unnecessary variables for function return value

I've applied patches 1-3, but the 4th patch is a bit.. interesting.
As has already been said, it touches auto-generated files, which is
sort of fine, but it _also_ removes comments, which - I think - is
quite a bit wrong.

I can apply just selected hunks, but.. hmm..

/mjt

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

* Re: [Qemu-devel] [PATCH 0/4] coccinelle: re-run scripts from scripts/coccinelle
  2018-03-23 12:37 ` Michael Tokarev
@ 2018-03-23 12:40   ` Laurent Vivier
  2018-03-23 17:42   ` Eric Blake
  1 sibling, 0 replies; 31+ messages in thread
From: Laurent Vivier @ 2018-03-23 12:40 UTC (permalink / raw)
  To: Michael Tokarev, qemu-devel
  Cc: Peter Maydell, Michael S. Tsirkin, Jason Wang, Markus Armbruster,
	Max Filippov, Yongbok Kim, Alberto Garcia, qemu-block,
	qemu-trivial, Eric Blake, Alexander Graf, David Gibson,
	Fam Zheng, Eduardo Habkost, Dr. David Alan Gilbert, qemu-arm,
	Richard Henderson, Kevin Wolf, Daniel P. Berrangé,
	Peter Crosthwaite, Igor Mitsyanko, Max Reitz, qemu-ppc,
	Paolo Bonzini

On 23/03/2018 13:37, Michael Tokarev wrote:
> 22.03.2018 19:12, Laurent Vivier wrote:
>> I've re-run some scripts from the coccinelle directory,
>> and they have found some problems.
>>
>> This series fixes them.
>>
>> Laurent Vivier (4):
>>   error: Strip trailing '\n' from error string arguments (again again)
>>   error: Remove NULL checks on error_propagate() calls
>>   qdict: remove useless cast
>>   Remove unnecessary variables for function return value
> 
> I've applied patches 1-3, but the 4th patch is a bit.. interesting.
> As has already been said, it touches auto-generated files, which is
> sort of fine, but it _also_ removes comments, which - I think - is
> quite a bit wrong.
> 
> I can apply just selected hunks, but.. hmm..

Thank you, I'm going to rework this one.

Thanks,
Laurent

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

* Re: [Qemu-devel] [PATCH 0/4] coccinelle: re-run scripts from scripts/coccinelle
  2018-03-23 12:37 ` Michael Tokarev
  2018-03-23 12:40   ` Laurent Vivier
@ 2018-03-23 17:42   ` Eric Blake
  1 sibling, 0 replies; 31+ messages in thread
From: Eric Blake @ 2018-03-23 17:42 UTC (permalink / raw)
  To: Michael Tokarev, Laurent Vivier, qemu-devel
  Cc: Peter Maydell, Michael S. Tsirkin, Jason Wang, Markus Armbruster,
	Max Filippov, Yongbok Kim, Alberto Garcia, qemu-block,
	qemu-trivial, Alexander Graf, David Gibson, Fam Zheng,
	Eduardo Habkost, Dr. David Alan Gilbert, qemu-arm,
	Richard Henderson, Kevin Wolf, Daniel P. Berrangé,
	Peter Crosthwaite, Igor Mitsyanko, Max Reitz, qemu-ppc,
	Paolo Bonzini

On 03/23/2018 07:37 AM, Michael Tokarev wrote:
> 22.03.2018 19:12, Laurent Vivier wrote:
>> I've re-run some scripts from the coccinelle directory,
>> and they have found some problems.
>>
>> This series fixes them.
>>
>> Laurent Vivier (4):
>>    error: Strip trailing '\n' from error string arguments (again again)
>>    error: Remove NULL checks on error_propagate() calls
>>    qdict: remove useless cast
>>    Remove unnecessary variables for function return value
> 
> I've applied patches 1-3, but the 4th patch is a bit.. interesting.
> As has already been said, it touches auto-generated files, which is
> sort of fine, but it _also_ removes comments, which - I think - is
> quite a bit wrong.

1-3 are also candidates for going through my qapi tree (I will probably 
do another pull request Monday or Tuesday), if that beats your trivial 
tree.  But if not, for 1-3, you can add:
Acked-by: Eric Blake <eblake@redhat.com>

> 
> I can apply just selected hunks, but.. hmm..

v2 of patch 4 is better, and the trivial tree may indeed be a better 
place for patch 4 since it doesn't really touch anything qapi-related.

-- 
Eric Blake, Principal Software Engineer
Red Hat, Inc.           +1-919-301-3266
Virtualization:  qemu.org | libvirt.org

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

* Re: [Qemu-devel] [PATCH 2/4] error: Remove NULL checks on error_propagate() calls
  2018-03-22 16:12 ` [Qemu-devel] [PATCH 2/4] error: Remove NULL checks on error_propagate() calls Laurent Vivier
@ 2018-03-23 20:50   ` Eric Blake
  2018-03-26  8:40     ` Laurent Vivier
  0 siblings, 1 reply; 31+ messages in thread
From: Eric Blake @ 2018-03-23 20:50 UTC (permalink / raw)
  To: Laurent Vivier, qemu-devel
  Cc: Peter Crosthwaite, Daniel P. Berrangé,
	Dr. David Alan Gilbert, Paolo Bonzini, David Gibson, Kevin Wolf,
	Richard Henderson, qemu-arm, Jason Wang, Max Reitz, Fam Zheng,
	qemu-trivial, Alexander Graf, qemu-ppc, Peter Maydell,
	Alberto Garcia, qemu-block, Igor Mitsyanko, Yongbok Kim,
	Michael S. Tsirkin, Aurelien Jarno, Eduardo Habkost,
	Max Filippov, Markus Armbruster

On 03/22/2018 11:12 AM, Laurent Vivier wrote:
> Re-run Coccinelle patch
> scripts/coccinelle/error_propagate_null.cocci
> 
> Signed-off-by: Laurent Vivier <lvivier@redhat.com>
> ---
>   io/channel-websock.c | 4 +---
>   1 file changed, 1 insertion(+), 3 deletions(-)
> 

Misses an offender in numa.c, why?

https://lists.gnu.org/archive/html/qemu-devel/2018-03/msg06382.html

-- 
Eric Blake, Principal Software Engineer
Red Hat, Inc.           +1-919-301-3266
Virtualization:  qemu.org | libvirt.org

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

* Re: [Qemu-devel] [PATCH 2/4] error: Remove NULL checks on error_propagate() calls
  2018-03-23 20:50   ` Eric Blake
@ 2018-03-26  8:40     ` Laurent Vivier
  0 siblings, 0 replies; 31+ messages in thread
From: Laurent Vivier @ 2018-03-26  8:40 UTC (permalink / raw)
  To: Eric Blake, qemu-devel
  Cc: Peter Crosthwaite, Daniel P. Berrangé,
	Dr. David Alan Gilbert, Paolo Bonzini, David Gibson, Kevin Wolf,
	Richard Henderson, qemu-arm, Jason Wang, Max Reitz, Fam Zheng,
	qemu-trivial, Alexander Graf, qemu-ppc, Peter Maydell,
	Alberto Garcia, qemu-block, Igor Mitsyanko, Yongbok Kim,
	Michael S. Tsirkin, Aurelien Jarno, Eduardo Habkost,
	Max Filippov, Markus Armbruster

On 23/03/2018 21:50, Eric Blake wrote:
> On 03/22/2018 11:12 AM, Laurent Vivier wrote:
>> Re-run Coccinelle patch
>> scripts/coccinelle/error_propagate_null.cocci
>>
>> Signed-off-by: Laurent Vivier <lvivier@redhat.com>
>> ---
>>   io/channel-websock.c | 4 +---
>>   1 file changed, 1 insertion(+), 3 deletions(-)
>>
> 
> Misses an offender in numa.c, why?
> 
> https://lists.gnu.org/archive/html/qemu-devel/2018-03/msg06382.html
> 

No, error_report_err() doesn't check if  err is NULL, we must check
before calling it.

Thanks,
Laurent

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

* Re: [Qemu-devel] [PATCH 3/4] qdict: remove useless cast
  2018-03-22 16:12 ` [Qemu-devel] [PATCH 3/4] qdict: remove useless cast Laurent Vivier
  2018-03-22 16:23   ` Dr. David Alan Gilbert
@ 2018-03-27  3:01   ` Fam Zheng
  1 sibling, 0 replies; 31+ messages in thread
From: Fam Zheng @ 2018-03-27  3:01 UTC (permalink / raw)
  To: Laurent Vivier
  Cc: qemu-devel, Peter Crosthwaite, Daniel P. Berrangé,
	Dr. David Alan Gilbert, Paolo Bonzini, David Gibson, Kevin Wolf,
	Richard Henderson, qemu-arm, Eric Blake, Jason Wang, Max Reitz,
	qemu-trivial, Alexander Graf, qemu-ppc, Peter Maydell,
	Alberto Garcia, qemu-block, Igor Mitsyanko, Yongbok Kim,
	Michael S. Tsirkin, Aurelien Jarno, Eduardo Habkost,
	Max Filippov, Markus Armbruster

On Thu, 03/22 17:12, Laurent Vivier wrote:
> Re-run Coccinelle script scripts/coccinelle/qobject.cocci
> 
> Signed-off-by: Laurent Vivier <lvivier@redhat.com>

Acked-by: Fam Zheng <famz@redhat.com>

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

end of thread, other threads:[~2018-03-27  3:02 UTC | newest]

Thread overview: 31+ messages (download: mbox.gz / follow: Atom feed)
-- links below jump to the message on this page --
2018-03-22 16:12 [Qemu-devel] [PATCH 0/4] coccinelle: re-run scripts from scripts/coccinelle Laurent Vivier
2018-03-22 16:12 ` [Qemu-devel] [PATCH 1/4] error: Strip trailing '\n' from error string arguments (again again) Laurent Vivier
2018-03-22 16:12 ` [Qemu-devel] [PATCH 2/4] error: Remove NULL checks on error_propagate() calls Laurent Vivier
2018-03-23 20:50   ` Eric Blake
2018-03-26  8:40     ` Laurent Vivier
2018-03-22 16:12 ` [Qemu-devel] [PATCH 3/4] qdict: remove useless cast Laurent Vivier
2018-03-22 16:23   ` Dr. David Alan Gilbert
2018-03-27  3:01   ` Fam Zheng
2018-03-22 16:12 ` [Qemu-devel] [PATCH 4/4] Remove unnecessary variables for function return value Laurent Vivier
2018-03-22 16:45   ` Eric Blake
2018-03-22 16:51   ` Max Filippov
2018-03-22 16:58     ` Laurent Vivier
2018-03-22 17:19       ` Max Filippov
2018-03-22 17:23         ` Peter Maydell
2018-03-22 17:26           ` Max Filippov
2018-03-22 17:30         ` Eric Blake
2018-03-22 17:40           ` Peter Maydell
2018-03-22 16:59     ` Eric Blake
2018-03-22 17:06       ` Max Filippov
2018-03-22 23:06   ` David Gibson
2018-03-23  2:14   ` [Qemu-devel] [Qemu-arm] " Philippe Mathieu-Daudé
2018-03-23 10:44   ` [Qemu-devel] " Alberto Garcia
2018-03-22 16:27 ` [Qemu-devel] [PATCH 0/4] coccinelle: re-run scripts from scripts/coccinelle Eric Blake
2018-03-22 16:45 ` Eric Blake
2018-03-22 17:57 ` no-reply
2018-03-22 18:00   ` Peter Maydell
2018-03-22 19:12     ` Eric Blake
2018-03-22 19:17       ` Peter Maydell
2018-03-23 12:37 ` Michael Tokarev
2018-03-23 12:40   ` Laurent Vivier
2018-03-23 17:42   ` Eric Blake

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.