Tweak the semantic patch to drop redundant parenthesis around the
return expression.
Coccinelle drops a comment in hw/rdma/vmw/pvrdma_cmd.c; restored
manually.
Coccinelle messes up vmdk_co_create(), not sure why. Change dropped,
will be done manually in the next commit.
Line breaks in target/avr/cpu.h and hw/rdma/vmw/pvrdma_cmd.c tidied up
manually.
Whitespace in tools/virtiofsd/fuse_lowlevel.c tidied up manually.
checkpatch.pl complains "return of an errno should typically be -ve"
two times for hw/9pfs/9p-synth.c. Preexisting, the patch merely makes
it visible to checkpatch.pl.
Signed-off-by: Markus Armbruster <armbru@redhat.com>
---
scripts/coccinelle/return_directly.cocci | 5 +--
include/hw/pci/pci.h | 7 +--
target/avr/cpu.h | 4 +-
hw/9pfs/9p-synth.c | 14 ++----
hw/char/sifive_uart.c | 4 +-
hw/ppc/ppc4xx_sdram.c | 5 +--
hw/rdma/vmw/pvrdma_cmd.c | 57 +++++++++---------------
hw/virtio/vhost-user.c | 6 +--
migration/dirtyrate.c | 10 +----
migration/tls.c | 6 +--
replay/replay-time.c | 5 +--
semihosting/console.c | 4 +-
softmmu/memory.c | 11 +----
softmmu/physmem.c | 9 +---
target/loongarch/cpu.c | 4 +-
target/mips/tcg/dsp_helper.c | 15 ++-----
target/riscv/debug.c | 6 +--
target/riscv/vector_helper.c | 28 +++---------
tests/bench/benchmark-crypto-akcipher.c | 6 +--
tests/qtest/erst-test.c | 5 +--
tests/qtest/hexloader-test.c | 6 +--
tests/qtest/pvpanic-pci-test.c | 6 +--
tests/qtest/pvpanic-test.c | 6 +--
tests/qtest/test-filter-mirror.c | 6 +--
tests/qtest/virtio-ccw-test.c | 6 +--
tests/tcg/multiarch/sha512.c | 9 +---
tools/virtiofsd/fuse_lowlevel.c | 24 +++-------
27 files changed, 70 insertions(+), 204 deletions(-)
diff --git a/scripts/coccinelle/return_directly.cocci
b/scripts/coccinelle/return_directly.cocci
index 4cf50e75ea..6cb1b3c99a 100644
--- a/scripts/coccinelle/return_directly.cocci
+++ b/scripts/coccinelle/return_directly.cocci
@@ -11,9 +11,8 @@ identifier F;
- T VAR;
... when != VAR
-- VAR =
-+ return
- E;
+- VAR = (E);
- return VAR;
++ return E;
... when != VAR
}
diff --git a/include/hw/pci/pci.h b/include/hw/pci/pci.h
index 6ccaaf5154..06e2d5f889 100644
--- a/include/hw/pci/pci.h
+++ b/include/hw/pci/pci.h
@@ -921,11 +921,8 @@ PCI_DMA_DEFINE_LDST(q_be, q_be, 64);
static inline void *pci_dma_map(PCIDevice *dev, dma_addr_t addr,
dma_addr_t *plen, DMADirection dir)
{
- void *buf;
-
- buf = dma_memory_map(pci_get_address_space(dev), addr, plen, dir,
- MEMTXATTRS_UNSPECIFIED);
- return buf;
+ return dma_memory_map(pci_get_address_space(dev), addr, plen, dir,
+ MEMTXATTRS_UNSPECIFIED);
}
static inline void pci_dma_unmap(PCIDevice *dev, void *buffer, dma_addr_t len,
diff --git a/target/avr/cpu.h b/target/avr/cpu.h
index 96419c0c2b..f19dd72926 100644
--- a/target/avr/cpu.h
+++ b/target/avr/cpu.h
@@ -215,8 +215,7 @@ static inline int cpu_interrupts_enabled(CPUAVRState *env)
static inline uint8_t cpu_get_sreg(CPUAVRState *env)
{
- uint8_t sreg;
- sreg = (env->sregC) << 0
+ return (env->sregC) << 0
| (env->sregZ) << 1
| (env->sregN) << 2
| (env->sregV) << 3
@@ -224,7 +223,6 @@ static inline uint8_t cpu_get_sreg(CPUAVRState *env)
| (env->sregH) << 5
| (env->sregT) << 6
| (env->sregI) << 7;
- return sreg;
}
static inline void cpu_set_sreg(CPUAVRState *env, uint8_t sreg)
diff --git a/hw/9pfs/9p-synth.c b/hw/9pfs/9p-synth.c
index 1c5813e4dd..38d787f494 100644
--- a/hw/9pfs/9p-synth.c
+++ b/hw/9pfs/9p-synth.c
@@ -72,7 +72,6 @@ static V9fsSynthNode *v9fs_add_dir_node(V9fsSynthNode
*parent, int mode,
int qemu_v9fs_synth_mkdir(V9fsSynthNode *parent, int mode,
const char *name, V9fsSynthNode **result)
{
- int ret;
V9fsSynthNode *node, *tmp;
if (!synth_fs) {
@@ -87,8 +86,7 @@ int qemu_v9fs_synth_mkdir(V9fsSynthNode *parent, int mode,
QEMU_LOCK_GUARD(&synth_mutex);
QLIST_FOREACH(tmp, &parent->child, sibling) {
if (!strcmp(tmp->name, name)) {
- ret = EEXIST;
- return ret;
+ return EEXIST;
}
}
/* Add the name */
@@ -98,15 +96,13 @@ int qemu_v9fs_synth_mkdir(V9fsSynthNode *parent, int mode,
v9fs_add_dir_node(node, node->attr->mode, ".",
node->attr, node->attr->inode);
*result = node;
- ret = 0;
- return ret;
+ return 0;
}
int qemu_v9fs_synth_add_file(V9fsSynthNode *parent, int mode,
const char *name, v9fs_synth_read read,
v9fs_synth_write write, void *arg)
{
- int ret;
V9fsSynthNode *node, *tmp;
if (!synth_fs) {
@@ -122,8 +118,7 @@ int qemu_v9fs_synth_add_file(V9fsSynthNode *parent, int
mode,
QEMU_LOCK_GUARD(&synth_mutex);
QLIST_FOREACH(tmp, &parent->child, sibling) {
if (!strcmp(tmp->name, name)) {
- ret = EEXIST;
- return ret;
+ return EEXIST;
}
}
/* Add file type and remove write bits */
@@ -138,8 +133,7 @@ int qemu_v9fs_synth_add_file(V9fsSynthNode *parent, int
mode,
node->private = arg;
pstrcpy(node->name, sizeof(node->name), name);
QLIST_INSERT_HEAD_RCU(&parent->child, node, sibling);
- ret = 0;
- return ret;
+ return 0;
}
static void synth_fill_statbuf(V9fsSynthNode *node, struct stat *stbuf)
diff --git a/hw/char/sifive_uart.c b/hw/char/sifive_uart.c
index 1c75f792b3..f2684e57bc 100644
--- a/hw/char/sifive_uart.c
+++ b/hw/char/sifive_uart.c
@@ -274,7 +274,6 @@ SiFiveUARTState *sifive_uart_create(MemoryRegion
*address_space, hwaddr base,
{
DeviceState *dev;
SysBusDevice *s;
- SiFiveUARTState *r;
dev = qdev_new("riscv.sifive.uart");
s = SYS_BUS_DEVICE(dev);
@@ -284,6 +283,5 @@ SiFiveUARTState *sifive_uart_create(MemoryRegion
*address_space, hwaddr base,
sysbus_mmio_get_region(s, 0));
sysbus_connect_irq(s, 0, irq);
- r = SIFIVE_UART(dev);
- return r;
+ return SIFIVE_UART(dev);
}
diff --git a/hw/ppc/ppc4xx_sdram.c b/hw/ppc/ppc4xx_sdram.c
index 8d7137faf3..54bf9a2b44 100644
--- a/hw/ppc/ppc4xx_sdram.c
+++ b/hw/ppc/ppc4xx_sdram.c
@@ -520,13 +520,10 @@ static inline hwaddr sdram_ddr2_base(uint32_t bcr)
static hwaddr sdram_ddr2_size(uint32_t bcr)
{
- hwaddr size;
int sh;
sh = 1024 - ((bcr >> 6) & 0x3ff);
- size = 8 * MiB * sh;
-
- return size;
+ return 8 * MiB * sh;
}
static uint32_t sdram_ddr2_dcr_read(void *opaque, int dcrn)