Skip to content

Commit 48804ee

Browse files
committed
Merge tag 'pull-misc-2022-12-14' of https://repo.or.cz/qemu/armbru into staging
Miscellaneous patches for 2022-12-14 # gpg: Signature made Wed 14 Dec 2022 15:23:02 GMT # gpg: using RSA key 354BC8B3D7EB2A6B68674E5F3870B400EB918653 # gpg: issuer "[email protected]" # gpg: Good signature from "Markus Armbruster <[email protected]>" [full] # gpg: aka "Markus Armbruster <[email protected]>" [full] # Primary key fingerprint: 354B C8B3 D7EB 2A6B 6867 4E5F 3870 B400 EB91 8653 * tag 'pull-misc-2022-12-14' of https://repo.or.cz/qemu/armbru: ppc4xx_sdram: Simplify sdram_ddr_size() to return block/vmdk: Simplify vmdk_co_create() to return directly cleanup: Tweak and re-run return_directly.cocci io: Tidy up fat-fingered parameter name qapi: Use returned bool to check for failure (again) sockets: Use ERRP_GUARD() where obviously appropriate qemu-config: Use ERRP_GUARD() where obviously appropriate qemu-config: Make config_parse_qdict() return bool monitor: Use ERRP_GUARD() in monitor_init() monitor: Simplify monitor_fd_param()'s error handling error: Move ERRP_GUARD() to the beginning of the function error: Drop a few superfluous ERRP_GUARD() error: Drop some obviously superfluous error_propagate() Drop more useless casts from void * to pointer Signed-off-by: Peter Maydell <[email protected]>
2 parents ae2b873 + 6c5aaee commit 48804ee

Some content is hidden

Large Commits have some content hidden by default. Use the searchbox below for content that may be hidden.

70 files changed

+188
-407
lines changed

accel/kvm/kvm-all.c

