Miscellaneous patches for 2022-12-14
Subsystems (6)
The following changes since commit ea3a008d2d9ced9c4f93871c823baee237047f93:
Update VERSION for v7.2.0-rc4 (2022-12-06 19:53:34 -0500)
are available in the Git repository at:
https://repo.or.cz/qemu/armbru.git tags/pull-misc-2022-12-14
for you to fetch changes up to 6c5aaee4b61eb8bf60c7c30365432710b4346421:
ppc4xx_sdram: Simplify sdram_ddr_size() to return (2022-12-14 16:19:35 +0100)
----------------------------------------------------------------
Miscellaneous patches for 2022-12-14
----------------------------------------------------------------
Markus Armbruster (14):
Drop more useless casts from void * to pointer
error: Drop some obviously superfluous error_propagate()
error: Drop a few superfluous ERRP_GUARD()
error: Move ERRP_GUARD() to the beginning of the function
monitor: Simplify monitor_fd_param()'s error handling
monitor: Use ERRP_GUARD() in monitor_init()
qemu-config: Make config_parse_qdict() return bool
qemu-config: Use ERRP_GUARD() where obviously appropriate
sockets: Use ERRP_GUARD() where obviously appropriate
qapi: Use returned bool to check for failure (again)
io: Tidy up fat-fingered parameter name
cleanup: Tweak and re-run return_directly.cocci block/vmdk: Simplify vmdk_co_create() to return directly
ppc4xx_sdram: Simplify sdram_ddr_size() to return
scripts/coccinelle/return_directly.cocci | 5 +-- include/hw/pci/pci.h | 7 +--- include/io/channel.h | 2 +- include/qemu/config-file.h | 2 +- target/avr/cpu.h | 4 +- accel/kvm/kvm-all.c | 5 +-- block/blkdebug.c | 4 +- block/copy-before-write.c | 1 - block/vmdk.c | 28 ++++++-------- bsd-user/elfload.c | 2 +- contrib/plugins/cache.c | 8 ++-- contrib/vhost-user-blk/vhost-user-blk.c | 2 +- dump/dump.c | 2 - hw/9pfs/9p-synth.c | 14 ++----- hw/arm/armsse.c | 3 +- hw/arm/virt.c | 14 +++---- hw/char/sifive_uart.c | 4 +- hw/core/machine.c | 3 +- hw/core/qdev-clock.c | 2 +- hw/core/qdev-properties-system.c | 5 +-- hw/core/qdev.c | 2 - hw/hyperv/vmbus.c | 10 ++--- hw/i386/pc.c | 5 +-- hw/net/cadence_gem.c | 2 +- hw/net/virtio-net.c | 2 +- hw/nvme/ctrl.c | 4 +- hw/pci/msi.c | 1 - hw/ppc/ppc4xx_sdram.c | 15 ++------ hw/rdma/vmw/pvrdma_cmd.c | 66 +++++++++++--------------------- hw/rdma/vmw/pvrdma_qp_ops.c | 6 +-- hw/remote/vfio-user-obj.c | 1 - hw/virtio/vhost-user.c | 6 +-- hw/virtio/vhost-vdpa.c | 2 +- hw/virtio/virtio-balloon.c | 20 +++++----- hw/virtio/virtio-iommu.c | 3 +- hw/virtio/virtio-mem.c | 10 +---- iothread.c | 2 +- linux-user/syscall.c | 2 +- migration/dirtyrate.c | 10 +---- migration/tls.c | 6 +-- monitor/misc.c | 14 ++----- monitor/monitor.c | 12 ++---- monitor/qmp-cmds.c | 4 +- net/colo-compare.c | 13 ++----- qga/commands-win32.c | 8 ++-- replay/replay-time.c | 5 +-- semihosting/console.c | 4 +- softmmu/memory.c | 11 +----- softmmu/physmem.c | 9 +---- target/i386/hax/hax-all.c | 2 +- target/i386/kvm/kvm.c | 5 +-- 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/aarch64/system/semiheap.c | 4 +- tests/tcg/multiarch/sha512.c | 9 +---- tools/virtiofsd/fuse_lowlevel.c | 24 +++--------- ui/util.c | 1 - util/qemu-config.c | 46 ++++++++++------------ util/qemu-sockets.c | 26 +++++-------- util/thread-context.c | 10 +---- util/vfio-helpers.c | 2 +- 70 files changed, 188 insertions(+), 407 deletions(-)
Signature · 1 line
2.37.3
[PULL 12/14] 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.
Message-Id: <[email protected]>
--- 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(-)
scripts/coccinelle/return_directly.cocci +2 -3
@@ -11,9 +11,8 @@ identifier F; - T VAR; ... when != VAR -- VAR = -+ return - E; +- VAR = (E); - return VAR; ++ return E; ... when != VAR }
include/hw/pci/pci.h +2 -5
@@ -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,
target/avr/cpu.h +1 -3
@@ -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)
hw/9pfs/9p-synth.c +4 -10
@@ -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)
hw/char/sifive_uart.c +1 -3
@@ -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); }
hw/ppc/ppc4xx_sdram.c +1 -4
@@ -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)
hw/rdma/vmw/pvrdma_cmd.c +20 -37
114 lines not on this page · raw message
hw/virtio/vhost-user.c +1 -5
@@ -2533,11 +2533,7 @@ vhost_user_crypto_close_session(struct vhost_dev *dev, uint64_t session_id)static bool vhost_user_mem_section_filter (struct vhost_dev *dev,MemoryRegionSection *section) { -bool result; - - result =memory_region_get_fd (section->mr) >=0 ; - -return result; +return memory_region_get_fd (section->mr) >=0 ; } static int vhost_user_get_inflight_fd(struct vhost_dev *dev,
migration/dirtyrate.c +2 -8
@@ -111,7 +111,6 @@ static void global_dirty_log_sync(unsigned int flag, bool one_shot)static DirtyPageRecord *vcpu_dirty_stat_alloc (VcpuStat *stat) {CPUState *cpu; -DirtyPageRecord *records;int nvcpu =0 ;CPU_FOREACH (cpu) {
@@ -121,9 +120,7 @@ static DirtyPageRecord *vcpu_dirty_stat_alloc(VcpuStat *stat) stat->nvcpu = nvcpu; stat->rates =g_new0 (DirtyRateVcpu, nvcpu); - records =g_new0 (DirtyPageRecord, nvcpu); - -return records; +return g_new0 (DirtyPageRecord, nvcpu); } static void vcpu_dirty_stat_collect(VcpuStat *stat,
@@ -473,7 +470,6 @@ find_block_matched(RAMBlock *block, int count, struct RamblockDirtyInfo *infos) {int i; -struct RamblockDirtyInfo *matched;for (i =0 ; i < count; i++) {if (!strcmp (infos[i].idstr,qemu_ram_get_idstr (block))) {
@@ -492,9 +488,7 @@ find_block_matched(RAMBlock *block, int count,return NULL ; } - matched = &infos[i]; - -return matched; +return &infos[i]; } static bool compare_page_hash_info(struct RamblockDirtyInfo *info,
migration/tls.c +1 -5
@@ -126,7 +126,6 @@ QIOChannelTLS *migration_tls_client_create(MigrationState *s, Error **errp) {QCryptoTLSCreds *creds; -QIOChannelTLS *tioc; creds =migration_tls_get_creds ( s,QCRYPTO_TLS_CREDS_ENDPOINT_CLIENT , errp);
@@ -138,10 +137,7 @@ QIOChannelTLS *migration_tls_client_create(MigrationState *s, hostname = s->parameters.tls_hostname; } - tioc =qio_channel_tls_new_client ( - ioc, creds, hostname, errp); - -return tioc; +return qio_channel_tls_new_client (ioc, creds, hostname, errp); } void migration_tls_channel_connect(MigrationState *s,
replay/replay-time.c +1 -4
@@ -48,7 +48,6 @@ void replay_read_next_clock(ReplayClockKind kind)/*! Reads next clock event from the input. */ int64_t replay_read_clock (ReplayClockKind kind,int64_t raw_icount) { -int64_t ret;g_assert (replay_file &&replay_mutex_locked ());replay_advance_current_icount (raw_icount);
@@ -56,7 +55,5 @@ int64_t replay_read_clock(ReplayClockKind kind, int64_t raw_icount)if (replay_next_event_is (EVENT_CLOCK + kind)) {replay_read_next_clock (kind); } - ret = replay_state.cached_clock[kind]; - -return ret; +return replay_state.cached_clock[kind]; }
semihosting/console.c +1 -3
@@ -43,10 +43,8 @@ static SemihostingConsole console;static int console_can_read (void *opaque) {SemihostingConsole *c = opaque; -int ret;g_assert (qemu_mutex_iothread_locked ()); - ret = (int )fifo8_num_free (&c->fifo); -return ret; +return (int )fifo8_num_free (&c->fifo); }static void console_wake_up (gpointer data,gpointer user_data)
softmmu/memory.c +2 -9
@@ -2372,20 +2372,15 @@ void memory_region_reset_dirty(MemoryRegion *mr, hwaddr addr,int memory_region_get_fd (MemoryRegion *mr) { -int fd; -RCU_READ_LOCK_GUARD ();while (mr->alias) { mr = mr->alias; } - fd = mr->ram_block->fd; - -return fd; +return mr->ram_block->fd; }void *memory_region_get_ram_ptr (MemoryRegion *mr) { -void *ptr;uint64_t offset =0 ;RCU_READ_LOCK_GUARD ();
@@ -2394,9 +2389,7 @@ void *memory_region_get_ram_ptr(MemoryRegion *mr) mr = mr->alias; }assert (mr->ram_block); - ptr =qemu_map_ram_ptr (mr->ram_block, offset); - -return ptr; +return qemu_map_ram_ptr (mr->ram_block, offset); }MemoryRegion *memory_region_from_host (void *ptr,ram_addr_t *offset)
softmmu/physmem.c +2 -7
@@ -3236,7 +3236,6 @@ void *address_space_map(AddressSpace *as,hwaddr len = *plen;hwaddr l, xlat;MemoryRegion *mr; -void *ptr;FlatView *fv;if (len ==0 ) {
@@ -3275,9 +3274,7 @@ void *address_space_map(AddressSpace *as, *plen =flatview_extend_translation (fv, addr, len, mr, xlat, l, is_write, attrs);fuzz_dma_read_cb (addr, *plen, mr); - ptr =qemu_ram_ptr_length (mr->ram_block, xlat, plen, true); - -return ptr; +return qemu_ram_ptr_length (mr->ram_block, xlat, plen, true); }/* Unmaps a memory region previously mapped by address_space_map().
@@ -3545,15 +3542,13 @@ bool cpu_physical_memory_is_io(hwaddr phys_addr) {MemoryRegion *mr;hwaddr l =1 ; -bool res;RCU_READ_LOCK_GUARD (); mr =address_space_translate (&address_space_memory, phys_addr, &phys_addr, &l, false,MEMTXATTRS_UNSPECIFIED ); - res = !(memory_region_is_ram (mr) ||memory_region_is_romd (mr)); -return res; +return !(memory_region_is_ram (mr) ||memory_region_is_romd (mr)); }int qemu_ram_foreach_block (RAMBlockIterFunc func,void *opaque)
target/loongarch/cpu.c +1 -3
@@ -128,13 +128,11 @@ static inline bool cpu_loongarch_hw_interrupts_pending(CPULoongArchState *env) {uint32_t pending;uint32_t status; -bool r; pending =FIELD_EX64 (env->CSR_ESTAT,CSR_ESTAT ,IS ); status =FIELD_EX64 (env->CSR_ECFG,CSR_ECFG ,LIE ); - r = (pending & status) !=0 ; -return r; +return (pending & status) !=0 ; }static void loongarch_cpu_do_interrupt (CPUState *cs)
target/mips/tcg/dsp_helper.c +3 -12
@@ -3281,15 +3281,12 @@ target_ulong helper_dextr_l(target_ulong ac, target_ulong shift, CPUMIPSState *env) {uint64_t temp[3 ]; -target_ulong ret; shift = shift &0x3F ;mipsdsp_rndrashift_acc (temp, ac, shift, env); - ret = (temp[1 ] <<63 ) | (temp[0 ] >>1 ); - -return ret; +return (temp[1 ] <<63 ) | (temp[0 ] >>1 ); } target_ulong helper_dextr_r_l(target_ulong ac, target_ulong shift,
@@ -3297,7 +3294,6 @@ target_ulong helper_dextr_r_l(target_ulong ac, target_ulong shift, {uint64_t temp[3 ];uint32_t temp128; -target_ulong ret; shift = shift &0x3F ;mipsdsp_rndrashift_acc (temp, ac, shift, env);
@@ -3317,9 +3313,7 @@ target_ulong helper_dextr_r_l(target_ulong ac, target_ulong shift,set_DSPControl_overflow_flag (1 ,23 , env); } - ret = (temp[1 ] <<63 ) | (temp[0 ] >>1 ); - -return ret; +return (temp[1 ] <<63 ) | (temp[0 ] >>1 ); } target_ulong helper_dextr_rs_l(target_ulong ac, target_ulong shift,
@@ -3327,7 +3321,6 @@ target_ulong helper_dextr_rs_l(target_ulong ac, target_ulong shift, {uint64_t temp[3 ];uint32_t temp128; -target_ulong ret; shift = shift &0x3F ;mipsdsp_rndrashift_acc (temp, ac, shift, env);
@@ -3354,9 +3347,7 @@ target_ulong helper_dextr_rs_l(target_ulong ac, target_ulong shift, set_DSPControl_overflow_flag(1, 23, env); } - ret = (temp[1 ] <<63 ) | (temp[0 ] >>1 ); - -return ret; +return (temp[1 ] <<63 ) | (temp[0 ] >>1 ); }#endif
target/riscv/debug.c +2 -4
@@ -243,15 +243,13 @@ static void do_trigger_action(CPURISCVState *env, target_ulong trigger_index)static uint32_t type2_breakpoint_size (CPURISCVState *env,target_ulong ctrl) { -uint32_t size, sizelo, sizehi =0 ; +uint32_t sizelo, sizehi =0 ;if (riscv_cpu_mxl (env) ==MXL_RV64 ) { sizehi =extract32 (ctrl,21 ,2 ); } sizelo =extract32 (ctrl,16 ,2 ); - size = (sizehi <<2 ) | sizelo; - -return size; +return (sizehi <<2 ) | sizelo; }static inline bool type2_breakpoint_enabled (target_ulong ctrl)
target/riscv/vector_helper.c +7 -21
@@ -2791,31 +2791,25 @@ static inline uint16_t vssrl16(CPURISCVState *env, int vxrm, uint16_t a, uint16_t b) {uint8_t round, shift = b &0xf ; -uint16_t res; round =get_round (vxrm, a, shift); - res = (a >> shift) + round; -return res; +return (a >> shift) + round; }static inline uint32_t vssrl32 (CPURISCVState *env,int vxrm,uint32_t a,uint32_t b) {uint8_t round, shift = b &0x1f ; -uint32_t res; round =get_round (vxrm, a, shift); - res = (a >> shift) + round; -return res; +return (a >> shift) + round; }static inline uint64_t vssrl64 (CPURISCVState *env,int vxrm,uint64_t a,uint64_t b) {uint8_t round, shift = b &0x3f ; -uint64_t res; round =get_round (vxrm, a, shift); - res = (a >> shift) + round; -return res; +return (a >> shift) + round; } RVVCALL(OPIVV2_RM, vssrl_vv_b, OP_UUU_B, H1, H1, H1, vssrl8)RVVCALL (OPIVV2_RM , vssrl_vv_h,OP_UUU_H ,H2 ,H2 ,H2 , vssrl16)
@@ -2839,41 +2833,33 @@ static inline int8_t vssra8(CPURISCVState *env, int vxrm, int8_t a, int8_t b) {uint8_t round, shift = b &0x7 ; -int8_t res; round =get_round (vxrm, a, shift); - res = (a >> shift) + round; -return res; +return (a >> shift) + round; }static inline int16_t vssra16 (CPURISCVState *env,int vxrm,int16_t a,int16_t b) {uint8_t round, shift = b &0xf ; -int16_t res; round =get_round (vxrm, a, shift); - res = (a >> shift) + round; -return res; +return (a >> shift) + round; }static inline int32_t vssra32 (CPURISCVState *env,int vxrm,int32_t a,int32_t b) {uint8_t round, shift = b &0x1f ; -int32_t res; round =get_round (vxrm, a, shift); - res = (a >> shift) + round; -return res; +return (a >> shift) + round; }static inline int64_t vssra64 (CPURISCVState *env,int vxrm,int64_t a,int64_t b) {uint8_t round, shift = b &0x3f ; -int64_t res; round =get_round (vxrm, a, shift); - res = (a >> shift) + round; -return res; +return (a >> shift) + round; }RVVCALL (OPIVV2_RM , vssra_vv_b,OP_SSS_B ,H1 ,H1 ,H1 , vssra8)
tests/bench/benchmark-crypto-akcipher.c +2 -4
@@ -24,14 +24,12 @@ static QCryptoAkCipher *create_rsa_akcipher(const uint8_t *priv_key, QCryptoHashAlgorithm hash) {QCryptoAkCipherOptions opt; -QCryptoAkCipher *rsa; opt.alg =QCRYPTO_AKCIPHER_ALG_RSA ; opt.u.rsa.padding_alg = padding; opt.u.rsa.hash_alg = hash; - rsa =qcrypto_akcipher_new (&opt,QCRYPTO_AKCIPHER_KEY_TYPE_PRIVATE , - priv_key, keylen, &error_abort); -return rsa; +return qcrypto_akcipher_new (&opt,QCRYPTO_AKCIPHER_KEY_TYPE_PRIVATE , + priv_key, keylen, &error_abort); } static void test_rsa_speed(const uint8_t *priv_key, size_t keylen,
tests/qtest/erst-test.c +1 -4
@@ -154,10 +154,7 @@ static void test_acpi_erst_basic(void)int main (int argc,char **argv) { -int ret; -g_test_init (&argc, &argv,NULL );qtest_add_func ("/acpi-erst/basic" , test_acpi_erst_basic); - ret =g_test_run (); -return ret; +return g_test_run (); }
tests/qtest/hexloader-test.c +1 -5
@@ -34,12 +34,8 @@ static void hex_loader_test(void)int main (int argc,char **argv) { -int ret; -g_test_init (&argc, &argv,NULL );qtest_add_func ("/tmp/hex_loader" , hex_loader_test); - ret =g_test_run (); - -return ret; +return g_test_run (); }
tests/qtest/pvpanic-pci-test.c +1 -5
@@ -86,13 +86,9 @@ static void test_panic(void)int main (int argc,char **argv) { -int ret; -g_test_init (&argc, &argv,NULL );qtest_add_func ("/pvpanic-pci/panic" , test_panic);qtest_add_func ("/pvpanic-pci/panic-nopause" , test_panic_nopause); - ret =g_test_run (); - -return ret; +return g_test_run (); }
tests/qtest/pvpanic-test.c +1 -5
@@ -59,13 +59,9 @@ static void test_panic(void)int main (int argc,char **argv) { -int ret; -g_test_init (&argc, &argv,NULL );qtest_add_func ("/pvpanic/panic" , test_panic);qtest_add_func ("/pvpanic/panic-nopause" , test_panic_nopause); - ret =g_test_run (); - -return ret; +return g_test_run (); }
tests/qtest/test-filter-mirror.c +1 -5
@@ -76,12 +76,8 @@ static void test_mirror(void)int main (int argc,char **argv) { -int ret; -g_test_init (&argc, &argv,NULL );qtest_add_func ("/netfilter/mirror" , test_mirror); - ret =g_test_run (); - -return ret; +return g_test_run (); }
tests/qtest/virtio-ccw-test.c +1 -5
@@ -95,8 +95,6 @@ static void virtio_scsi_hotplug(void)int main (int argc,char **argv) { -int ret; -g_test_init (&argc, &argv,NULL );qtest_add_func ("/virtio/balloon/nop" , virtio_balloon_nop);qtest_add_func ("/virtio/console/nop" , virtconsole_nop);
@@ -109,7 +107,5 @@ int main(int argc, char **argv)qtest_add_func ("/virtio/scsi/nop" , virtio_scsi_nop);qtest_add_func ("/virtio/scsi/hotplug" , virtio_scsi_hotplug); - ret =g_test_run (); - -return ret; +return g_test_run (); }
tests/tcg/multiarch/sha512.c +2 -7
@@ -855,8 +855,6 @@ plan_tests(unsigned int tests)static int exit_status_ (void ) { -int r; -/* If there's no plan, just return the number of failures */ if (no_plan || !have_plan) {return failures;
@@ -865,15 +863,12 @@ exit_status_(void)/* Ran too many tests? Return the number of tests that were run that shouldn't have been */ if (e_tests < test_count) { - r = test_count - e_tests; -return r; +return test_count - e_tests; }/* Return the number of tests that failed + the number of tests that weren't run */ - r = failures + e_tests - test_count; - -return r; +return failures + e_tests - test_count; }int
tools/virtiofsd/fuse_lowlevel.c +6 -18
@@ -216,7 +216,6 @@ static int send_reply(fuse_req_t req, int error, const void *arg,int fuse_reply_iov (fuse_req_t req,const struct iovec *iov,int count) { -int res; g_autofree struct iovec *padded_iov = NULL; padded_iov = g_try_new(struct iovec, count + 1);
@@ -227,9 +226,7 @@ int fuse_reply_iov(fuse_req_t req, const struct iovec *iov, int count)memcpy (padded_iov +1 , iov, count *sizeof (struct iovec )); count++; - res =send_reply_iov (req,0 , padded_iov, count); - -return res; +return send_reply_iov (req,0 , padded_iov, count); }
@@ -589,7 +586,6 @@ int fuse_reply_ioctl_retry(fuse_req_t req, const struct iovec *in_iov, g_autofree struct fuse_ioctl_iovec *out_fiov = NULL;struct iovec iov[4 ];size_t count =1 ; -int res;memset (&arg,0 ,sizeof (arg)); arg.flags |=FUSE_IOCTL_RETRY ;
@@ -601,15 +597,13 @@ int fuse_reply_ioctl_retry(fuse_req_t req, const struct iovec *in_iov,/* Can't handle non-compat 64bit ioctls on 32bit */ if (sizeof (void *) ==4 && req->ioctl_64bit) { - res =fuse_reply_err (req,EINVAL ); -return res; +return fuse_reply_err (req,EINVAL ); }if (in_count) { in_fiov =fuse_ioctl_iovec_copy (in_iov, in_count);if (!in_fiov) { - res =fuse_reply_err (req,ENOMEM ); -return res; +return fuse_reply_err (req,ENOMEM ); } iov[count].iov_base = (void *)in_fiov;
@@ -619,8 +613,7 @@ int fuse_reply_ioctl_retry(fuse_req_t req, const struct iovec *in_iov,if (out_count) { out_fiov =fuse_ioctl_iovec_copy (out_iov, out_count);if (!out_fiov) { - res =fuse_reply_err (req,ENOMEM ); -return res; +return fuse_reply_err (req,ENOMEM ); } iov[count].iov_base = (void *)out_fiov;
@@ -628,9 +621,7 @@ int fuse_reply_ioctl_retry(fuse_req_t req, const struct iovec *in_iov, count++; } - res =send_reply_iov (req,0 , iov, count); - -return res; +return send_reply_iov (req,0 , iov, count); }int fuse_reply_ioctl (fuse_req_t req,int result,const void *buf,size_t size)
@@ -659,7 +650,6 @@ int fuse_reply_ioctl_iov(fuse_req_t req, int result, const struct iovec *iov, { g_autofree struct iovec *padded_iov = NULL;struct fuse_ioctl_out arg; -int res; padded_iov = g_try_new(struct iovec, count + 2);if (padded_iov ==NULL ) {
@@ -673,9 +663,7 @@ int fuse_reply_ioctl_iov(fuse_req_t req, int result, const struct iovec *iov,memcpy (&padded_iov[2 ], iov, count *sizeof (struct iovec )); - res =send_reply_iov (req,0 , padded_iov, count +2 ); - -return res; +return send_reply_iov (req,0 , padded_iov, count +2 ); }int fuse_reply_poll (fuse_req_t req,unsigned revents)
Signature · 1 line
2.37.3
[PULL 01/14] Drop more useless casts from void * to pointer
In reply to Markus ArmbrusterMessage-Id: <[email protected]>
--- bsd-user/elfload.c | 2 +- contrib/plugins/cache.c | 8 ++++---- contrib/vhost-user-blk/vhost-user-blk.c | 2 +- hw/core/qdev-clock.c | 2 +- hw/hyperv/vmbus.c | 2 +- hw/net/cadence_gem.c | 2 +- hw/net/virtio-net.c | 2 +- hw/nvme/ctrl.c | 4 ++-- hw/rdma/vmw/pvrdma_cmd.c | 9 +++------ hw/rdma/vmw/pvrdma_qp_ops.c | 6 +++--- hw/virtio/virtio-iommu.c | 3 +-- linux-user/syscall.c | 2 +- target/i386/hax/hax-all.c | 2 +- tests/tcg/aarch64/system/semiheap.c | 4 ++-- util/vfio-helpers.c | 2 +- 15 files changed, 24 insertions(+), 28 deletions(-)
bsd-user/elfload.c +1 -1
@@ -156,7 +156,7 @@ static abi_ulong copy_elf_strings(int argc, char **argv, void **page, --p; --tmp; --len;if (--offset <0 ) { offset = p %TARGET_PAGE_SIZE ; - pag = (char *)page[p /TARGET_PAGE_SIZE ]; + pag = page[p /TARGET_PAGE_SIZE ];if (!pag) { pag =g_try_malloc0 (TARGET_PAGE_SIZE ); page[p /TARGET_PAGE_SIZE ] = pag;
contrib/plugins/cache.c +4 -4
@@ -405,7 +405,7 @@ static void vcpu_mem_access(unsigned int vcpu_index, qemu_plugin_meminfo_t info,g_mutex_lock (&l1_dcache_locks[cache_idx]); hit_in_l1 =access_cache (l1_dcaches[cache_idx], effective_addr);if (!hit_in_l1) { - insn = (InsnData *) userdata; + insn = userdata;__atomic_fetch_add (&insn->l1_dmisses,1 , __ATOMIC_SEQ_CST); l1_dcaches[cache_idx]->misses++; }
@@ -419,7 +419,7 @@ static void vcpu_mem_access(unsigned int vcpu_index, qemu_plugin_meminfo_t info,g_mutex_lock (&l2_ucache_locks[cache_idx]);if (!access_cache (l2_ucaches[cache_idx], effective_addr)) { - insn = (InsnData *) userdata; + insn = userdata;__atomic_fetch_add (&insn->l2_misses,1 , __ATOMIC_SEQ_CST); l2_ucaches[cache_idx]->misses++; }
@@ -440,7 +440,7 @@ static void vcpu_insn_exec(unsigned int vcpu_index, void *userdata)g_mutex_lock (&l1_icache_locks[cache_idx]); hit_in_l1 =access_cache (l1_icaches[cache_idx], insn_addr);if (!hit_in_l1) { - insn = (InsnData *) userdata; + insn = userdata;__atomic_fetch_add (&insn->l1_imisses,1 , __ATOMIC_SEQ_CST); l1_icaches[cache_idx]->misses++; }
@@ -454,7 +454,7 @@ static void vcpu_insn_exec(unsigned int vcpu_index, void *userdata)g_mutex_lock (&l2_ucache_locks[cache_idx]);if (!access_cache (l2_ucaches[cache_idx], insn_addr)) { - insn = (InsnData *) userdata; + insn = userdata;__atomic_fetch_add (&insn->l2_misses,1 , __ATOMIC_SEQ_CST); l2_ucaches[cache_idx]->misses++; }
contrib/vhost-user-blk/vhost-user-blk.c +1 -1
@@ -193,7 +193,7 @@ vub_discard_write_zeroes(VubReq *req, struct iovec *iov, uint32_t iovcnt,#if defined(__linux__) && defined(BLKDISCARD ) && defined(BLKZEROOUT )VubDev *vdev_blk = req->vdev_blk; - desc = (struct virtio_blk_discard_write_zeroes *)buf; + desc = buf;uint64_t range[2 ] = {le64toh (desc->sector) <<9 ,le32toh (desc->num_sectors) <<9 };if (type ==VIRTIO_BLK_T_DISCARD ) {
hw/core/qdev-clock.c +1 -1
@@ -134,7 +134,7 @@ void qdev_init_clocks(DeviceState *dev, const ClockPortInitArray clocks)Clock **clkp;/* offset cannot be inside the DeviceState part */ assert (elem->offset >sizeof (DeviceState)); - clkp = (Clock **)(((void *) dev) + elem->offset); + clkp = ((void *)dev) + elem->offset;if (elem->is_output) { *clkp =qdev_init_clock_out (dev, elem->name); }else {
hw/hyperv/vmbus.c +1 -1
@@ -2104,7 +2104,7 @@ static void process_message(VMBus *vmbus) goto out; } msgdata = hv_msg->payload; - msg = (struct vmbus_message_header *)msgdata; + msg = msgdata;trace_vmbus_process_incoming_message (msg->message_type);
hw/net/cadence_gem.c +1 -1
@@ -1429,7 +1429,7 @@ static uint64_t gem_read(void *opaque, hwaddr offset, unsigned size) {CadenceGEMState *s;uint32_t retval; - s = (CadenceGEMState *)opaque; + s = opaque; offset >>=2 ; retval = s->regs[offset];
hw/net/virtio-net.c +1 -1
@@ -2472,7 +2472,7 @@ static size_t virtio_net_rsc_receive6(void *opq, NetClientState *nc,VirtioNetRscChain *chain;VirtioNetRscUnit unit; - chain = (VirtioNetRscChain *)opq; + chain = opq; hdr_len = ((VirtIONet *)(chain->n))->guest_hdr_len; if (size < (hdr_len + sizeof(struct eth_header) + sizeof(struct ip6_header)
hw/nvme/ctrl.c +2 -2
@@ -4028,14 +4028,14 @@ static uint16_t nvme_zone_mgmt_recv(NvmeCtrl *n, NvmeRequest *req) nr_zones++; } } - header = (NvmeZoneReportHeader *)buf; + header = buf; header->nr_zones =cpu_to_le64 (nr_zones); buf_p = buf +sizeof (NvmeZoneReportHeader);for (; zone_idx < ns->num_zones && max_zones >0 ; zone_idx++) { zone = &ns->zone_array[zone_idx];if (nvme_zone_matches_filter (zrasf, zone)) { - z = (NvmeZoneDescr *)buf_p; + z = buf_p; buf_p +=sizeof (NvmeZoneDescr); z->zt = zone->d.zt;
hw/rdma/vmw/pvrdma_cmd.c +3 -6
@@ -269,8 +269,7 @@ static int create_cq_ring(PCIDevice *pci_dev , PvrdmaRing **ring, r =g_malloc (sizeof (*r)); *ring = r; - r->ring_state = (PvrdmaRingState *) -rdma_pci_dma_map (pci_dev, tbl[0 ],TARGET_PAGE_SIZE ); + r->ring_state =rdma_pci_dma_map (pci_dev, tbl[0 ],TARGET_PAGE_SIZE );if (!r->ring_state) {rdma_error_report ("Failed to map to CQ ring state" );
@@ -405,8 +404,7 @@ static int create_qp_rings(PCIDevice *pci_dev, uint64_t pdir_dma, *rings = sr;/* Create send ring */ - sr->ring_state = (PvrdmaRingState *) -rdma_pci_dma_map (pci_dev, tbl[0 ],TARGET_PAGE_SIZE ); + sr->ring_state =rdma_pci_dma_map (pci_dev, tbl[0 ],TARGET_PAGE_SIZE );if (!sr->ring_state) {rdma_error_report ("Failed to map to QP ring state" ); goto out_free_sr_mem;
@@ -646,8 +644,7 @@ static int create_srq_ring(PCIDevice *pci_dev, PvrdmaRing **ring, r =g_malloc (sizeof (*r)); *ring = r; - r->ring_state = (PvrdmaRingState *) -rdma_pci_dma_map (pci_dev, tbl[0 ],TARGET_PAGE_SIZE ); + r->ring_state =rdma_pci_dma_map (pci_dev, tbl[0 ],TARGET_PAGE_SIZE );if (!r->ring_state) {rdma_error_report ("Failed to map tp SRQ ring state" ); goto out_free_ring_mem;
hw/rdma/vmw/pvrdma_qp_ops.c +3 -3
@@ -149,7 +149,7 @@ void pvrdma_qp_send(PVRDMADev *dev, uint32_t qp_handle) ring = (PvrdmaRing *)qp->opaque; - wqe = (struct PvrdmaSqWqe *)pvrdma_ring_next_elem_read (ring); + wqe =pvrdma_ring_next_elem_read (ring);while (wqe) {CompHandlerCtx *comp_ctx;
@@ -212,7 +212,7 @@ void pvrdma_qp_recv(PVRDMADev *dev, uint32_t qp_handle) ring = &((PvrdmaRing *)qp->opaque)[1 ]; - wqe = (struct PvrdmaRqWqe *)pvrdma_ring_next_elem_read (ring); + wqe =pvrdma_ring_next_elem_read (ring);while (wqe) {CompHandlerCtx *comp_ctx;
@@ -254,7 +254,7 @@ void pvrdma_srq_recv(PVRDMADev *dev, uint32_t srq_handle) ring = (PvrdmaRing *)srq->opaque; - wqe = (struct PvrdmaRqWqe *)pvrdma_ring_next_elem_read (ring); + wqe =pvrdma_ring_next_elem_read (ring);while (wqe) {CompHandlerCtx *comp_ctx;
hw/virtio/virtio-iommu.c +1 -2
@@ -775,8 +775,7 @@ static void virtio_iommu_handle_command(VirtIODevice *vdev, VirtQueue *vq) output_size = s->config.probe_size +sizeof (tail); buf =g_malloc0 (output_size); - ptail = (struct virtio_iommu_req_tail *) - (buf + s->config.probe_size); + ptail = buf + s->config.probe_size; ptail->status =virtio_iommu_handle_probe (s, iov, iov_cnt, buf);break ; }
linux-user/syscall.c +1 -1
@@ -5471,7 +5471,7 @@ static abi_long do_ioctl_rt(const IOCTLEntry *ie, uint8_t *buf_temp,for (i =0 ; i < se->nb_fields; i++) {if (dst_offsets[i] == offsetof(struct rtentry , rt_dev)) {assert (*field_types ==TYPE_PTRVOID ); - target_rt_dev_ptr = (abi_ulong *)(argptr + src_offsets[i]); + target_rt_dev_ptr = argptr + src_offsets[i]; host_rt_dev_ptr = (unsigned long *)(buf_temp + dst_offsets[i]);if (*target_rt_dev_ptr !=0 ) { *host_rt_dev_ptr = (unsigned long)lock_user_string(
target/i386/hax/hax-all.c +1 -1
@@ -388,7 +388,7 @@ static int hax_handle_io(CPUArchState *env, uint32_t df, uint16_t port,MemTxAttrs attrs = {0 };if (!df) { - ptr = (uint8_t *) buffer; + ptr = buffer; }else { ptr = buffer + size * count - size; }
tests/tcg/aarch64/system/semiheap.c +2 -2
@@ -73,11 +73,11 @@ int main(int argc, char *argv[argc])ml_printf ("stack: %p <- %p\n" , info.stack_limit, info.stack_base);/* finally can we read/write the heap */ - ptr_to_heap = (uint32_t *) info.heap_base; + ptr_to_heap = info.heap_base;for (i =0 ; i <512 ; i++) { *ptr_to_heap++ = i; } - ptr_to_heap = (uint32_t *) info.heap_base; + ptr_to_heap = info.heap_base;for (i =0 ; i <512 ; i++) {uint32_t tmp = *ptr_to_heap;if (tmp != i) {
util/vfio-helpers.c +1 -1
@@ -271,7 +271,7 @@ static void collect_usable_iova_ranges(QEMUVFIOState *s, void *buf)if (!cap->next) {return ; } - cap = (struct vfio_info_cap_header *)(buf + cap->next); + cap = buf + cap->next; } cap_iova_range = (struct vfio_iommu_type1_info_cap_iova_range *)cap;
Signature · 1 line
2.37.3
[PULL 07/14] qemu-config: Make config_parse_qdict() return bool
In reply to Markus ArmbrusterThis simplifies error checking.
Message-Id: <[email protected]>
--- include/qemu/config-file.h | 2 +- block/blkdebug.c | 4 +--- util/qemu-config.c | 39 ++++++++++++++++++-------------------- 3 files changed, 20 insertions(+), 25 deletions(-)
include/qemu/config-file.h +1 -1
@@ -22,7 +22,7 @@ int qemu_read_config_file(const char *filename, QEMUConfigCB *f, Error **errp);/* Parse QDict options as a replacement for a config file (allowing multiple enumerated (0..(n-1)) configuration "sections") */ -void qemu_config_parse_qdict (QDict *options,QemuOptsList **lists, +bool qemu_config_parse_qdict (QDict *options,QemuOptsList **lists,Error **errp);#endif /* QEMU_CONFIG_FILE_H */
block/blkdebug.c +1 -3
@@ -297,9 +297,7 @@ static int read_config(BDRVBlkdebugState *s, const char *filename, } } -qemu_config_parse_qdict (options, config_groups, &local_err); -if (local_err) { -error_propagate (errp, local_err); +if (!qemu_config_parse_qdict (options, config_groups, errp)) { ret = -EINVAL ; goto fail; }
util/qemu-config.c +18 -21
@@ -423,12 +423,12 @@ int qemu_read_config_file(const char *filename, QEMUConfigCB *cb, Error **errp)return ret; } -static void config_parse_qdict_section (QDict *options,QemuOptsList *opts, +static bool config_parse_qdict_section (QDict *options,QemuOptsList *opts,Error **errp) {QemuOpts *subopts; -QDict *subqdict; -QList *list =NULL ; +g_autoptr (QDict) subqdict =NULL ; +g_autoptr (QList) list =NULL ;size_t orig_size, enum_size;char *prefix;
@@ -437,23 +437,23 @@ static void config_parse_qdict_section(QDict *options, QemuOptsList *opts,g_free (prefix); orig_size =qdict_size (subqdict);if (!orig_size) { - goto out; +return true; } subopts =qemu_opts_create (opts,NULL ,0 , errp);if (!subopts) { - goto out; +return false; }if (!qemu_opts_absorb_qdict (subopts, subqdict, errp)) { - goto out; +return false; } enum_size =qdict_size (subqdict);if (enum_size < orig_size && enum_size) {error_setg (errp,"Unknown option '%s' for [%s]" ,qdict_first (subqdict)->key, opts->name); - goto out; +return false; }if (enum_size) {
@@ -468,7 +468,7 @@ static void config_parse_qdict_section(QDict *options, QemuOptsList *opts,if (qdict_size (subqdict)) {error_setg (errp,"Unused option '%s' for [%s]" ,qdict_first (subqdict)->key, opts->name); - goto out; +return false; } QLIST_FOREACH_ENTRY(list, list_entry) {
@@ -478,46 +478,43 @@ static void config_parse_qdict_section(QDict *options, QemuOptsList *opts,if (!section) {error_setg (errp,"[%s] section (index %u) does not consist of " "keys" , opts->name, i); - goto out; +return false; } opt_name =g_strdup_printf ("%s.%u" , opts->name, i++); subopts =qemu_opts_create (opts, opt_name,1 , errp);g_free (opt_name);if (!subopts) { - goto out; +return false; }if (!qemu_opts_absorb_qdict (subopts, section, errp)) {qemu_opts_del (subopts); - goto out; +return false; }if (qdict_size (section)) {error_setg (errp,"[%s] section doesn't support the option '%s'" , opts->name,qdict_first (section)->key);qemu_opts_del (subopts); - goto out; +return false; } } } -out: -qobject_unref (subqdict); -qobject_unref (list); +return true; } -void qemu_config_parse_qdict (QDict *options,QemuOptsList **lists, +bool qemu_config_parse_qdict (QDict *options,QemuOptsList **lists,Error **errp) {int i; -Error *local_err =NULL ;for (i =0 ; lists[i]; i++) { -config_parse_qdict_section (options, lists[i], &local_err); -if (local_err) { -error_propagate (errp, local_err); -return ; +if (!config_parse_qdict_section (options, lists[i], errp)) { +return false; } } + +return true; }
Signature · 1 line
2.37.3
[PULL 06/14] monitor: Use ERRP_GUARD() in monitor_init()
In reply to Markus ArmbrusterMessage-Id: <[email protected]>
--- monitor/monitor.c | 12 ++++-------- 1 file changed, 4 insertions(+), 8 deletions(-)
monitor/monitor.c +4 -8
@@ -711,8 +711,8 @@ void monitor_init_globals_core(void)int monitor_init (MonitorOptions *opts,bool allow_hmp,Error **errp) { +ERRP_GUARD ();Chardev *chr; -Error *local_err =NULL ; chr =qemu_chr_find (opts->chardev);if (chr ==NULL ) {
@@ -726,7 +726,7 @@ int monitor_init(MonitorOptions *opts, bool allow_hmp, Error **errp)switch (opts->mode) {case MONITOR_MODE_CONTROL : -monitor_init_qmp (chr, opts->pretty, &local_err); +monitor_init_qmp (chr, opts->pretty, errp);break ;case MONITOR_MODE_READLINE :if (!allow_hmp) {
@@ -737,17 +737,13 @@ int monitor_init(MonitorOptions *opts, bool allow_hmp, Error **errp)error_setg (errp,"'pretty' is not compatible with HMP monitors" );return -1 ; } -monitor_init_hmp (chr, true, &local_err); +monitor_init_hmp (chr, true, errp);break ;default :g_assert_not_reached (); } -if (local_err) { -error_propagate (errp, local_err); -return -1 ; - } -return 0 ; +return *errp ?-1 :0 ; }int monitor_init_opts (QemuOpts *opts,Error **errp)
Signature · 1 line
2.37.3
[PULL 03/14] error: Drop a few superfluous ERRP_GUARD()
In reply to Markus Armbrusterinclude/qapi/error.h on ERRP_GUARD():
* It must be used when the function dereferences @errp or passes
* @errp to error_prepend(), error_vprepend(), or error_append_hint().
* It is safe to use even when it's not needed, but please avoid
* cluttering the source with useless code.
Clean up some of this clutter.
Message-Id: <[email protected]>
--- block/copy-before-write.c | 1 - dump/dump.c | 2 -- hw/core/qdev.c | 2 -- hw/pci/msi.c | 1 - hw/remote/vfio-user-obj.c | 1 - ui/util.c | 1 - 6 files changed, 8 deletions(-)
block/copy-before-write.c +0 -1
@@ -522,7 +522,6 @@ BlockDriverState *bdrv_cbw_append(BlockDriverState *source, BlockCopyState **bcs, Error **errp) { -ERRP_GUARD ();BDRVCopyBeforeWriteState *state;BlockDriverState *top;QDict *opts;
dump/dump.c +0 -2
@@ -357,7 +357,6 @@ static void write_elf32_notes(WriteCoreDumpFunction f, DumpState *s,static void write_elf_phdr_note (DumpState *s,Error **errp) { -ERRP_GUARD ();Elf32_Phdr phdr32;Elf64_Phdr phdr64;void *phdr;
@@ -773,7 +772,6 @@ static void dump_iterate(DumpState *s, Error **errp)static void dump_end (DumpState *s,Error **errp) {int rc; -ERRP_GUARD ();if (s->elf_section_data_size) { s->elf_section_data =g_malloc0 (s->elf_section_data_size);
hw/core/qdev.c +0 -2
@@ -493,8 +493,6 @@ void qdev_del_unplug_blocker(DeviceState *dev, Error *reason)bool qdev_unplug_blocked (DeviceState *dev,Error **errp) { -ERRP_GUARD (); -if (dev->unplug_blockers) {error_propagate (errp,error_copy (dev->unplug_blockers->data));return true;
hw/pci/msi.c +0 -1
@@ -317,7 +317,6 @@ bool msi_is_masked(const PCIDevice *dev, unsigned int vector)void msi_set_mask (PCIDevice *dev,int vector,bool mask,Error **errp) { -ERRP_GUARD ();uint16_t flags =pci_get_word (dev->config +msi_flags_off (dev));bool msi64bit = flags &PCI_MSI_FLAGS_64BIT ;uint32_t irq_state, vector_mask, pending;
hw/remote/vfio-user-obj.c +0 -1
@@ -719,7 +719,6 @@ static void vfu_object_machine_done(Notifier *notifier, void *data)*/ static void vfu_object_init_ctx (VfuObject *o,Error **errp) { -ERRP_GUARD ();DeviceState *dev =NULL ;vfu_pci_type_t pci_type =VFU_PCI_TYPE_CONVENTIONAL ;int ret;
ui/util.c +0 -1
@@ -51,7 +51,6 @@ bool qemu_console_fill_device_address(QemuConsole *con,size_t size, Error **errp) { -ERRP_GUARD (); DeviceState *dev = DEVICE(object_property_get_link(OBJECT(con),"device" , &error_abort));
Signature · 1 line
2.37.3
[PULL 05/14] monitor: Simplify monitor_fd_param()'s error handling
In reply to Markus ArmbrusterMessage-Id: <[email protected]>
--- monitor/misc.c | 14 ++++---------- 1 file changed, 4 insertions(+), 10 deletions(-)
monitor/misc.c +4 -10
@@ -1086,6 +1086,7 @@ int monitor_get_fd(Monitor *mon, const char *fdname, Error **errp) } fd = monfd->fd; +assert (fd >=0 );/* caller takes ownership of fd */ QLIST_REMOVE (monfd, next);
@@ -1403,23 +1404,16 @@ void monitor_fdset_dup_fd_remove(int dup_fd)int monitor_fd_param (Monitor *mon,const char *fdname,Error **errp) {int fd; -Error *local_err =NULL ;if (!qemu_isdigit (fdname[0 ]) && mon) { - fd =monitor_get_fd (mon, fdname, &local_err); + fd =monitor_get_fd (mon, fdname, errp); }else { fd =qemu_parse_fd (fdname); -if (fd ==-1 ) { -error_setg (&local_err,"Invalid file descriptor number '%s'" , +if (fd <0 ) { +error_setg (errp,"Invalid file descriptor number '%s'" , fdname); } } -if (local_err) { -error_propagate (errp, local_err); -assert (fd ==-1 ); - }else { -assert (fd !=-1 ); - }return fd; }
Signature · 1 line
2.37.3
[PULL 13/14] block/vmdk: Simplify vmdk_co_create() to return directly
In reply to Markus ArmbrusterMessage-Id: <[email protected]>
--- block/vmdk.c | 28 +++++++++++----------------- 1 file changed, 11 insertions(+), 17 deletions(-)
block/vmdk.c +11 -17
@@ -2821,7 +2821,6 @@ static BlockBackend *vmdk_co_create_cb(int64_t size, int idx, static int coroutine_fn vmdk_co_create(BlockdevCreateOptions *create_options,Error **errp) { -int ret;BlockdevCreateOptionsVmdk *opts; opts = &create_options->u.vmdk;
@@ -2829,24 +2828,19 @@ static int coroutine_fn vmdk_co_create(BlockdevCreateOptions *create_options,/* Validate options */ if (!QEMU_IS_ALIGNED (opts->size,BDRV_SECTOR_SIZE )) {error_setg (errp,"Image size must be a multiple of 512 bytes" ); - ret = -EINVAL ; - goto out; +return -EINVAL ; } - ret =vmdk_co_do_create (opts->size, - opts->subformat, - opts->adapter_type, - opts->backing_file, - opts->hwversion, - opts->toolsversion, - false, - opts->zeroed_grain, - vmdk_co_create_cb, - opts, errp); -return ret; - -out: -return ret; +return vmdk_co_do_create (opts->size, + opts->subformat, + opts->adapter_type, + opts->backing_file, + opts->hwversion, + opts->toolsversion, + false, + opts->zeroed_grain, + vmdk_co_create_cb, + opts, errp); }static void vmdk_close (BlockDriverState *bs)
Signature · 1 line
2.37.3
[PULL 08/14] qemu-config: Use ERRP_GUARD() where obviously appropriate
In reply to Markus ArmbrusterMessage-Id: <[email protected]>
--- util/qemu-config.c | 7 +++---- 1 file changed, 3 insertions(+), 4 deletions(-)
util/qemu-config.c +3 -4
@@ -318,9 +318,9 @@ void qemu_add_opts(QemuOptsList *list)static int qemu_config_foreach (FILE *fp,QEMUConfigCB *cb,void *opaque,const char *fname,Error **errp) { +ERRP_GUARD ();char line[1024 ], prev_group[64 ], group[64 ], arg[64 ], value[1024 ];Location loc; -Error *local_err =NULL ;QDict *qdict =NULL ;int res = -EINVAL , lno =0 ;int count =0 ;
@@ -348,10 +348,9 @@ static int qemu_config_foreach(FILE *fp, QEMUConfigCB *cb, void *opaque, }if (qdict != prev) {if (prev) { -cb (prev_group, prev, opaque, &local_err); +cb (prev_group, prev, opaque, errp);qobject_unref (prev); -if (local_err) { -error_propagate (errp, local_err); +if (*errp) { goto out; } }
Signature · 1 line
2.37.3
[PULL 10/14] qapi: Use returned bool to check for failure (again)
In reply to Markus ArmbrusterCommit 012d4c96e2 changed the visitor functions taking Error ** to return bool instead of void, and the commits following it used the new return value to simplify error checking. Since then a few more uses in need of the same treatment crept in. Do that. All pretty mechanical except for
* balloon_stats_get_all()
This is basically the same transformation commit 012d4c96e2 applied to the virtual walk example in include/qapi/visitor.h.
* set_max_queue_size()
Additionally replace "goto end of function" by return.
Message-Id: <[email protected]>
--- accel/kvm/kvm-all.c | 5 +---- hw/core/qdev-properties-system.c | 5 +---- hw/i386/pc.c | 5 +---- hw/virtio/virtio-balloon.c | 20 +++++++++----------- hw/virtio/virtio-mem.c | 10 ++-------- net/colo-compare.c | 13 ++++--------- target/i386/kvm/kvm.c | 5 +---- util/thread-context.c | 10 ++-------- 8 files changed, 21 insertions(+), 52 deletions(-)
accel/kvm/kvm-all.c +1 -4
@@ -3586,7 +3586,6 @@ static void kvm_set_dirty_ring_size(Object *obj, Visitor *v, Error **errp) {KVMState *s =KVM_STATE (obj); -Error *error =NULL ;uint32_t value;if (s->fd !=-1 ) {
@@ -3594,9 +3593,7 @@ static void kvm_set_dirty_ring_size(Object *obj, Visitor *v,return ; } -visit_type_uint32 (v, name, &value, &error); -if (error) { -error_propagate (errp, error); +if (!visit_type_uint32 (v, name, &value, errp)) {return ; }if (value & (value -1 )) {
hw/core/qdev-properties-system.c +1 -4
@@ -679,14 +679,11 @@ static void set_reserved_region(Object *obj, Visitor *v, const char *name, {Property *prop = opaque;ReservedRegion *rr =object_field_prop_ptr (obj, prop); -Error *local_err =NULL ;const char *endptr;char *str;int ret; -visit_type_str (v, name, &str, &local_err); -if (local_err) { -error_propagate (errp, local_err); +if (!visit_type_str (v, name, &str, errp)) {return ; }
hw/i386/pc.c +1 -4
@@ -1782,12 +1782,9 @@ static void pc_machine_set_max_fw_size(Object *obj, Visitor *v, Error **errp) {PCMachineState *pcms =PC_MACHINE (obj); -Error *error =NULL ;uint64_t value; -visit_type_size (v, name, &value, &error); -if (error) { -error_propagate (errp, error); +if (!visit_type_size (v, name, &value, errp)) {return ; }
hw/virtio/virtio-balloon.c +9 -11
@@ -241,36 +241,34 @@ static void balloon_stats_poll_cb(void *opaque)static void balloon_stats_get_all (Object *obj,Visitor *v,const char *name,void *opaque,Error **errp) { -Error *err =NULL ;VirtIOBalloon *s =VIRTIO_BALLOON (obj); +bool ok = false;int i; -if (!visit_start_struct (v, name,NULL ,0 , &err)) { - goto out; +if (!visit_start_struct (v, name,NULL ,0 , errp)) { +return ; } -if (!visit_type_int (v,"last-update" , &s->stats_last_update, &err)) { +if (!visit_type_int (v,"last-update" , &s->stats_last_update, errp)) { goto out_end; } -if (!visit_start_struct (v,"stats" ,NULL ,0 , &err)) { +if (!visit_start_struct (v,"stats" ,NULL ,0 , errp)) { goto out_end; }for (i =0 ; i <VIRTIO_BALLOON_S_NR ; i++) { -if (!visit_type_uint64 (v, balloon_stat_names[i], &s->stats[i], &err)) { +if (!visit_type_uint64 (v, balloon_stat_names[i], &s->stats[i], errp)) { goto out_nested; } } -visit_check_struct (v, &err); + ok =visit_check_struct (v, errp); out_nested:visit_end_struct (v,NULL ); -if (!err) { -visit_check_struct (v, &err); +if (ok) { +visit_check_struct (v, errp); } out_end:visit_end_struct (v,NULL ); -out: -error_propagate (errp, err); } static void balloon_stats_get_poll_interval(Object *obj, Visitor *v,
hw/virtio/virtio-mem.c +2 -8
@@ -1094,12 +1094,9 @@ static void virtio_mem_set_requested_size(Object *obj, Visitor *v, Error **errp) {VirtIOMEM *vmem =VIRTIO_MEM (obj); -Error *err =NULL ;uint64_t value; -visit_type_size (v, name, &value, &err); -if (err) { -error_propagate (errp, err); +if (!visit_type_size (v, name, &value, errp)) {return ; }
@@ -1159,7 +1156,6 @@ static void virtio_mem_set_block_size(Object *obj, Visitor *v, const char *name, void *opaque, Error **errp) { VirtIOMEM *vmem = VIRTIO_MEM(obj); -Error *err =NULL ;uint64_t value;if (DEVICE (obj)->realized) {
@@ -1167,9 +1163,7 @@ static void virtio_mem_set_block_size(Object *obj, Visitor *v, const char *name,return ; } -visit_type_size (v, name, &value, &err); -if (err) { -error_propagate (errp, err); +if (!visit_type_size (v, name, &value, errp)) {return ; }
net/colo-compare.c +4 -9
@@ -1135,22 +1135,17 @@ static void set_max_queue_size(Object *obj, Visitor *v, const char *name, void *opaque, Error **errp) { - Error *local_err = NULL; uint64_t value; -visit_type_uint64 (v, name, &value, &local_err); -if (local_err) { - goto out; +if (!visit_type_uint64 (v, name, &value, errp)) { +return ; }if (!value) { -error_setg (&local_err,"Property '%s.%s' requires a positive value" , +error_setg (errp,"Property '%s.%s' requires a positive value" ,object_get_typename (obj), name); - goto out; +return ; } max_queue_size = value; - -out: -error_propagate (errp, local_err); }static void compare_pri_rs_finalize (SocketReadState *pri_rs)
target/i386/kvm/kvm.c +1 -4
@@ -5689,7 +5689,6 @@ static void kvm_arch_set_notify_window(Object *obj, Visitor *v, Error **errp) {KVMState *s =KVM_STATE (obj); -Error *error =NULL ;uint32_t value;if (s->fd !=-1 ) {
@@ -5697,9 +5696,7 @@ static void kvm_arch_set_notify_window(Object *obj, Visitor *v,return ; } -visit_type_uint32 (v, name, &value, &error); -if (error) { -error_propagate (errp, error); +if (!visit_type_uint32 (v, name, &value, errp)) {return ; }
util/thread-context.c +2 -8
@@ -90,16 +90,13 @@ static void thread_context_set_cpu_affinity(Object *obj, Visitor *v,uint16List *l, *host_cpus =NULL ;unsigned long *bitmap =NULL ;int nbits =0 , ret; -Error *err =NULL ;if (tc->init_cpu_bitmap) {error_setg (errp,"Mixing CPU and node affinity not supported" );return ; } -visit_type_uint16List (v, name, &host_cpus, &err); -if (err) { -error_propagate (errp, err); +if (!visit_type_uint16List (v, name, &host_cpus, errp)) {return ; }
@@ -178,7 +175,6 @@ static void thread_context_set_node_affinity(Object *obj, Visitor *v,uint16List *l, *host_nodes =NULL ;unsigned long *bitmap =NULL ;struct bitmask *tmp_cpus; -Error *err =NULL ;int ret, i;if (tc->init_cpu_bitmap) {
@@ -186,9 +182,7 @@ static void thread_context_set_node_affinity(Object *obj, Visitor *v,return ; } -visit_type_uint16List (v, name, &host_nodes, &err); -if (err) { -error_propagate (errp, err); +if (!visit_type_uint16List (v, name, &host_nodes, errp)) {return ; }
Signature · 1 line
2.37.3
[PULL 02/14] error: Drop some obviously superfluous error_propagate()
In reply to Markus ArmbrusterWhen error_propagate(errp, local_err) is the only reader of @local_err, we can just as well change its writers to write @errp directly, and drop the error_propagate() along with @local_err.
Message-Id: <[email protected]>
--- hw/arm/virt.c | 14 +++++--------- hw/hyperv/vmbus.c | 8 +++----- qga/commands-win32.c | 8 +++----- 3 files changed, 11 insertions(+), 19 deletions(-)
hw/arm/virt.c +5 -9
@@ -2771,24 +2771,20 @@ static void virt_dimm_unplug_request(HotplugHandler *hotplug_dev, DeviceState *dev, Error **errp) {VirtMachineState *vms =VIRT_MACHINE (hotplug_dev); -Error *local_err =NULL ;if (!vms->acpi_dev) { -error_setg (&local_err, +error_setg (errp,"memory hotplug is not enabled: missing acpi-ged device" ); - goto out; +return ; }if (object_dynamic_cast (OBJECT (dev),TYPE_NVDIMM )) { -error_setg (&local_err, -"nvdimm device hot unplug is not supported yet." ); - goto out; +error_setg (errp,"nvdimm device hot unplug is not supported yet." ); +return ; }hotplug_handler_unplug_request (HOTPLUG_HANDLER (vms->acpi_dev), dev, - &local_err); -out: -error_propagate (errp, local_err); + errp); } static void virt_dimm_unplug(HotplugHandler *hotplug_dev,
hw/hyperv/vmbus.c +3 -5
@@ -2404,7 +2404,6 @@ static const TypeInfo vmbus_dev_type_info = {static void vmbus_realize (BusState *bus,Error **errp) {int ret =0 ; -Error *local_err =NULL ;VMBus *vmbus =VMBUS (bus);qemu_mutex_init (&vmbus->rx_queue_lock);
@@ -2415,13 +2414,13 @@ static void vmbus_realize(BusState *bus, Error **errp) ret =hyperv_set_msg_handler (VMBUS_MESSAGE_CONNECTION_ID , vmbus_recv_message, vmbus);if (ret !=0 ) { -error_setg (&local_err,"hyperv set message handler failed: %d" , ret); +error_setg (errp,"hyperv set message handler failed: %d" , ret); goto error_out; } ret =event_notifier_init (&vmbus->notifier,0 );if (ret !=0 ) { -error_setg (&local_err,"event notifier failed to init with %d" , ret); +error_setg (errp,"event notifier failed to init with %d" , ret); goto remove_msg_handler; }
@@ -2429,7 +2428,7 @@ static void vmbus_realize(BusState *bus, Error **errp) ret =hyperv_set_event_flag_handler (VMBUS_EVENT_CONNECTION_ID , &vmbus->notifier);if (ret !=0 ) { -error_setg (&local_err,"hyperv set event handler failed with %d" , ret); +error_setg (errp,"hyperv set event handler failed with %d" , ret); goto clear_event_notifier; }
@@ -2441,7 +2440,6 @@ remove_msg_handler:hyperv_set_msg_handler (VMBUS_MESSAGE_CONNECTION_ID ,NULL ,NULL ); error_out:qemu_mutex_destroy (&vmbus->rx_queue_lock); -error_propagate (errp, local_err); }static void vmbus_unrealize (BusState *bus)
qga/commands-win32.c +3 -5
@@ -275,13 +275,12 @@ static void acquire_privilege(const char *name, Error **errp) {HANDLE token =NULL ;TOKEN_PRIVILEGES priv; -Error *local_err =NULL ;if (OpenProcessToken (GetCurrentProcess (),TOKEN_ADJUST_PRIVILEGES |TOKEN_QUERY , &token)) {if (!LookupPrivilegeValue (NULL , name, &priv.Privileges[0 ].Luid)) { -error_setg (&local_err,QERR_QGA_COMMAND_FAILED , +error_setg (errp,QERR_QGA_COMMAND_FAILED ,"no luid for requested privilege" ); goto out; }
@@ -290,13 +289,13 @@ static void acquire_privilege(const char *name, Error **errp) priv.Privileges[0 ].Attributes =SE_PRIVILEGE_ENABLED ;if (!AdjustTokenPrivileges (token, FALSE, &priv,0 ,NULL ,0 )) { -error_setg (&local_err,QERR_QGA_COMMAND_FAILED , +error_setg (errp,QERR_QGA_COMMAND_FAILED ,"unable to acquire requested privilege" ); goto out; } }else { -error_setg (&local_err,QERR_QGA_COMMAND_FAILED , +error_setg (errp,QERR_QGA_COMMAND_FAILED ,"failed to open privilege token" ); }
@@ -304,7 +303,6 @@ out:if (token) {CloseHandle (token); } -error_propagate (errp, local_err); } static void execute_async(DWORD WINAPI (*func)(LPVOID), LPVOID opaque,
Signature · 1 line
2.37.3
[PULL 04/14] error: Move ERRP_GUARD() to the beginning of the function
In reply to Markus Armbrusterinclude/qapi/error.h advises to put ERRP_GUARD() right at the beginning of the function, because only then can it guard the whole function. Clean up the few spots disregarding the advice.
Message-Id: <[email protected]>
--- hw/arm/armsse.c | 3 +-- hw/core/machine.c | 3 +-- hw/virtio/vhost-vdpa.c | 2 +- iothread.c | 2 +- monitor/qmp-cmds.c | 4 ++-- 5 files changed, 6 insertions(+), 8 deletions(-)
hw/arm/armsse.c +1 -2
@@ -900,6 +900,7 @@ static qemu_irq armsse_get_common_irq_in(ARMSSE *s, int irqno)static void armsse_realize (DeviceState *dev,Error **errp) { +ERRP_GUARD ();ARMSSE *s =ARM_SSE (dev);ARMSSEClass *asc =ARM_SSE_GET_CLASS (dev);const ARMSSEInfo *info = asc->info;
@@ -914,8 +915,6 @@ static void armsse_realize(DeviceState *dev, Error **errp)DeviceState *dev_splitter;uint32_t addr_width_max; -ERRP_GUARD (); -if (!s->board_memory) {error_setg (errp,"memory property was not set" );return ;
hw/core/machine.c +1 -2
@@ -554,12 +554,11 @@ static void machine_get_mem(Object *obj, Visitor *v, const char *name,static void machine_set_mem (Object *obj,Visitor *v,const char *name,void *opaque,Error **errp) { +ERRP_GUARD ();MachineState *ms =MACHINE (obj);MachineClass *mc =MACHINE_GET_CLASS (obj);MemorySizeConfiguration *mem; -ERRP_GUARD (); -if (!visit_type_MemorySizeConfiguration (v, name, &mem, errp)) {return ; }
hw/virtio/vhost-vdpa.c +1 -1
@@ -963,6 +963,7 @@ static bool vhost_vdpa_svq_map_rings(struct vhost_dev *dev,struct vhost_vring_addr *addr, Error **errp) { +ERRP_GUARD ();DMAMap device_region, driver_region;struct vhost_vring_addr svq_addr;struct vhost_vdpa *v = dev->opaque;
@@ -971,7 +972,6 @@ static bool vhost_vdpa_svq_map_rings(struct vhost_dev *dev,size_t avail_offset;bool ok; -ERRP_GUARD ();vhost_svq_get_vring_addr (svq, &svq_addr); driver_region = (DMAMap ) {
iothread.c +1 -1
@@ -155,8 +155,8 @@ static void iothread_init_gcontext(IOThread *iothread)static void iothread_set_aio_context_params (EventLoopBase *base,Error **errp) { -IOThread *iothread =IOTHREAD (base);ERRP_GUARD (); +IOThread *iothread =IOTHREAD (base);if (!iothread->ctx) {return ;
monitor/qmp-cmds.c +2 -2
@@ -474,9 +474,9 @@ static bool invoke_stats_cb(StatsCallbacks *entry, StatsFilter *filter, StatsRequest *request, Error **errp) { +ERRP_GUARD ();strList *targets =NULL ;strList *names =NULL ; -ERRP_GUARD ();if (request) {if (request->provider != entry->provider) {
@@ -541,9 +541,9 @@ StatsSchemaList *qmp_query_stats_schemas(bool has_provider,StatsProvider provider, Error **errp) { +ERRP_GUARD ();StatsSchemaList *stats_results =NULL ;StatsCallbacks *entry; -ERRP_GUARD (); QTAILQ_FOREACH(entry, &stats_callbacks, next) {if (!has_provider || provider == entry->provider) {
Signature · 1 line
2.37.3
[PULL 11/14] io: Tidy up fat-fingered parameter name
In reply to Markus ArmbrusterMessage-Id: <[email protected]>
--- include/io/channel.h | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-)
include/io/channel.h +1 -1
@@ -350,7 +350,7 @@ int qio_channel_readv_all(QIOChannel *ioc,int qio_channel_writev_all (QIOChannel *ioc,const struct iovec *iov,size_t niov, -Error **erp); +Error **errp);/** * qio_channel_readv:
Signature · 1 line
2.37.3
[PULL 09/14] sockets: Use ERRP_GUARD() where obviously appropriate
In reply to Markus ArmbrusterMessage-Id: <[email protected]>
--- util/qemu-sockets.c | 26 ++++++++++---------------- 1 file changed, 10 insertions(+), 16 deletions(-)
util/qemu-sockets.c +10 -16
@@ -210,7 +210,8 @@ static int inet_listen_saddr(InetSocketAddress *saddr,int num, Error **errp) { - struct addrinfo ai,*res,*e; +ERRP_GUARD (); +struct addrinfo ai, *res, *e;char port[33 ];char uaddr[INET6_ADDRSTRLEN +1 ];char uport[33 ];
@@ -218,7 +219,6 @@ static int inet_listen_saddr(InetSocketAddress *saddr,int slisten =-1 ;int saved_errno =0 ;bool socket_created = false; -Error *err =NULL ;if (saddr->keep_alive) { error_setg(errp, "keep-alive option is not supported for passive "
@@ -231,11 +231,9 @@ static int inet_listen_saddr(InetSocketAddress *saddr,if (saddr->has_numeric && saddr->numeric) { ai.ai_flags |=AI_NUMERICHOST |AI_NUMERICSERV ; } - ai.ai_family =inet_ai_family_from_address (saddr, &err); ai.ai_socktype =SOCK_STREAM ; - -if (err) { -error_propagate (errp, err); + ai.ai_family =inet_ai_family_from_address (saddr, errp); +if (*errp) {return -1 ; }
@@ -392,9 +390,9 @@ static int inet_connect_addr(const InetSocketAddress *saddr,static struct addrinfo *inet_parse_connect_saddr (InetSocketAddress *saddr,Error **errp) { +ERRP_GUARD ();struct addrinfo ai, *res;int rc; -Error *err =NULL ;static int useV4Mapped =1 ;memset (&ai,0 ,sizeof (ai));
@@ -403,11 +401,9 @@ static struct addrinfo *inet_parse_connect_saddr(InetSocketAddress *saddr,if (qatomic_read (&useV4Mapped)) { ai.ai_flags |=AI_V4MAPPED ; } - ai.ai_family =inet_ai_family_from_address (saddr, &err); ai.ai_socktype =SOCK_STREAM ; - -if (err) { -error_propagate (errp, err); + ai.ai_family =inet_ai_family_from_address (saddr, errp); +if (*errp) {return NULL ; }
@@ -499,20 +495,18 @@ static int inet_dgram_saddr(InetSocketAddress *sraddr, InetSocketAddress *sladdr, Error **errp) { +ERRP_GUARD ();struct addrinfo ai, *peer =NULL , *local =NULL ;const char *addr;const char *port;int sock =-1 , rc; -Error *err =NULL ;/* lookup peer addr */ memset (&ai,0 ,sizeof (ai)); ai.ai_flags =AI_CANONNAME |AI_V4MAPPED |AI_ADDRCONFIG ; - ai.ai_family =inet_ai_family_from_address (sraddr, &err); ai.ai_socktype =SOCK_DGRAM ; - -if (err) { -error_propagate (errp, err); + ai.ai_family =inet_ai_family_from_address (sraddr, errp); +if (*errp) { goto err; }
Signature · 1 line
2.37.3
[PULL 14/14] ppc4xx_sdram: Simplify sdram_ddr_size() to return
In reply to Markus ArmbrusterMessage-Id: <[email protected]>
--- hw/ppc/ppc4xx_sdram.c | 10 +++------- 1 file changed, 3 insertions(+), 7 deletions(-)
hw/ppc/ppc4xx_sdram.c +3 -7
@@ -192,17 +192,13 @@ static inline hwaddr sdram_ddr_base(uint32_t bcr)static hwaddr sdram_ddr_size (uint32_t bcr) { -hwaddr size; -int sh; +int sh = (bcr >>17 ) &0x7 ; - sh = (bcr >>17 ) &0x7 ;if (sh ==7 ) { - size =-1 ; - }else { - size = (4 * MiB) << sh; +return -1 ; } -return size; +return (4 * MiB) << sh; }static uint32_t sdram_ddr_dcr_read (void *opaque,int dcrn)
Signature · 1 line
2.37.3
Peter Maydell
AppliedQuoted 9 lines · Markus Armbruster
The following changes since commit
ea3a008d2d9ced9c4f93871c823baee237047f93:Update VERSION for v7.2.0-rc4 (2022-12-06 19:53:34 -0500)
are available in the Git repository at:
https://repo.or.cz/qemu/armbru.git tags/pull-misc-2022-12-14
Quoted 8 lines
for you to fetch changes up to
6c5aaee4b61eb8bf60c7c30365432710b4346421:
ppc4xx_sdram: Simplifysdram_ddr_size()to return (2022-12-14 16:19:35 +0100)----------------------------------------------------------------
Miscellaneous patches for 2022-12-14----------------------------------------------------------------
Applied, thanks.
Please update the changelog at https://wiki.qemu.org/ChangeLog/7.1
for any user-visible changes.
-- PMM
Quoted 18 lines · Peter Maydell
Quoted 16 lines · Markus Armbruster
The following changes since commit
ea3a008d2d9ced9c4f93871c823baee237047f93:Update VERSION for v7.2.0-rc4 (2022-12-06 19:53:34 -0500)
are available in the Git repository at:
https://repo.or.cz/qemu/armbru.git tags/pull-misc-2022-12-14
for you to fetch changes up to
6c5aaee4b61eb8bf60c7c30365432710b4346421:
ppc4xx_sdram: Simplifysdram_ddr_size()to return (2022-12-14 16:19:35 +0100)----------------------------------------------------------------
Miscellaneous patches for 2022-12-14
Quoted 7 lines
Quoted 1 line
----------------------------------------------------------------
Applied, thanks.
Please update the changelog at https://wiki.qemu.org/ChangeLog/7.1
for any user-visible changes.
Should be https://wiki.qemu.org/ChangeLog/8.0 of course -- I forgot I hadn't updated my canned email text...
-- PMM