diff options
Diffstat (limited to 'hw')
-rw-r--r-- | hw/acpi/core.c | 14 | ||||
-rw-r--r-- | hw/hyperv/vmbus.c | 5 | ||||
-rw-r--r-- | hw/i386/pc.c | 35 | ||||
-rw-r--r-- | hw/mem/nvdimm.c | 17 | ||||
-rw-r--r-- | hw/mem/pc-dimm.c | 14 | ||||
-rw-r--r-- | hw/misc/aspeed_sdmc.c | 3 | ||||
-rw-r--r-- | hw/ppc/rs6000_mc.c | 9 | ||||
-rw-r--r-- | hw/ppc/spapr.c | 73 | ||||
-rw-r--r-- | hw/ppc/spapr_pci.c | 14 | ||||
-rw-r--r-- | hw/s390x/ipl.c | 23 | ||||
-rw-r--r-- | hw/xen/xen_pt_config_init.c | 3 |
11 files changed, 87 insertions, 123 deletions
diff --git a/hw/acpi/core.c b/hw/acpi/core.c index 45cbed4..8b240c3 100644 --- a/hw/acpi/core.c +++ b/hw/acpi/core.c @@ -257,13 +257,13 @@ void acpi_table_add(const QemuOpts *opts, Error **errp) goto out; } if (hdrs->has_file == hdrs->has_data) { - error_setg(&err, "'-acpitable' requires one of 'data' or 'file'"); + error_setg(errp, "'-acpitable' requires one of 'data' or 'file'"); goto out; } pathnames = g_strsplit(hdrs->has_file ? hdrs->file : hdrs->data, ":", 0); if (pathnames == NULL || pathnames[0] == NULL) { - error_setg(&err, "'-acpitable' requires at least one pathname"); + error_setg(errp, "'-acpitable' requires at least one pathname"); goto out; } @@ -272,7 +272,7 @@ void acpi_table_add(const QemuOpts *opts, Error **errp) int fd = open(*cur, O_RDONLY | O_BINARY); if (fd < 0) { - error_setg(&err, "can't open file %s: %s", *cur, strerror(errno)); + error_setg(errp, "can't open file %s: %s", *cur, strerror(errno)); goto out; } @@ -288,8 +288,8 @@ void acpi_table_add(const QemuOpts *opts, Error **errp) memcpy(blob + bloblen, data, r); bloblen += r; } else if (errno != EINTR) { - error_setg(&err, "can't read file %s: %s", - *cur, strerror(errno)); + error_setg(errp, "can't read file %s: %s", *cur, + strerror(errno)); close(fd); goto out; } @@ -298,14 +298,12 @@ void acpi_table_add(const QemuOpts *opts, Error **errp) close(fd); } - acpi_table_install(blob, bloblen, hdrs->has_file, hdrs, &err); + acpi_table_install(blob, bloblen, hdrs->has_file, hdrs, errp); out: g_free(blob); g_strfreev(pathnames); qapi_free_AcpiTableOptions(hdrs); - - error_propagate(errp, err); } unsigned acpi_table_len(void *current) diff --git a/hw/hyperv/vmbus.c b/hw/hyperv/vmbus.c index a8bcb41..34392e8 100644 --- a/hw/hyperv/vmbus.c +++ b/hw/hyperv/vmbus.c @@ -1459,8 +1459,8 @@ static void create_channels(VMBus *vmbus, VMBusDevice *dev, Error **errp) dev->num_channels = vdc->num_channels ? vdc->num_channels(dev) : 1; if (dev->num_channels < 1) { - error_setg(&err, "invalid #channels: %u", dev->num_channels); - goto error_out; + error_setg(errp, "invalid #channels: %u", dev->num_channels); + return; } dev->channels = g_new0(VMBusChannel, dev->num_channels); @@ -1477,7 +1477,6 @@ err_init: while (i--) { deinit_channel(&dev->channels[i]); } -error_out: error_propagate(errp, err); } diff --git a/hw/i386/pc.c b/hw/i386/pc.c index 3e933b6..d1fed1b 100644 --- a/hw/i386/pc.c +++ b/hw/i386/pc.c @@ -1327,7 +1327,6 @@ out: static void pc_memory_unplug_request(HotplugHandler *hotplug_dev, DeviceState *dev, Error **errp) { - Error *local_err = NULL; PCMachineState *pcms = PC_MACHINE(hotplug_dev); /* @@ -1336,21 +1335,18 @@ static void pc_memory_unplug_request(HotplugHandler *hotplug_dev, * addition to cover this case. */ if (!pcms->acpi_dev || !x86_machine_is_acpi_enabled(X86_MACHINE(pcms))) { - error_setg(&local_err, + error_setg(errp, "memory hotplug is not enabled: missing acpi device or acpi disabled"); - 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(pcms->acpi_dev), dev, - &local_err); -out: - error_propagate(errp, local_err); + errp); } static void pc_memory_unplug(HotplugHandler *hotplug_dev, @@ -1430,31 +1426,23 @@ static void pc_cpu_unplug_request_cb(HotplugHandler *hotplug_dev, DeviceState *dev, Error **errp) { int idx = -1; - Error *local_err = NULL; X86CPU *cpu = X86_CPU(dev); PCMachineState *pcms = PC_MACHINE(hotplug_dev); if (!pcms->acpi_dev) { - error_setg(&local_err, "CPU hot unplug not supported without ACPI"); - goto out; + error_setg(errp, "CPU hot unplug not supported without ACPI"); + return; } pc_find_cpu_slot(MACHINE(pcms), cpu->apic_id, &idx); assert(idx != -1); if (idx == 0) { - error_setg(&local_err, "Boot CPU is unpluggable"); - goto out; + error_setg(errp, "Boot CPU is unpluggable"); + return; } hotplug_handler_unplug_request(HOTPLUG_HANDLER(pcms->acpi_dev), dev, - &local_err); - if (local_err) { - goto out; - } - - out: - error_propagate(errp, local_err); - + errp); } static void pc_cpu_unplug_cb(HotplugHandler *hotplug_dev, @@ -1867,10 +1855,9 @@ static void pc_machine_set_max_ram_below_4g(Object *obj, Visitor *v, return; } if (value > 4 * GiB) { - error_setg(&error, + error_setg(errp, "Machine option 'max-ram-below-4g=%"PRIu64 "' expects size less than or equal to 4G", value); - error_propagate(errp, error); return; } diff --git a/hw/mem/nvdimm.c b/hw/mem/nvdimm.c index 1fa976c..838ebcd 100644 --- a/hw/mem/nvdimm.c +++ b/hw/mem/nvdimm.c @@ -49,23 +49,22 @@ static void nvdimm_set_label_size(Object *obj, Visitor *v, const char *name, uint64_t value; if (nvdimm->nvdimm_mr) { - error_setg(&local_err, "cannot change property value"); - goto out; + error_setg(errp, "cannot change property value"); + return; } if (!visit_type_size(v, name, &value, &local_err)) { - goto out; + error_propagate(errp, local_err); + return; } if (value < MIN_NAMESPACE_LABEL_SIZE) { - error_setg(&local_err, "Property '%s.%s' (0x%" PRIx64 ") is required" - " at least 0x%lx", object_get_typename(obj), - name, value, MIN_NAMESPACE_LABEL_SIZE); - goto out; + error_setg(errp, "Property '%s.%s' (0x%" PRIx64 ") is required" + " at least 0x%lx", object_get_typename(obj), name, value, + MIN_NAMESPACE_LABEL_SIZE); + return; } nvdimm->label_size = value; -out: - error_propagate(errp, local_err); } static void nvdimm_get_uuid(Object *obj, Visitor *v, const char *name, diff --git a/hw/mem/pc-dimm.c b/hw/mem/pc-dimm.c index 8a075fb..9d3f0b9 100644 --- a/hw/mem/pc-dimm.c +++ b/hw/mem/pc-dimm.c @@ -44,24 +44,24 @@ void pc_dimm_pre_plug(PCDIMMDevice *dimm, MachineState *machine, &error_abort); if ((slot < 0 || slot >= machine->ram_slots) && slot != PC_DIMM_UNASSIGNED_SLOT) { - error_setg(&local_err, "invalid slot number %d, valid range is [0-%" - PRIu64 "]", slot, machine->ram_slots - 1); - goto out; + error_setg(errp, + "invalid slot number %d, valid range is [0-%" PRIu64 "]", + slot, machine->ram_slots - 1); + return; } slot = pc_dimm_get_free_slot(slot == PC_DIMM_UNASSIGNED_SLOT ? NULL : &slot, machine->ram_slots, &local_err); if (local_err) { - goto out; + error_propagate(errp, local_err); + return; } object_property_set_int(OBJECT(dimm), PC_DIMM_SLOT_PROP, slot, &error_abort); trace_mhp_pc_dimm_assigned_slot(slot); memory_device_pre_plug(MEMORY_DEVICE(dimm), machine, legacy_align, - &local_err); -out: - error_propagate(errp, local_err); + errp); } void pc_dimm_plug(PCDIMMDevice *dimm, MachineState *machine, Error **errp) diff --git a/hw/misc/aspeed_sdmc.c b/hw/misc/aspeed_sdmc.c index 2887444..40682af 100644 --- a/hw/misc/aspeed_sdmc.c +++ b/hw/misc/aspeed_sdmc.c @@ -240,9 +240,8 @@ static void aspeed_sdmc_set_ram_size(Object *obj, Visitor *v, const char *name, } sz = size_to_str(value); - error_setg(&local_err, "Invalid RAM size %s", sz); + error_setg(errp, "Invalid RAM size %s", sz); g_free(sz); - error_propagate(errp, local_err); } static void aspeed_sdmc_initfn(Object *obj) diff --git a/hw/ppc/rs6000_mc.c b/hw/ppc/rs6000_mc.c index f8a498b..ce97365 100644 --- a/hw/ppc/rs6000_mc.c +++ b/hw/ppc/rs6000_mc.c @@ -169,7 +169,8 @@ static void rs6000mc_realize(DeviceState *dev, Error **errp) memory_region_init_ram(&s->simm[socket], OBJECT(dev), name, s->simm_size[socket] * MiB, &local_err); if (local_err) { - goto out; + error_propagate(errp, local_err); + return; } memory_region_add_subregion_overlap(get_system_memory(), 0, &s->simm[socket], socket); @@ -177,10 +178,10 @@ static void rs6000mc_realize(DeviceState *dev, Error **errp) } if (ram_size) { /* unable to push all requested RAM in SIMMs */ - error_setg(&local_err, "RAM size incompatible with this board. " + error_setg(errp, "RAM size incompatible with this board. " "Try again with something else, like %" PRId64 " MB", s->ram_size / MiB - ram_size); - goto out; + return; } if (s->autoconfigure) { @@ -196,8 +197,6 @@ static void rs6000mc_realize(DeviceState *dev, Error **errp) isa_register_portio_list(ISA_DEVICE(dev), &s->portio, 0x0, rs6000mc_port_list, s, "rs6000mc"); -out: - error_propagate(errp, local_err); } static const VMStateDescription vmstate_rs6000mc = { diff --git a/hw/ppc/spapr.c b/hw/ppc/spapr.c index 68e8b50..299908c 100644 --- a/hw/ppc/spapr.c +++ b/hw/ppc/spapr.c @@ -2497,23 +2497,23 @@ static void spapr_set_vsmt_mode(SpaprMachineState *spapr, Error **errp) unsigned int smp_threads = ms->smp.threads; if (!kvm_enabled() && (smp_threads > 1)) { - error_setg(&local_err, "TCG cannot support more than 1 thread/core " - "on a pseries machine"); - goto out; + error_setg(errp, "TCG cannot support more than 1 thread/core " + "on a pseries machine"); + return; } if (!is_power_of_2(smp_threads)) { - error_setg(&local_err, "Cannot support %d threads/core on a pseries " - "machine because it must be a power of 2", smp_threads); - goto out; + error_setg(errp, "Cannot support %d threads/core on a pseries " + "machine because it must be a power of 2", smp_threads); + return; } /* Detemine the VSMT mode to use: */ if (vsmt_user) { if (spapr->vsmt < smp_threads) { - error_setg(&local_err, "Cannot support VSMT mode %d" - " because it must be >= threads/core (%d)", - spapr->vsmt, smp_threads); - goto out; + error_setg(errp, "Cannot support VSMT mode %d" + " because it must be >= threads/core (%d)", + spapr->vsmt, smp_threads); + return; } /* In this case, spapr->vsmt has been set by the command line */ } else if (!smc->smp_threads_vsmt) { @@ -2543,8 +2543,6 @@ static void spapr_set_vsmt_mode(SpaprMachineState *spapr, Error **errp) * behaviour will be correct */ if ((kvm_smt >= smp_threads) && ((spapr->vsmt % kvm_smt) == 0)) { warn_report_err(local_err); - local_err = NULL; - goto out; } else { if (!vsmt_user) { error_append_hint(&local_err, @@ -2554,13 +2552,11 @@ static void spapr_set_vsmt_mode(SpaprMachineState *spapr, Error **errp) smp_threads, kvm_smt, spapr->vsmt); } kvmppc_error_append_smt_possible_hint(&local_err); - goto out; + error_propagate(errp, local_err); } } } /* else TCG: nothing to do currently */ -out: - error_propagate(errp, local_err); } static void spapr_init_cpus(SpaprMachineState *spapr) @@ -3686,9 +3682,8 @@ static void spapr_memory_unplug_request(HotplugHandler *hotplug_dev, SpaprDrc *drc; 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; } size = memory_device_get_region_size(MEMORY_DEVICE(dimm), &error_abort); @@ -3697,7 +3692,8 @@ static void spapr_memory_unplug_request(HotplugHandler *hotplug_dev, addr_start = object_property_get_uint(OBJECT(dimm), PC_DIMM_ADDR_PROP, &local_err); if (local_err) { - goto out; + error_propagate(errp, local_err); + return; } /* @@ -3707,10 +3703,9 @@ static void spapr_memory_unplug_request(HotplugHandler *hotplug_dev, * bail out to avoid detaching DRCs that were already released. */ if (spapr_pending_dimm_unplugs_find(spapr, dimm)) { - error_setg(&local_err, - "Memory unplug already in progress for device %s", + error_setg(errp, "Memory unplug already in progress for device %s", dev->id); - goto out; + return; } spapr_pending_dimm_unplugs_add(spapr, nr_lmbs, dimm); @@ -3729,8 +3724,6 @@ static void spapr_memory_unplug_request(HotplugHandler *hotplug_dev, addr_start / SPAPR_MEMORY_BLOCK_SIZE); spapr_hotplug_req_remove_by_count_indexed(SPAPR_DR_CONNECTOR_TYPE_LMB, nr_lmbs, spapr_drc_index(drc)); -out: - error_propagate(errp, local_err); } /* Callback to be called during DRC release. */ @@ -3891,7 +3884,6 @@ static void spapr_core_pre_plug(HotplugHandler *hotplug_dev, DeviceState *dev, { MachineState *machine = MACHINE(OBJECT(hotplug_dev)); MachineClass *mc = MACHINE_GET_CLASS(hotplug_dev); - Error *local_err = NULL; CPUCore *cc = CPU_CORE(dev); const char *base_core_type = spapr_get_cpu_core_type(machine->cpu_type); const char *type = object_get_typename(OBJECT(dev)); @@ -3900,18 +3892,18 @@ static void spapr_core_pre_plug(HotplugHandler *hotplug_dev, DeviceState *dev, unsigned int smp_threads = machine->smp.threads; if (dev->hotplugged && !mc->has_hotpluggable_cpus) { - error_setg(&local_err, "CPU hotplug not supported for this machine"); - goto out; + error_setg(errp, "CPU hotplug not supported for this machine"); + return; } if (strcmp(base_core_type, type)) { - error_setg(&local_err, "CPU core type should be %s", base_core_type); - goto out; + error_setg(errp, "CPU core type should be %s", base_core_type); + return; } if (cc->core_id % smp_threads) { - error_setg(&local_err, "invalid core id %d", cc->core_id); - goto out; + error_setg(errp, "invalid core id %d", cc->core_id); + return; } /* @@ -3921,26 +3913,23 @@ static void spapr_core_pre_plug(HotplugHandler *hotplug_dev, DeviceState *dev, * total vcpus not a multiple of threads-per-core. */ if (mc->has_hotpluggable_cpus && (cc->nr_threads != smp_threads)) { - error_setg(&local_err, "invalid nr-threads %d, must be %d", - cc->nr_threads, smp_threads); - goto out; + error_setg(errp, "invalid nr-threads %d, must be %d", cc->nr_threads, + smp_threads); + return; } core_slot = spapr_find_cpu_slot(MACHINE(hotplug_dev), cc->core_id, &index); if (!core_slot) { - error_setg(&local_err, "core id %d out of range", cc->core_id); - goto out; + error_setg(errp, "core id %d out of range", cc->core_id); + return; } if (core_slot->cpu) { - error_setg(&local_err, "core %d already populated", cc->core_id); - goto out; + error_setg(errp, "core %d already populated", cc->core_id); + return; } - numa_cpu_pre_plug(core_slot, dev, &local_err); - -out: - error_propagate(errp, local_err); + numa_cpu_pre_plug(core_slot, dev, errp); } int spapr_phb_dt_populate(SpaprDrc *drc, SpaprMachineState *spapr, diff --git a/hw/ppc/spapr_pci.c b/hw/ppc/spapr_pci.c index 223bb8f..2a6a487 100644 --- a/hw/ppc/spapr_pci.c +++ b/hw/ppc/spapr_pci.c @@ -1499,10 +1499,10 @@ static void spapr_pci_plug(HotplugHandler *plug_handler, * we need to let them know it's not enabled */ if (plugged_dev->hotplugged) { - error_setg(&local_err, QERR_BUS_NO_HOTPLUG, + error_setg(errp, QERR_BUS_NO_HOTPLUG, object_get_typename(OBJECT(phb))); } - goto out; + return; } g_assert(drc); @@ -1517,15 +1517,16 @@ static void spapr_pci_plug(HotplugHandler *plug_handler, */ if (plugged_dev->hotplugged && bus->devices[PCI_DEVFN(slotnr, 0)] && PCI_FUNC(pdev->devfn) != 0) { - error_setg(&local_err, "PCI: slot %d function 0 already ocuppied by %s," + error_setg(errp, "PCI: slot %d function 0 already ocuppied by %s," " additional functions can no longer be exposed to guest.", slotnr, bus->devices[PCI_DEVFN(slotnr, 0)]->name); - goto out; + return; } spapr_drc_attach(drc, DEVICE(pdev), &local_err); if (local_err) { - goto out; + error_propagate(errp, local_err); + return; } /* If this is function 0, signal hotplug for all the device functions. @@ -1551,9 +1552,6 @@ static void spapr_pci_plug(HotplugHandler *plug_handler, } } } - -out: - error_propagate(errp, local_err); } static void spapr_pci_bridge_unplug(SpaprPhbState *phb, diff --git a/hw/s390x/ipl.c b/hw/s390x/ipl.c index 7c893e5..d46b1f0 100644 --- a/hw/s390x/ipl.c +++ b/hw/s390x/ipl.c @@ -117,7 +117,6 @@ static void s390_ipl_realize(DeviceState *dev, Error **errp) uint64_t pentry; char *magic; int kernel_size; - Error *err = NULL; int bios_size; char *bios_filename; @@ -135,8 +134,8 @@ static void s390_ipl_realize(DeviceState *dev, Error **errp) bios_filename = qemu_find_file(QEMU_FILE_TYPE_BIOS, bios_name); if (bios_filename == NULL) { - error_setg(&err, "could not find stage1 bootloader"); - goto error; + error_setg(errp, "could not find stage1 bootloader"); + return; } bios_size = load_elf(bios_filename, NULL, @@ -155,8 +154,8 @@ static void s390_ipl_realize(DeviceState *dev, Error **errp) g_free(bios_filename); if (bios_size == -1) { - error_setg(&err, "could not load bootloader '%s'", bios_name); - goto error; + error_setg(errp, "could not load bootloader '%s'", bios_name); + return; } /* default boot target is the bios */ @@ -170,8 +169,8 @@ static void s390_ipl_realize(DeviceState *dev, Error **errp) if (kernel_size < 0) { kernel_size = load_image_targphys(ipl->kernel, 0, ram_size); if (kernel_size < 0) { - error_setg(&err, "could not load kernel '%s'", ipl->kernel); - goto error; + error_setg(errp, "could not load kernel '%s'", ipl->kernel); + return; } /* if this is Linux use KERN_IMAGE_START */ magic = rom_ptr(LINUX_MAGIC_ADDR, 6); @@ -183,8 +182,8 @@ static void s390_ipl_realize(DeviceState *dev, Error **errp) if (ipl_psw) { pentry = be32_to_cpu(*ipl_psw) & PSW_MASK_SHORT_ADDR; } else { - error_setg(&err, "Could not get IPL PSW"); - goto error; + error_setg(errp, "Could not get IPL PSW"); + return; } } } @@ -217,8 +216,8 @@ static void s390_ipl_realize(DeviceState *dev, Error **errp) initrd_size = load_image_targphys(ipl->initrd, initrd_offset, ram_size - initrd_offset); if (initrd_size == -1) { - error_setg(&err, "could not load initrd '%s'", ipl->initrd); - goto error; + error_setg(errp, "could not load initrd '%s'", ipl->initrd); + return; } /* @@ -248,8 +247,6 @@ static void s390_ipl_realize(DeviceState *dev, Error **errp) * TODO: there should be a better way to do this. */ qemu_register_reset(resettable_cold_reset_fn, dev); -error: - error_propagate(errp, err); } static Property s390_ipl_properties[] = { diff --git a/hw/xen/xen_pt_config_init.c b/hw/xen/xen_pt_config_init.c index 31ec5ad..d0d7c72 100644 --- a/hw/xen/xen_pt_config_init.c +++ b/hw/xen/xen_pt_config_init.c @@ -2052,10 +2052,9 @@ void xen_pt_config_init(XenPCIPassthroughState *s, Error **errp) reg_grp_offset, ®_grp_entry->size); if (rc < 0) { - error_setg(&err, "Failed to initialize %d/%zu, type = 0x%x," + error_setg(errp, "Failed to initialize %d/%zu, type = 0x%x," " rc: %d", i, ARRAY_SIZE(xen_pt_emu_reg_grps), xen_pt_emu_reg_grps[i].grp_type, rc); - error_propagate(errp, err); xen_pt_config_delete(s); return; } |