All of lore.kernel.org
 help / color / mirror / Atom feed
From: Laurent Vivier <laurent@vivier.eu>
To: qemu-devel@nongnu.org
Cc: qemu-trivial@nongnu.org,
	Simran Singhal <singhalsimran0@gmail.com>,
	Michael Tokarev <mjt@tls.msk.ru>,
	Laurent Vivier <laurent@vivier.eu>,
	Stefan Hajnoczi <stefanha@redhat.com>
Subject: [PULL 11/20] Compress lines for immediate return
Date: Mon,  4 May 2020 13:57:49 +0200	[thread overview]
Message-ID: <20200504115758.283914-12-laurent@vivier.eu> (raw)
In-Reply-To: <20200504115758.283914-1-laurent@vivier.eu>

From: Simran Singhal <singhalsimran0@gmail.com>

Compress two lines into a single line if immediate return statement is found.

It also remove variables progress, val, data, ret and sock
as they are no longer needed.

Remove space between function "mixer_load" and '(' to fix the
checkpatch.pl error:-
ERROR: space prohibited between function name and open parenthesis '('

Done using following coccinelle script:
@@
local idexpression ret;
expression e;
@@

-ret =
+return
     e;
-return ret;

Signed-off-by: Simran Singhal <singhalsimran0@gmail.com>
Reviewed-by: Stefan Hajnoczi <stefanha@redhat.com>
Message-Id: <20200401165314.GA3213@simran-Inspiron-5558>
Signed-off-by: Laurent Vivier <laurent@vivier.eu>
---
 block/file-posix.c      | 3 +--
 block/nfs.c             | 3 +--
 block/nvme.c            | 4 +---
 block/vhdx.c            | 3 +--
 hw/audio/ac97.c         | 4 +---
 hw/audio/adlib.c        | 5 +----
 hw/display/cirrus_vga.c | 4 +---
 migration/ram.c         | 4 +---
 ui/gtk.c                | 3 +--
 util/qemu-sockets.c     | 5 +----
 10 files changed, 10 insertions(+), 28 deletions(-)

diff --git a/block/file-posix.c b/block/file-posix.c
index bf09ad8bc0d0..8fd8c27305cc 100644
--- a/block/file-posix.c
+++ b/block/file-posix.c
@@ -1631,8 +1631,7 @@ static int handle_aiocb_write_zeroes_unmap(void *opaque)
 
     /* If we couldn't manage to unmap while guaranteed that the area reads as
      * all-zero afterwards, just write zeroes without unmapping */
-    ret = handle_aiocb_write_zeroes(aiocb);
-    return ret;
+    return handle_aiocb_write_zeroes(aiocb);
 }
 
 #ifndef HAVE_COPY_FILE_RANGE
diff --git a/block/nfs.c b/block/nfs.c
index 2393fbfe6bcc..18c0a7369454 100644
--- a/block/nfs.c
+++ b/block/nfs.c
@@ -623,8 +623,7 @@ static int nfs_file_open(BlockDriverState *bs, QDict *options, int flags,
     }
 
     bs->total_sectors = ret;