+1-4
Original file line numberDiff line numberDiff line change
@@ -3586,17 +3586,14 @@ static void kvm_set_dirty_ring_size(Object *obj, Visitor *v,
35863586
Error **errp)
35873587
{
35883588
KVMState *s = KVM_STATE(obj);
3589-
Error *error = NULL;
35903589
uint32_t value;
35913590

35923591
if (s->fd != -1) {
35933592
error_setg(errp, "Cannot set properties after the accelerator has been initialized");
35943593
return;
35953594
}
35963595

3597-
visit_type_uint32(v, name, &value, &error);
3598-
if (error) {
3599-
error_propagate(errp, error);
3596+
if (!visit_type_uint32(v, name, &value, errp)) {
36003597
return;
36013598
}
36023599
if (value & (value - 1)) {

block/blkdebug.c

+1-3
Original file line numberDiff line numberDiff line change
@@ -297,9 +297,7 @@ static int read_config(BDRVBlkdebugState *s, const char *filename,
297297
}
298298
}
299299

300-
qemu_config_parse_qdict(options, config_groups, &local_err);
301-
if (local_err) {
302-
error_propagate(errp, local_err);
300+
if (!qemu_config_parse_qdict(options, config_groups, errp)) {
303301
ret = -EINVAL;
304302
goto fail;
305303
}

block/copy-before-write.c

-1
Original file line numberDiff line numberDiff line change
@@ -522,7 +522,6 @@ BlockDriverState *bdrv_cbw_append(BlockDriverState *source,
522522
BlockCopyState **bcs,
523523
Error **errp)
524524
{
525-
ERRP_GUARD();
526525
BDRVCopyBeforeWriteState *state;
527526
BlockDriverState *top;
528527
QDict *opts;

block/vmdk.c

+11-17
Original file line numberDiff line numberDiff line change
@@ -2821,32 +2821,26 @@ static BlockBackend *vmdk_co_create_cb(int64_t size, int idx,
28212821
static int coroutine_fn vmdk_co_create(BlockdevCreateOptions *create_options,
28222822
Error **errp)
28232823
{
2824-
int ret;
28252824
BlockdevCreateOptionsVmdk *opts;
28262825

28272826
opts = &create_options->u.vmdk;
28282827

28292828
/* Validate options */
28302829
if (!QEMU_IS_ALIGNED(opts->size, BDRV_SECTOR_SIZE)) {
28312830
error_setg(errp, "Image size must be a multiple of 512 bytes");
2832-
ret = -EINVAL;
2833-
goto out;
2831+
return -EINVAL;
28342832
}
28352833

2836-
ret = vmdk_co_do_create(opts->size,
2837-
opts->subformat,
2838-
opts->adapter_type,
2839-
opts->backing_file,
2840-
opts->hwversion,
2841-
opts->toolsversion,
2842-
false,
2843-
opts->zeroed_grain,
2844-
vmdk_co_create_cb,
2845-
opts, errp);
2846-
return ret;
2847-
2848-
out:
2849-
return ret;
2834+
return vmdk_co_do_create(opts->size,
2835+
opts->subformat,
2836+
opts->adapter_type,
2837+
opts->backing_file,
2838+
opts->hwversion,
2839+
opts->toolsversion,
2840+
false,
2841+
opts->zeroed_grain,
2842+
vmdk_co_create_cb,
2843+
opts, errp);
28502844
}
28512845

28522846
static void vmdk_close(BlockDriverState *bs)

bsd-user/elfload.c

+1-1
Original file line numberDiff line numberDiff line change
@@ -156,7 +156,7 @@ static abi_ulong copy_elf_strings(int argc, char **argv, void **page,
156156
--p; --tmp; --len;
157157
if (--offset < 0) {
158158
offset = p % TARGET_PAGE_SIZE;
159-
pag = (char *)page[p / TARGET_PAGE_SIZE];
159+
pag = page[p / TARGET_PAGE_SIZE];
160160
if (!pag) {
161161
pag = g_try_malloc0(TARGET_PAGE_SIZE);
162162
page[p / TARGET_PAGE_SIZE] = pag;

contrib/plugins/cache.c

+4-4
Original file line numberDiff line numberDiff line change
@@ -405,7 +405,7 @@ static void vcpu_mem_access(unsigned int vcpu_index, qemu_plugin_meminfo_t info,
405405
g_mutex_lock(&l1_dcache_locks[cache_idx]);
406406
hit_in_l1 = access_cache(l1_dcaches[cache_idx], effective_addr);
407407
if (!hit_in_l1) {
408-
insn = (InsnData *) userdata;
408+
insn = userdata;
409409
__atomic_fetch_add(&insn->l1_dmisses, 1, __ATOMIC_SEQ_CST);
410410
l1_dcaches[cache_idx]->misses++;
411411
}
@@ -419,7 +419,7 @@ static void vcpu_mem_access(unsigned int vcpu_index, qemu_plugin_meminfo_t info,
419419

420420
g_mutex_lock(&l2_ucache_locks[cache_idx]);
421421
if (!access_cache(l2_ucaches[cache_idx], effective_addr)) {
422-
insn = (InsnData *) userdata;
422+
insn = userdata;
423423
__atomic_fetch_add(&insn->l2_misses, 1, __ATOMIC_SEQ_CST);
424424
l2_ucaches[cache_idx]->misses++;
425425
}
@@ -440,7 +440,7 @@ static void vcpu_insn_exec(unsigned int vcpu_index, void *userdata)
440440
g_mutex_lock(&l1_icache_locks[cache_idx]);
441441
hit_in_l1 = access_cache(l1_icaches[cache_idx], insn_addr);
442442
if (!hit_in_l1) {
443-
insn = (InsnData *) userdata;
443+
insn = userdata;
444444
__atomic_fetch_add(&insn->l1_imisses, 1, __ATOMIC_SEQ_CST);
445445
l1_icaches[cache_idx]->misses++;
446446
}
@@ -454,7 +454,7 @@ static void vcpu_insn_exec(unsigned int vcpu_index, void *userdata)
454454

455455
g_mutex_lock(&l2_ucache_locks[cache_idx]);
456456
if (!access_cache(l2_ucaches[cache_idx], insn_addr)) {
457-
insn = (InsnData *) userdata;
457+
insn = userdata;
458458
__atomic_fetch_add(&insn->l2_misses, 1, __ATOMIC_SEQ_CST);
459459
l2_ucaches[cache_idx]->misses++;
460460
}

contrib/vhost-user-blk/vhost-user-blk.c

+1-1
Original file line numberDiff line numberDiff line change
@@ -193,7 +193,7 @@ vub_discard_write_zeroes(VubReq *req, struct iovec *iov, uint32_t iovcnt,
193193

194194
#if defined(__linux__) && defined(BLKDISCARD) && defined(BLKZEROOUT)
195195
VubDev *vdev_blk = req->vdev_blk;
196-
desc = (struct virtio_blk_discard_write_zeroes *)buf;
196+
desc = buf;
197197
uint64_t range[2] = { le64toh(desc->sector) << 9,
198198
le32toh(desc->num_sectors) << 9 };
199199
if (type == VIRTIO_BLK_T_DISCARD) {

dump/dump.c

-2
Original file line numberDiff line numberDiff line change
@@ -357,7 +357,6 @@ static void write_elf32_notes(WriteCoreDumpFunction f, DumpState *s,
357357

358358
static void write_elf_phdr_note(DumpState *s, Error **errp)
359359
{
360-
ERRP_GUARD();
361360
Elf32_Phdr phdr32;
362361
Elf64_Phdr phdr64;
363362
void *phdr;
@@ -773,7 +772,6 @@ static void dump_iterate(DumpState *s, Error **errp)
773772
static void dump_end(DumpState *s, Error **errp)
774773
{
775774
int rc;
776-
ERRP_GUARD();
777775

778776
if (s->elf_section_data_size) {
779777
s->elf_section_data = g_malloc0(s->elf_section_data_size);

hw/9pfs/9p-synth.c

+4-10
Original file line numberDiff line numberDiff line change
@@ -72,7 +72,6 @@ static V9fsSynthNode *v9fs_add_dir_node(V9fsSynthNode *parent, int mode,
7272
int qemu_v9fs_synth_mkdir(V9fsSynthNode *parent, int mode,
7373
const char *name, V9fsSynthNode **result)
7474
{
75-
int ret;
7675
V9fsSynthNode *node, *tmp;
7776

7877
if (!synth_fs) {
@@ -87,8 +86,7 @@ int qemu_v9fs_synth_mkdir(V9fsSynthNode *parent, int mode,
8786
QEMU_LOCK_GUARD(&synth_mutex);
8887
QLIST_FOREACH(tmp, &parent->child, sibling) {
8988
if (!strcmp(tmp->name, name)) {
90-
ret = EEXIST;
91-
return ret;
89+
return EEXIST;
9290
}
9391
}
9492
/* Add the name */
@@ -98,15 +96,13 @@ int qemu_v9fs_synth_mkdir(V9fsSynthNode *parent, int mode,
9896
v9fs_add_dir_node(node, node->attr->mode, ".",
9997
node->attr, node->attr->inode);
10098
*result = node;
101-
ret = 0;
102-
return ret;
99+
return 0;
103100
}
104101

105102
int qemu_v9fs_synth_add_file(V9fsSynthNode *parent, int mode,
106103
const char *name, v9fs_synth_read read,
107104
v9fs_synth_write write, void *arg)
108105
{
109-
int ret;
110106
V9fsSynthNode *node, *tmp;
111107

112108
if (!synth_fs) {
@@ -122,8 +118,7 @@ int qemu_v9fs_synth_add_file(V9fsSynthNode *parent, int mode,
122118
QEMU_LOCK_GUARD(&synth_mutex);
123119
QLIST_FOREACH(tmp, &parent->child, sibling) {
124120
if (!strcmp(tmp->name, name)) {
125-
ret = EEXIST;
126-
return ret;
121+
return EEXIST;
127122
}
128123
}
129124
/* Add file type and remove write bits */
@@ -138,8 +133,7 @@ int qemu_v9fs_synth_add_file(V9fsSynthNode *parent, int mode,
138133
node->private = arg;
139134
pstrcpy(node->name, sizeof(node->name), name);
140135
QLIST_INSERT_HEAD_RCU(&parent->child, node, sibling);
141-
ret = 0;
142-
return ret;
136+
return 0;
143137
}
144138

145139
static void synth_fill_statbuf(V9fsSynthNode *node, struct stat *stbuf)

hw/arm/armsse.c

+1-2
Original file line numberDiff line numberDiff line change
@@ -900,6 +900,7 @@ static qemu_irq armsse_get_common_irq_in(ARMSSE *s, int irqno)
900900

901901
static void armsse_realize(DeviceState *dev, Error **errp)
902902
{
903+
ERRP_GUARD();
903904
ARMSSE *s = ARM_SSE(dev);
904905
ARMSSEClass *asc = ARM_SSE_GET_CLASS(dev);
905906
const ARMSSEInfo *info = asc->info;
@@ -914,8 +915,6 @@ static void armsse_realize(DeviceState *dev, Error **errp)
914915
DeviceState *dev_splitter;
915916
uint32_t addr_width_max;
916917

917-
ERRP_GUARD();
918-
919918
if (!s->board_memory) {
920919
error_setg(errp, "memory property was not set");
921920
return;

hw/arm/virt.c

+5-9
Original file line numberDiff line numberDiff line change
@@ -2771,24 +2771,20 @@ static void virt_dimm_unplug_request(HotplugHandler *hotplug_dev,
27712771
DeviceState *dev, Error **errp)
27722772
{
27732773
VirtMachineState *vms = VIRT_MACHINE(hotplug_dev);
2774-
Error *local_err = NULL;
27752774

27762775
if (!vms->acpi_dev) {
2777-
error_setg(&local_err,
2776+
error_setg(errp,
27782777
"memory hotplug is not enabled: missing acpi-ged device");
2779-
goto out;
2778+
return;
27802779
}
27812780

27822781
if (object_dynamic_cast(OBJECT(dev), TYPE_NVDIMM)) {
2783-
error_setg(&local_err,
2784-
"nvdimm device hot unplug is not supported yet.");
2785-
goto out;
2782+
error_setg(errp, "nvdimm device hot unplug is not supported yet.");
2783+
return;
27862784
}
27872785

27882786
hotplug_handler_unplug_request(HOTPLUG_HANDLER(vms->acpi_dev), dev,
2789-
&local_err);
2790-
out:
2791-
error_propagate(errp, local_err);
2787+
errp);
27922788
}
27932789

27942790
static void virt_dimm_unplug(HotplugHandler *hotplug_dev,

hw/char/sifive_uart.c

+1-3
Original file line numberDiff line numberDiff line change
@@ -274,7 +274,6 @@ SiFiveUARTState *sifive_uart_create(MemoryRegion *address_space, hwaddr base,
274274
{
275275
DeviceState *dev;
276276
SysBusDevice *s;
277-
SiFiveUARTState *r;
278277

279278
dev = qdev_new("riscv.sifive.uart");
280279
s = SYS_BUS_DEVICE(dev);
@@ -284,6 +283,5 @@ SiFiveUARTState *sifive_uart_create(MemoryRegion *address_space, hwaddr base,
284283
sysbus_mmio_get_region(s, 0));
285284
sysbus_connect_irq(s, 0, irq);
286285

287-
r = SIFIVE_UART(dev);
288-
return r;
286+
return SIFIVE_UART(dev);
289287
}

hw/core/machine.c

+1-2
Original file line numberDiff line numberDiff line change
@@ -554,12 +554,11 @@ static void machine_get_mem(Object *obj, Visitor *v, const char *name,
554554
static void machine_set_mem(Object *obj, Visitor *v, const char *name,
555555
void *opaque, Error **errp)
556556
{
557+
ERRP_GUARD();
557558
MachineState *ms = MACHINE(obj);
558559
MachineClass *mc = MACHINE_GET_CLASS(obj);
559560
MemorySizeConfiguration *mem;
560561

561-
ERRP_GUARD();
562-
563562
if (!visit_type_MemorySizeConfiguration(v, name, &mem, errp)) {
564563
return;
565564
}

hw/core/qdev-clock.c

+1-1
Original file line numberDiff line numberDiff line change
@@ -134,7 +134,7 @@ void qdev_init_clocks(DeviceState *dev, const ClockPortInitArray clocks)
134134
Clock **clkp;
135135
/* offset cannot be inside the DeviceState part */
136136
assert(elem->offset > sizeof(DeviceState));
137-
clkp = (Clock **)(((void *) dev) + elem->offset);
137+
clkp = ((void *)dev) + elem->offset;
138138
if (elem->is_output) {
139139
*clkp = qdev_init_clock_out(dev, elem->name);
140140
} else {

hw/core/qdev-properties-system.c

+1-4
Original file line numberDiff line numberDiff line change
@@ -679,14 +679,11 @@ static void set_reserved_region(Object *obj, Visitor *v, const char *name,
679679
{
680680
Property *prop = opaque;
681681
ReservedRegion *rr = object_field_prop_ptr(obj, prop);
682-
Error *local_err = NULL;
683682
const char *endptr;
684683
char *str;
685684
int ret;
686685

687-
visit_type_str(v, name, &str, &local_err);
688-
if (local_err) {
689-
error_propagate(errp, local_err);
686+
if (!visit_type_str(v, name, &str, errp)) {
690687
return;
691688
}
692689

hw/core/qdev.c

-2
Original file line numberDiff line numberDiff line change
@@ -493,8 +493,6 @@ void qdev_del_unplug_blocker(DeviceState *dev, Error *reason)
493493

494494
bool qdev_unplug_blocked(DeviceState *dev, Error **errp)
495495
{
496-
ERRP_GUARD();
497-
498496
if (dev->unplug_blockers) {
499497
error_propagate(errp, error_copy(dev->unplug_blockers->data));
500498
return true;

hw/hyperv/vmbus.c

+4-6
Original file line numberDiff line numberDiff line change
@@ -2104,7 +2104,7 @@ static void process_message(VMBus *vmbus)
21042104
goto out;
21052105
}
21062106
msgdata = hv_msg->payload;
2107-
msg = (struct vmbus_message_header *)msgdata;
2107+
msg = msgdata;
21082108

21092109
trace_vmbus_process_incoming_message(msg->message_type);
21102110

@@ -2404,7 +2404,6 @@ static const TypeInfo vmbus_dev_type_info = {
24042404
static void vmbus_realize(BusState *bus, Error **errp)
24052405
{
24062406
int ret = 0;
2407-
Error *local_err = NULL;
24082407
VMBus *vmbus = VMBUS(bus);
24092408

24102409
qemu_mutex_init(&vmbus->rx_queue_lock);
@@ -2415,21 +2414,21 @@ static void vmbus_realize(BusState *bus, Error **errp)
24152414
ret = hyperv_set_msg_handler(VMBUS_MESSAGE_CONNECTION_ID,
24162415
vmbus_recv_message, vmbus);
24172416
if (ret != 0) {
2418-
error_setg(&local_err, "hyperv set message handler failed: %d", ret);
2417+
error_setg(errp, "hyperv set message handler failed: %d", ret);
24192418
goto error_out;
24202419
}
24212420

24222421
ret = event_notifier_init(&vmbus->notifier, 0);
24232422
if (ret != 0) {
2424-
error_setg(&local_err, "event notifier failed to init with %d", ret);
2423+
error_setg(errp, "event notifier failed to init with %d", ret);
24252424
goto remove_msg_handler;
24262425
}
24272426

24282427
event_notifier_set_handler(&vmbus->notifier, vmbus_signal_event);
24292428
ret = hyperv_set_event_flag_handler(VMBUS_EVENT_CONNECTION_ID,
24302429
&vmbus->notifier);
24312430
if (ret != 0) {
2432-
error_setg(&local_err, "hyperv set event handler failed with %d", ret);
2431+
error_setg(errp, "hyperv set event handler failed with %d", ret);
24332432
goto clear_event_notifier;
24342433
}
24352434

@@ -2441,7 +2440,6 @@ static void vmbus_realize(BusState *bus, Error **errp)
24412440
hyperv_set_msg_handler(VMBUS_MESSAGE_CONNECTION_ID, NULL, NULL);
24422441
error_out:
24432442
qemu_mutex_destroy(&vmbus->rx_queue_lock);
2444-
error_propagate(errp, local_err);
24452443
}
24462444

24472445
static void vmbus_unrealize(BusState *bus)

hw/i386/pc.c

+1-4
Original file line numberDiff line numberDiff line change
@@ -1782,12 +1782,9 @@ static void pc_machine_set_max_fw_size(Object *obj, Visitor *v,
17821782
Error **errp)
17831783
{
17841784
PCMachineState *pcms = PC_MACHINE(obj);
1785-
Error *error = NULL;
17861785
uint64_t value;
17871786

1788-
visit_type_size(v, name, &value, &error);
1789-
if (error) {
1790-
error_propagate(errp, error);
1787+
if (!visit_type_size(v, name, &value, errp)) {
17911788
return;
17921789
}
17931790

hw/net/cadence_gem.c

+1-1
Original file line numberDiff line numberDiff line change
@@ -1429,7 +1429,7 @@ static uint64_t gem_read(void *opaque, hwaddr offset, unsigned size)
14291429
{
14301430
CadenceGEMState *s;
14311431
uint32_t retval;
1432-
s = (CadenceGEMState *)opaque;
1432+
s = opaque;
14331433

14341434
offset >>= 2;
14351435
retval = s->regs[offset];

hw/net/virtio-net.c

+1-1
Original file line numberDiff line numberDiff line change
@@ -2471,7 +2471,7 @@ static size_t virtio_net_rsc_receive6(void *opq, NetClientState *nc,
24712471
VirtioNetRscChain *chain;
24722472
VirtioNetRscUnit unit;
24732473

2474-
chain = (VirtioNetRscChain *)opq;
2474+
chain = opq;
24752475
hdr_len = ((VirtIONet *)(chain->n))->guest_hdr_len;
24762476

24772477
if (size < (hdr_len + sizeof(struct eth_header) + sizeof(struct ip6_header)

0 commit comments

Comments
 (0)