Re: [Virtio-fs] [PATCH v2 1/2] cleanup: Tweak and re-run return_directly.cocci
Greg Kurz writes: > On Thu, 24 Nov 2022 16:15:11 +0100 > Greg Kurz wrote: > >> On Tue, 22 Nov 2022 14:49:16 +0100 >> Markus Armbruster wrote: >> >> > 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. >> > >> >> Hi Markus, >> >> Yeah these positive errno values have been sitting there since the >> beginning. It was dead code until I hijacked the synth backend to >> implement qtest for 9p. I didn't care much about the return value >> of the two culprits at the time since both are passed to assert(!ret) >> right away. For this reason, changing the sign should be easy :-) >> >> I see that checkpatch.pl considers this as an error. I'll post >> a fix. I guess you'll need to rebase on this fix for your patches >> to pass CI. >> > > Or maybe I can fix the issues detected by coccinelle as well and > you can just drop the 9p bits from this patch ? Up to you! >> Anyway, for 9p: >> >> Reviewed-by: Greg Kurz Thanks! ___ Virtio-fs mailing list Virtio-fs@redhat.com https://listman.redhat.com/mailman/listinfo/virtio-fs
Re: [Virtio-fs] [PATCH v2 1/2] cleanup: Tweak and re-run return_directly.cocci
On Tue, 22 Nov 2022 14:49:16 +0100 Markus Armbruster wrote: > 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. > Hi Markus, Yeah these positive errno values have been sitting there since the beginning. It was dead code until I hijacked the synth backend to implement qtest for 9p. I didn't care much about the return value of the two culprits at the time since both are passed to assert(!ret) right away. For this reason, changing the sign should be easy :-) I see that checkpatch.pl considers this as an error. I'll post a fix. I guess you'll need to rebase on this fix for your patches to pass CI. Anyway, for 9p: Reviewed-by: Greg Kurz > Signed-off-by: Markus Armbruster > --- > 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
Re: [Virtio-fs] [PATCH v2 1/2] cleanup: Tweak and re-run return_directly.cocci
On Thu, 24 Nov 2022 16:15:11 +0100 Greg Kurz wrote: > On Tue, 22 Nov 2022 14:49:16 +0100 > Markus Armbruster wrote: > > > 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. > > > > Hi Markus, > > Yeah these positive errno values have been sitting there since the > beginning. It was dead code until I hijacked the synth backend to > implement qtest for 9p. I didn't care much about the return value > of the two culprits at the time since both are passed to assert(!ret) > right away. For this reason, changing the sign should be easy :-) > > I see that checkpatch.pl considers this as an error. I'll post > a fix. I guess you'll need to rebase on this fix for your patches > to pass CI. > Or maybe I can fix the issues detected by coccinelle as well and you can just drop the 9p bits from this patch ? > Anyway, for 9p: > > Reviewed-by: Greg Kurz > > > > Signed-off-by: Markus Armbruster > > --- > > 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 > >
Re: [Virtio-fs] [PATCH v2 1/2] cleanup: Tweak and re-run return_directly.cocci
* Markus Armbruster (arm...@redhat.com) wrote: > 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 For migration and virtiofs: Acked-by: Dr. David Alan Gilbert > --- > 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(_mutex); > QLIST_FOREACH(tmp, >child, sibling) { > if (!strcmp(tmp->name, name)) { > -ret = EEXIST; > -return ret; > +return EEXIST; >
Re: [Virtio-fs] [PATCH v2 1/2] cleanup: Tweak and re-run return_directly.cocci
On 22/11/22 14:49, Markus Armbruster wrote: 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 --- 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 } Reviewed-by: Philippe Mathieu-Daudé ___ Virtio-fs mailing list Virtio-fs@redhat.com https://listman.redhat.com/mailman/listinfo/virtio-fs
[Virtio-fs] [PATCH v2 1/2] cleanup: Tweak and re-run return_directly.cocci
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 --- 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(_mutex); QLIST_FOREACH(tmp, >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,