-    ret = 0;
-    return ret;
+    return 0;
 }
 
 static QemuOptsList nfs_create_opts = {
diff --git a/block/nvme.c b/block/nvme.c
index 7b7c0cc5d673..eb2f54dd9dc9 100644
--- a/block/nvme.c
+++ b/block/nvme.c
@@ -575,11 +575,9 @@ static bool nvme_poll_cb(void *opaque)
 {
     EventNotifier *e = opaque;
     BDRVNVMeState *s = container_of(e, BDRVNVMeState, irq_notifier);
-    bool progress = false;
 
     trace_nvme_poll_cb(s);
-    progress = nvme_poll_queues(s);
-    return progress;
+    return nvme_poll_queues(s);
 }
 
 static int nvme_init(BlockDriverState *bs, const char *device, int namespace,
diff --git a/block/vhdx.c b/block/vhdx.c
index 45be0a43218c..aedd78260455 100644
--- a/block/vhdx.c
+++ b/block/vhdx.c
@@ -411,8 +411,7 @@ int vhdx_update_headers(BlockDriverState *bs, BDRVVHDXState *s,
     if (ret < 0) {
         return ret;
     }
-    ret = vhdx_update_header(bs, s, generate_data_write_guid, log_guid);
-    return ret;
+    return vhdx_update_header(bs, s, generate_data_write_guid, log_guid);
 }
 
 /* opens the specified header block from the VHDX file header section */
diff --git a/hw/audio/ac97.c b/hw/audio/ac97.c
index 1ec87feec0cb..8a9b9924c495 100644
--- a/hw/audio/ac97.c
+++ b/hw/audio/ac97.c
@@ -573,11 +573,9 @@ static uint32_t nam_readb (void *opaque, uint32_t addr)
 static uint32_t nam_readw (void *opaque, uint32_t addr)
 {
     AC97LinkState *s = opaque;
-    uint32_t val = ~0U;
     uint32_t index = addr;
     s->cas = 0;
-    val = mixer_load (s, index);
-    return val;
+    return mixer_load(s, index);
 }
 
 static uint32_t nam_readl (void *opaque, uint32_t addr)
diff --git a/hw/audio/adlib.c b/hw/audio/adlib.c
index d6c1fb0586c6..7c3b67dcfb8c 100644
--- a/hw/audio/adlib.c
+++ b/hw/audio/adlib.c
@@ -120,13 +120,10 @@ static void adlib_write(void *opaque, uint32_t nport, uint32_t val)
 static uint32_t adlib_read(void *opaque, uint32_t nport)
 {
     AdlibState *s = opaque;
-    uint8_t data;
     int a = nport & 3;
 
     adlib_kill_timers (s);
-    data = OPLRead (s->opl, a);
-
-    return data;
+    return OPLRead (s->opl, a);
 }
 
 static void timer_handler (void *opaque, int c, double interval_Sec)
diff --git a/hw/display/cirrus_vga.c b/hw/display/cirrus_vga.c
index 0d391e1300aa..1f29731ffe11 100644
--- a/hw/display/cirrus_vga.c
+++ b/hw/display/cirrus_vga.c
@@ -2411,12 +2411,10 @@ static uint64_t cirrus_linear_bitblt_read(void *opaque,
                                           unsigned size)
 {
     CirrusVGAState *s = opaque;
-    uint32_t ret;
 
     /* XXX handle bitblt */
     (void)s;
-    ret = 0xff;
-    return ret;
+    return 0xff;
 }
 
 static void cirrus_linear_bitblt_write(void *opaque,
diff --git a/migration/ram.c b/migration/ram.c
index 04f13feb2e77..06cba8863280 100644
--- a/migration/ram.c
+++ b/migration/ram.c
@@ -2135,9 +2135,7 @@ int ram_postcopy_send_discard_bitmap(MigrationState *ms)
     }
     trace_ram_postcopy_send_discard_bitmap();
 
-    ret = postcopy_each_ram_send_discard(ms);
-
-    return ret;
+    return postcopy_each_ram_send_discard(ms);
 }
 
 /**
diff --git a/ui/gtk.c b/ui/gtk.c
index 030b251c6109..83f2f5d49b2a 100644
--- a/ui/gtk.c
+++ b/ui/gtk.c
@@ -1650,8 +1650,7 @@ static GSList *gd_vc_menu_init(GtkDisplayState *s, VirtualConsole *vc,
                      G_CALLBACK(gd_menu_switch_vc), s);
     gtk_menu_shell_append(GTK_MENU_SHELL(view_menu), vc->menu_item);
 
-    group = gtk_radio_menu_item_get_group(GTK_RADIO_MENU_ITEM(vc->menu_item));
-    return group;
+    return gtk_radio_menu_item_get_group(GTK_RADIO_MENU_ITEM(vc->menu_item));
 }
 
 #if defined(CONFIG_VTE)
diff --git a/util/qemu-sockets.c b/util/qemu-sockets.c
index bcc06d0e01c7..86c48b9fa5de 100644
--- a/util/qemu-sockets.c
+++ b/util/qemu-sockets.c
@@ -765,15 +765,12 @@ static int vsock_connect_addr(const struct sockaddr_vm *svm, Error **errp)
 static int vsock_connect_saddr(VsockSocketAddress *vaddr, Error **errp)
 {
     struct sockaddr_vm svm;
-    int sock = -1;
 
     if (!vsock_parse_vaddr_to_sockaddr(vaddr, &svm, errp)) {
         return -1;
     }
 
-    sock = vsock_connect_addr(&svm, errp);
-
-    return sock;
+    return vsock_connect_addr(&svm, errp);
 }
 
 static int vsock_listen_saddr(VsockSocketAddress *vaddr,
-- 
2.26.2



  parent reply	other threads:[~2020-05-04 12:12 UTC|newest]

Thread overview: 28+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2020-05-04 11:57 [PULL 00/20] Trivial branch for 5.1 patches Laurent Vivier
2020-05-04 11:57 ` [PULL 01/20] scsi/esp-pci: add g_assert() for fix clang analyzer warning in esp_pci_io_write() Laurent Vivier
2020-05-04 11:57 ` [PULL 02/20] display/blizzard: use extract16() for fix clang analyzer warning in blizzard_draw_line16_32() Laurent Vivier
2020-05-04 11:57 ` [PULL 03/20] timer/exynos4210_mct: Remove redundant statement in exynos4210_mct_write() Laurent Vivier
2020-05-04 11:57 ` [PULL 04/20] crypto: Redundant type conversion for AES_KEY pointer Laurent Vivier
2020-05-04 12:58   ` Daniel P. Berrangé
2020-05-05  7:20     ` Chenqun (kuhn)
2020-05-04 11:57 ` [PULL 05/20] MAINTAINERS: Mark the LatticeMico32 target as orphan Laurent Vivier
2020-05-04 11:57 ` [PULL 06/20] hw/mem/pc-dimm: Print slot number on error at pc_dimm_pre_plug() Laurent Vivier
2020-05-04 11:57 ` [PULL 07/20] hw/mem/pc-dimm: Fix line over 80 characters warning Laurent Vivier
2020-05-04 11:57 ` [PULL 08/20] elf_ops: Don't try to g_mapped_file_unref(NULL) Laurent Vivier
2020-05-04 11:57 ` [PULL 09/20] MAINTAINERS: Update Keith Busch's email address Laurent Vivier
2020-05-04 11:57 ` [PULL 10/20] chardev: Add macOS to list of OSes that support -chardev serial Laurent Vivier
2020-05-04 11:57 ` Laurent Vivier [this message]
2020-05-04 11:57 ` [PULL 12/20] block: Avoid dead assignment Laurent Vivier
2020-05-04 11:57 ` [PULL 13/20] blockdev: Remove " Laurent Vivier
2020-05-04 11:57 ` [PULL 14/20] hw/i2c/pm_smbus: " Laurent Vivier
2020-05-04 11:57 ` [PULL 15/20] hw/input/adb-kbd: " Laurent Vivier
2020-05-04 11:57 ` [PULL 16/20] hw/ide/sii3112: " Laurent Vivier
2020-05-04 11:57 ` [PULL 17/20] hw/isa/i82378: " Laurent Vivier
2020-05-04 11:57 ` [PULL 18/20] hw/gpio/aspeed_gpio: " Laurent Vivier
2020-05-04 11:57 ` [PULL 19/20] hw/timer/stm32f2xx_timer: " Laurent Vivier
2020-05-04 11:57 ` [PULL 20/20] hw/timer/pxa2xx_timer: Add assertion to silent static analyzer warning Laurent Vivier
2020-05-04 12:17 ` [PULL 00/20] Trivial branch for 5.1 patches Peter Maydell
2020-05-04 12:32   ` Laurent Vivier
2020-05-04 12:34   ` Daniel P. Berrangé
2020-05-04 12:34   ` Peter Maydell
2020-05-04 12:40     ` Laurent Vivier

Reply instructions:

You may reply publicly to this message via plain-text email
using any one of the following methods:

* Save the following mbox file, import it into your mail client,
  and reply-to-all from there: mbox

  Avoid top-posting and favor interleaved quoting:
  https://en.wikipedia.org/wiki/Posting_style#Interleaved_style

* Reply using the --to, --cc, and --in-reply-to
  switches of git-send-email(1):

  git send-email \
    --in-reply-to=20200504115758.283914-12-laurent@vivier.eu \
    --to=laurent@vivier.eu \
    --cc=mjt@tls.msk.ru \
    --cc=qemu-devel@nongnu.org \
    --cc=qemu-trivial@nongnu.org \
    --cc=singhalsimran0@gmail.com \
    --cc=stefanha@redhat.com \
    /path/to/YOUR_REPLY

  https://kernel.org/pub/software/scm/git/docs/git-send-email.html

* If your mail client supports setting the In-Reply-To header
  via mailto: links, try the mailto: link
Be sure your reply has a Subject: header at the top and a blank line before the message body.
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.