diff --git a/arch_init.c b/arch_init.c index 89c8fa46bb6087b953600a54c89ee9b9f36891c6..8414726e30870ee355d019a95e16051e1d51abaf 100644 --- a/arch_init.c +++ b/arch_init.c @@ -1093,8 +1093,7 @@ static int ram_load(QEMUFile *f, void *opaque, int version_id) ret = qemu_ram_resize(block->offset, length, &local_err); if (local_err) { - error_report("%s", error_get_pretty(local_err)); - error_free(local_err); + error_report_err(local_err); } } break; diff --git a/block/sheepdog.c b/block/sheepdog.c index be3176fcb4d25bd4ebf36e6b288cfde4ce3706c0..6a4a3bd0953247e0aff480bc01e889274c8cd21c 100644 --- a/block/sheepdog.c +++ b/block/sheepdog.c @@ -726,8 +726,7 @@ static coroutine_fn void reconnect_to_sdog(void *opaque) s->fd = get_sheep_fd(s, &local_err); if (s->fd < 0) { DPRINTF("Wait for connection to be established\n"); - error_report("%s", error_get_pretty(local_err)); - error_free(local_err); + error_report_err(local_err); co_aio_sleep_ns(bdrv_get_aio_context(s->bs), QEMU_CLOCK_REALTIME, 1000000000ULL); } @@ -1283,8 +1282,7 @@ static int reload_inode(BDRVSheepdogState *s, uint32_t snapid, const char *tag) fd = connect_to_sdog(s, &local_err); if (fd < 0) { - error_report("%s", error_get_pretty(local_err));; - error_free(local_err); + error_report_err(local_err); return -EIO; } @@ -1292,8 +1290,7 @@ static int reload_inode(BDRVSheepdogState *s, uint32_t snapid, const char *tag) ret = find_vdi_name(s, s->name, snapid, tag, &vid, false, &local_err); if (ret) { - error_report("%s", error_get_pretty(local_err));; - error_free(local_err); + error_report_err(local_err); goto out; } @@ -1785,8 +1782,7 @@ static void sd_close(BlockDriverState *bs) fd = connect_to_sdog(s, &local_err); if (fd < 0) { - error_report("%s", error_get_pretty(local_err));; - error_free(local_err); + error_report_err(local_err); return; } @@ -1838,8 +1834,7 @@ static int sd_truncate(BlockDriverState *bs, int64_t offset) fd = connect_to_sdog(s, &local_err); if (fd < 0) { - error_report("%s", error_get_pretty(local_err));; - error_free(local_err); + error_report_err(local_err); return fd; } @@ -1912,8 +1907,7 @@ static bool sd_delete(BDRVSheepdogState *s) fd = connect_to_sdog(s, &local_err); if (fd < 0) { - error_report("%s", error_get_pretty(local_err));; - error_free(local_err); + error_report_err(local_err); return false; } @@ -1960,8 +1954,7 @@ static int sd_create_branch(BDRVSheepdogState *s) deleted = sd_delete(s); ret = do_sd_create(s, &vid, !deleted, &local_err); if (ret) { - error_report("%s", error_get_pretty(local_err));; - error_free(local_err); + error_report_err(local_err); goto out; } @@ -1969,8 +1962,7 @@ static int sd_create_branch(BDRVSheepdogState *s) fd = connect_to_sdog(s, &local_err); if (fd < 0) { - error_report("%s", error_get_pretty(local_err));; - error_free(local_err); + error_report_err(local_err); ret = fd; goto out; } @@ -2218,8 +2210,7 @@ static int sd_snapshot_create(BlockDriverState *bs, QEMUSnapshotInfo *sn_info) /* refresh inode. */ fd = connect_to_sdog(s, &local_err); if (fd < 0) { - error_report("%s", error_get_pretty(local_err));; - error_free(local_err); + error_report_err(local_err); ret = fd; goto cleanup; } @@ -2234,8 +2225,7 @@ static int sd_snapshot_create(BlockDriverState *bs, QEMUSnapshotInfo *sn_info) ret = do_sd_create(s, &new_vid, 1, &local_err); if (ret < 0) { - error_report("%s", error_get_pretty(local_err));; - error_free(local_err); + error_report_err(local_err); error_report("failed to create inode for snapshot. %s", strerror(errno)); goto cleanup; @@ -2336,8 +2326,7 @@ static int sd_snapshot_list(BlockDriverState *bs, QEMUSnapshotInfo **psn_tab) fd = connect_to_sdog(s, &local_err); if (fd < 0) { - error_report("%s", error_get_pretty(local_err));; - error_free(local_err); + error_report_err(local_err); ret = fd; goto out; } @@ -2366,8 +2355,7 @@ static int sd_snapshot_list(BlockDriverState *bs, QEMUSnapshotInfo **psn_tab) fd = connect_to_sdog(s, &local_err); if (fd < 0) { - error_report("%s", error_get_pretty(local_err));; - error_free(local_err); + error_report_err(local_err); ret = fd; goto out; } @@ -2429,8 +2417,7 @@ static int do_load_save_vmstate(BDRVSheepdogState *s, uint8_t *data, fd = connect_to_sdog(s, &local_err); if (fd < 0) { - error_report("%s", error_get_pretty(local_err));; - error_free(local_err); + error_report_err(local_err); return fd; } diff --git a/blockdev.c b/blockdev.c index 7d34960b960244d6d8311ab22ce4c4de64f7fcfa..5437955fd88bca26b5db5037b72f084122c92d22 100644 --- a/blockdev.c +++ b/blockdev.c @@ -728,8 +728,7 @@ DriveInfo *drive_new(QemuOpts *all_opts, BlockInterfaceType block_default_type) qemu_opt_rename(all_opts, opt_renames[i].from, opt_renames[i].to, &local_err); if (local_err) { - error_report("%s", error_get_pretty(local_err)); - error_free(local_err); + error_report_err(local_err); return NULL; } } @@ -767,8 +766,7 @@ DriveInfo *drive_new(QemuOpts *all_opts, BlockInterfaceType block_default_type) &error_abort); qemu_opts_absorb_qdict(legacy_opts, bs_opts, &local_err); if (local_err) { - error_report("%s", error_get_pretty(local_err)); - error_free(local_err); + error_report_err(local_err); goto fail; } @@ -983,8 +981,7 @@ DriveInfo *drive_new(QemuOpts *all_opts, BlockInterfaceType block_default_type) bs_opts = NULL; if (!blk) { if (local_err) { - error_report("%s", error_get_pretty(local_err)); - error_free(local_err); + error_report_err(local_err); } goto fail; } else { @@ -1978,8 +1975,7 @@ int do_drive_del(Monitor *mon, const QDict *qdict, QObject **ret_data) aio_context_acquire(aio_context); if (bdrv_op_is_blocked(bs, BLOCK_OP_TYPE_DRIVE_DEL, &local_err)) { - error_report("%s", error_get_pretty(local_err)); - error_free(local_err); + error_report_err(local_err); aio_context_release(aio_context); return -1; } diff --git a/hw/arm/exynos4210.c b/hw/arm/exynos4210.c index 97dafca49a0327438248934c0410cf6259b5d35e..c55fab81317c554db77901a342bb0bca195a52e1 100644 --- a/hw/arm/exynos4210.c +++ b/hw/arm/exynos4210.c @@ -158,7 +158,7 @@ Exynos4210State *exynos4210_init(MemoryRegion *system_mem, if (object_property_find(cpuobj, "has_el3", NULL)) { object_property_set_bool(cpuobj, false, "has_el3", &err); if (err) { - error_report("%s", error_get_pretty(err)); + error_report_err(err); exit(1); } } @@ -168,7 +168,7 @@ Exynos4210State *exynos4210_init(MemoryRegion *system_mem, "reset-cbar", &error_abort); object_property_set_bool(cpuobj, true, "realized", &err); if (err) { - error_report("%s", error_get_pretty(err)); + error_report_err(err); exit(1); } } diff --git a/hw/arm/highbank.c b/hw/arm/highbank.c index f67570a7ee7f84f9cb56e213750272aeac944a51..a92cdc3322c60b805b90a696c2a7481158affa3e 100644 --- a/hw/arm/highbank.c +++ b/hw/arm/highbank.c @@ -248,7 +248,7 @@ static void calxeda_init(MachineState *machine, enum cxmachines machine_id) if (object_property_find(cpuobj, "has_el3", NULL)) { object_property_set_bool(cpuobj, false, "has_el3", &err); if (err) { - error_report("%s", error_get_pretty(err)); + error_report_err(err); exit(1); } } @@ -259,7 +259,7 @@ static void calxeda_init(MachineState *machine, enum cxmachines machine_id) } object_property_set_bool(cpuobj, true, "realized", &err); if (err) { - error_report("%s", error_get_pretty(err)); + error_report_err(err); exit(1); } cpu_irq[n] = qdev_get_gpio_in(DEVICE(cpu), ARM_CPU_IRQ); diff --git a/hw/arm/integratorcp.c b/hw/arm/integratorcp.c index 8c48b68a347eaae0986f81ab43f3823dcbea66f3..949ae1ed394ac36db9f19a96ffdaaf0bacabcb35 100644 --- a/hw/arm/integratorcp.c +++ b/hw/arm/integratorcp.c @@ -500,14 +500,14 @@ static void integratorcp_init(MachineState *machine) if (object_property_find(cpuobj, "has_el3", NULL)) { object_property_set_bool(cpuobj, false, "has_el3", &err); if (err) { - error_report("%s", error_get_pretty(err)); + error_report_err(err); exit(1); } } object_property_set_bool(cpuobj, true, "realized", &err); if (err) { - error_report("%s", error_get_pretty(err)); + error_report_err(err); exit(1); } diff --git a/hw/arm/realview.c b/hw/arm/realview.c index 50cb93d8ac8fbfb1cd85ded67164c563c42bc84a..ef2788d3ebb4df1b66e960035190f6f772b0ae63 100644 --- a/hw/arm/realview.c +++ b/hw/arm/realview.c @@ -108,7 +108,7 @@ static void realview_init(MachineState *machine, if (object_property_find(cpuobj, "has_el3", NULL)) { object_property_set_bool(cpuobj, false, "has_el3", &err); if (err) { - error_report("%s", error_get_pretty(err)); + error_report_err(err); exit(1); } } @@ -116,14 +116,14 @@ static void realview_init(MachineState *machine, if (is_pb && is_mpcore) { object_property_set_int(cpuobj, periphbase, "reset-cbar", &err); if (err) { - error_report("%s", error_get_pretty(err)); + error_report_err(err); exit(1); } } object_property_set_bool(cpuobj, true, "realized", &err); if (err) { - error_report("%s", error_get_pretty(err)); + error_report_err(err); exit(1); } diff --git a/hw/arm/versatilepb.c b/hw/arm/versatilepb.c index b1dae77604b00f3e4d77f609322cbd638f0d8072..624fdb09bb757039714280a22e7a541b139899f3 100644 --- a/hw/arm/versatilepb.c +++ b/hw/arm/versatilepb.c @@ -213,14 +213,14 @@ static void versatile_init(MachineState *machine, int board_id) if (object_property_find(cpuobj, "has_el3", NULL)) { object_property_set_bool(cpuobj, false, "has_el3", &err); if (err) { - error_report("%s", error_get_pretty(err)); + error_report_err(err); exit(1); } } object_property_set_bool(cpuobj, true, "realized", &err); if (err) { - error_report("%s", error_get_pretty(err)); + error_report_err(err); exit(1); } diff --git a/hw/arm/vexpress.c b/hw/arm/vexpress.c index 84415c8b0a321c281be8cab7aa4901ade3696910..5933454cfd78f40495011075c0e078499befcb8f 100644 --- a/hw/arm/vexpress.c +++ b/hw/arm/vexpress.c @@ -223,7 +223,7 @@ static void init_cpus(const char *cpu_model, const char *privdev, } object_property_set_bool(cpuobj, true, "realized", &err); if (err) { - error_report("%s", error_get_pretty(err)); + error_report_err(err); exit(1); } } diff --git a/hw/arm/xilinx_zynq.c b/hw/arm/xilinx_zynq.c index 06e6e24da10c0d22e9f0c216690205938c4b2e17..5c3752142231b1b0dd0535aca7b5bc5ac93f571d 100644 --- a/hw/arm/xilinx_zynq.c +++ b/hw/arm/xilinx_zynq.c @@ -133,25 +133,25 @@ static void zynq_init(MachineState *machine) if (object_property_find(OBJECT(cpu), "has_el3", NULL)) { object_property_set_bool(OBJECT(cpu), false, "has_el3", &err); if (err) { - error_report("%s", error_get_pretty(err)); + error_report_err(err); exit(1); } } object_property_set_int(OBJECT(cpu), ZYNQ_BOARD_MIDR, "midr", &err); if (err) { - error_report("%s", error_get_pretty(err)); + error_report_err(err); exit(1); } object_property_set_int(OBJECT(cpu), MPCORE_PERIPHBASE, "reset-cbar", &err); if (err) { - error_report("%s", error_get_pretty(err)); + error_report_err(err); exit(1); } object_property_set_bool(OBJECT(cpu), true, "realized", &err); if (err) { - error_report("%s", error_get_pretty(err)); + error_report_err(err); exit(1); } diff --git a/hw/block/virtio-blk.c b/hw/block/virtio-blk.c index 1a8a176dccf781c8fae879f94ea6ffbdb0f38dfc..cb71772f9567858ce13bcb9685774668089d7cbe 100644 --- a/hw/block/virtio-blk.c +++ b/hw/block/virtio-blk.c @@ -858,8 +858,7 @@ static void virtio_blk_migration_state_changed(Notifier *notifier, void *data) virtio_blk_data_plane_create(VIRTIO_DEVICE(s), &s->conf, &s->dataplane, &err); if (err != NULL) { - error_report("%s", error_get_pretty(err)); - error_free(err); + error_report_err(err); } } } diff --git a/hw/char/serial.c b/hw/char/serial.c index 04918979d82389c8558f32518756c1bd69c6e1a2..55011cfd267e001d520471332ccf1906a736bf9b 100644 --- a/hw/char/serial.c +++ b/hw/char/serial.c @@ -906,8 +906,7 @@ SerialState *serial_init(int base, qemu_irq irq, int baudbase, s->chr = chr; serial_realize_core(s, &err); if (err != NULL) { - error_report("%s", error_get_pretty(err)); - error_free(err); + error_report_err(err); exit(1); } @@ -970,8 +969,7 @@ SerialState *serial_mm_init(MemoryRegion *address_space, serial_realize_core(s, &err); if (err != NULL) { - error_report("%s", error_get_pretty(err)); - error_free(err); + error_report_err(err); exit(1); } vmstate_register(NULL, base, &vmstate_serial, s); diff --git a/hw/i386/kvm/pci-assign.c b/hw/i386/kvm/pci-assign.c index bb206da05fa34622578cf7394faeba6acec37046..29ce2c4eb8bbfe5021b7208f3866356f52dd88a6 100644 --- a/hw/i386/kvm/pci-assign.c +++ b/hw/i386/kvm/pci-assign.c @@ -953,8 +953,7 @@ static void assigned_dev_update_irq_routing(PCIDevice *dev) r = assign_intx(assigned_dev, &err); if (r < 0) { - error_report("%s", error_get_pretty(err)); - error_free(err); + error_report_err(err); err = NULL; qdev_unplug(&dev->qdev, &err); assert(!err); @@ -1010,8 +1009,7 @@ static void assigned_dev_update_msi(PCIDevice *pci_dev) assign_intx(assigned_dev, &local_err); if (local_err) { - error_report("%s", error_get_pretty(local_err)); - error_free(local_err); + error_report_err(local_err); } } } @@ -1158,8 +1156,7 @@ static void assigned_dev_update_msix(PCIDevice *pci_dev) assign_intx(assigned_dev, &local_err); if (local_err) { - error_report("%s", error_get_pretty(local_err)); - error_free(local_err); + error_report_err(local_err); } } } diff --git a/hw/i386/pc.c b/hw/i386/pc.c index c7af6aae01843a594b4f6230e77dbccc496dac16..05008cbf6a89198375a76a907a9d7fbcb8b4f976 100644 --- a/hw/i386/pc.c +++ b/hw/i386/pc.c @@ -414,7 +414,7 @@ void pc_cmos_init(ram_addr_t ram_size, ram_addr_t above_4g_mem_size, set_boot_dev(s, boot_device, &local_err); if (local_err) { - error_report("%s", error_get_pretty(local_err)); + error_report_err(local_err); exit(1); } @@ -1040,8 +1040,7 @@ void pc_cpus_init(const char *cpu_model, DeviceState *icc_bridge) cpu = pc_new_cpu(cpu_model, x86_cpu_apic_id_from_index(i), icc_bridge, &error); if (error) { - error_report("%s", error_get_pretty(error)); - error_free(error); + error_report_err(error); exit(1); } } diff --git a/hw/i386/smbios.c b/hw/i386/smbios.c index 12d213769d9894d2237cea6ed018dfee0995e95e..f2e9ab62cef671a74cd8791bad88959dc5ce7f9f 100644 --- a/hw/i386/smbios.c +++ b/hw/i386/smbios.c @@ -908,7 +908,7 @@ void smbios_entry_add(QemuOpts *opts) qemu_opts_validate(opts, qemu_smbios_file_opts, &local_err); if (local_err) { - error_report("%s", error_get_pretty(local_err)); + error_report_err(local_err); exit(1); } @@ -994,7 +994,7 @@ void smbios_entry_add(QemuOpts *opts) case 0: qemu_opts_validate(opts, qemu_smbios_type0_opts, &local_err); if (local_err) { - error_report("%s", error_get_pretty(local_err)); + error_report_err(local_err); exit(1); } save_opt(&type0.vendor, opts, "vendor"); @@ -1014,7 +1014,7 @@ void smbios_entry_add(QemuOpts *opts) case 1: qemu_opts_validate(opts, qemu_smbios_type1_opts, &local_err); if (local_err) { - error_report("%s", error_get_pretty(local_err)); + error_report_err(local_err); exit(1); } save_opt(&type1.manufacturer, opts, "manufacturer"); @@ -1036,7 +1036,7 @@ void smbios_entry_add(QemuOpts *opts) case 2: qemu_opts_validate(opts, qemu_smbios_type2_opts, &local_err); if (local_err) { - error_report("%s", error_get_pretty(local_err)); + error_report_err(local_err); exit(1); } save_opt(&type2.manufacturer, opts, "manufacturer"); @@ -1049,7 +1049,7 @@ void smbios_entry_add(QemuOpts *opts) case 3: qemu_opts_validate(opts, qemu_smbios_type3_opts, &local_err); if (local_err) { - error_report("%s", error_get_pretty(local_err)); + error_report_err(local_err); exit(1); } save_opt(&type3.manufacturer, opts, "manufacturer"); @@ -1061,7 +1061,7 @@ void smbios_entry_add(QemuOpts *opts) case 4: qemu_opts_validate(opts, qemu_smbios_type4_opts, &local_err); if (local_err) { - error_report("%s", error_get_pretty(local_err)); + error_report_err(local_err); exit(1); } save_opt(&type4.sock_pfx, opts, "sock_pfx"); @@ -1074,7 +1074,7 @@ void smbios_entry_add(QemuOpts *opts) case 17: qemu_opts_validate(opts, qemu_smbios_type17_opts, &local_err); if (local_err) { - error_report("%s", error_get_pretty(local_err)); + error_report_err(local_err); exit(1); } save_opt(&type17.loc_pfx, opts, "loc_pfx"); diff --git a/hw/ide/qdev.c b/hw/ide/qdev.c index 1ebb58d36d22b70d04f9c2de8af3c6fb0c1d1dbc..b4103fa009bcc31e8ea7fdddc8f133afc212b90d 100644 --- a/hw/ide/qdev.c +++ b/hw/ide/qdev.c @@ -172,8 +172,7 @@ static int ide_dev_initfn(IDEDevice *dev, IDEDriveKind kind) if (kind != IDE_CD) { blkconf_geometry(&dev->conf, &dev->chs_trans, 65536, 16, 255, &err); if (err) { - error_report("%s", error_get_pretty(err)); - error_free(err); + error_report_err(err); return -1; } } diff --git a/hw/pci/pci-hotplug-old.c b/hw/pci/pci-hotplug-old.c index 0c09c72ac5faa47441741258f6303493cd847728..d07db2538670492157e1adfd8c059ed9603269de 100644 --- a/hw/pci/pci-hotplug-old.c +++ b/hw/pci/pci-hotplug-old.c @@ -132,8 +132,7 @@ static int scsi_hot_add(Monitor *mon, DeviceState *adapter, dinfo->unit, false, -1, NULL, &local_err); if (!scsidev) { - error_report("%s", error_get_pretty(local_err)); - error_free(local_err); + error_report_err(local_err); return -1; } dinfo->unit = scsidev->id; diff --git a/hw/pci/pci.c b/hw/pci/pci.c index d50893002d4874ae2783ab5be0dc6c3b56598211..31b222d8c075fd1221ea3cf04067d70b2cf20355 100644 --- a/hw/pci/pci.c +++ b/hw/pci/pci.c @@ -2038,8 +2038,7 @@ int pci_add_capability(PCIDevice *pdev, uint8_t cap_id, ret = pci_add_capability2(pdev, cap_id, offset, size, &local_err); if (local_err) { assert(ret < 0); - error_report("%s", error_get_pretty(local_err)); - error_free(local_err); + error_report_err(local_err); } else { /* success implies a positive offset in config space */ assert(ret > 0); diff --git a/hw/usb/dev-network.c b/hw/usb/dev-network.c index 5b95d5c382a1be0c0bb22d7ae65175aa6c9a3a2d..c49fde811351eb97065820c3b15fc017a1b6620f 100644 --- a/hw/usb/dev-network.c +++ b/hw/usb/dev-network.c @@ -1399,8 +1399,7 @@ static USBDevice *usb_net_init(USBBus *bus, const char *cmdline) idx = net_client_init(opts, 0, &local_err); if (local_err) { - error_report("%s", error_get_pretty(local_err)); - error_free(local_err); + error_report_err(local_err); return NULL; } diff --git a/hw/usb/host-libusb.c b/hw/usb/host-libusb.c index cff4f7cd51597185a323d2b1e825e04cebf8e218..38f7c7268b18d0edbad415ed23749d44da29992d 100644 --- a/hw/usb/host-libusb.c +++ b/hw/usb/host-libusb.c @@ -878,8 +878,7 @@ static int usb_host_open(USBHostDevice *s, libusb_device *dev) usb_device_attach(udev, &local_err); if (local_err) { - error_report("%s", error_get_pretty(local_err)); - error_free(local_err); + error_report_err(local_err); goto fail; } diff --git a/hw/usb/redirect.c b/hw/usb/redirect.c index 962d3f5118fd8d99c3617c925787fd71c3dc9086..2416de83e9e1bd079212772acec11a3976282029 100644 --- a/hw/usb/redirect.c +++ b/hw/usb/redirect.c @@ -1273,8 +1273,7 @@ static void usbredir_do_attach(void *opaque) usb_device_attach(&dev->dev, &local_err); if (local_err) { - error_report("%s", error_get_pretty(local_err)); - error_free(local_err); + error_report_err(local_err); WARNING("rejecting device due to speed mismatch\n"); usbredir_reject_device(dev); } diff --git a/qemu-char.c b/qemu-char.c index 98d434237f33a4fac8d306e67e9aaf76739139c0..f901ed1583642960dc4bdc8f49fcd26ec7a7af01 100644 --- a/qemu-char.c +++ b/qemu-char.c @@ -3753,8 +3753,7 @@ CharDriverState *qemu_chr_new(const char *label, const char *filename, void (*in chr = qemu_chr_new_from_opts(opts, init, &err); if (err) { - error_report("%s", error_get_pretty(err)); - error_free(err); + error_report_err(err); } if (chr && qemu_opt_get_bool(opts, "mux", 0)) { qemu_chr_fe_claim_no_fail(chr); diff --git a/qemu-img.c b/qemu-img.c index e148af8a3e64cc49e24db713a93166fd4a9a30a8..97d04bd8d984569d37a3dc652129025739360221 100644 --- a/qemu-img.c +++ b/qemu-img.c @@ -2004,8 +2004,7 @@ static ImageInfoList *collect_image_info_list(const char *filename, bdrv_query_image_info(bs, &info, &err); if (err) { - error_report("%s", error_get_pretty(err)); - error_free(err); + error_report_err(err); blk_unref(blk); goto err; } @@ -3053,8 +3052,7 @@ int main(int argc, char **argv) qemu_init_exec_dir(argv[0]); if (qemu_init_main_loop(&local_error)) { - error_report("%s", error_get_pretty(local_error)); - error_free(local_error); + error_report_err(local_error); exit(EXIT_FAILURE); } diff --git a/qemu-io.c b/qemu-io.c index 91a445a106bd19ae4a542d6ccf38132de5760c68..d7a32e432292056c223d872c805964c2672d04eb 100644 --- a/qemu-io.c +++ b/qemu-io.c @@ -464,8 +464,7 @@ int main(int argc, char **argv) } if (qemu_init_main_loop(&local_error)) { - error_report("%s", error_get_pretty(local_error)); - error_free(local_error); + error_report_err(local_error); exit(1); } diff --git a/qemu-nbd.c b/qemu-nbd.c index 4d8df0838595411d171e1d5eb178a383ac88bcc8..2ba2d4c5bd526da3a88194cc036beb5f53469e27 100644 --- a/qemu-nbd.c +++ b/qemu-nbd.c @@ -228,8 +228,7 @@ static int tcp_socket_incoming(const char *address, uint16_t port) int fd = inet_listen(address_and_port, NULL, 0, SOCK_STREAM, 0, &local_err); if (local_err != NULL) { - error_report("%s", error_get_pretty(local_err)); - error_free(local_err); + error_report_err(local_err); } return fd; } @@ -240,8 +239,7 @@ static int unix_socket_incoming(const char *path) int fd = unix_listen(path, NULL, 0, &local_err); if (local_err != NULL) { - error_report("%s", error_get_pretty(local_err)); - error_free(local_err); + error_report_err(local_err); } return fd; } @@ -252,8 +250,7 @@ static int unix_socket_outgoing(const char *path) int fd = unix_connect(path, &local_err); if (local_err != NULL) { - error_report("%s", error_get_pretty(local_err)); - error_free(local_err); + error_report_err(local_err); } return fd; } @@ -681,8 +678,7 @@ int main(int argc, char **argv) } if (qemu_init_main_loop(&local_err)) { - error_report("%s", error_get_pretty(local_err)); - error_free(local_err); + error_report_err(local_err); exit(EXIT_FAILURE); } bdrv_init(); diff --git a/qom/cpu.c b/qom/cpu.c index 9c68fa48105213611fa55c689bdf3214b3843759..970377e960885a0b4e2e4aefba9f2ef4e81be567 100644 --- a/qom/cpu.c +++ b/qom/cpu.c @@ -71,8 +71,7 @@ CPUState *cpu_generic_init(const char *typename, const char *cpu_model) out: if (err != NULL) { - error_report("%s", error_get_pretty(err)); - error_free(err); + error_report_err(err); object_unref(OBJECT(cpu)); return NULL; } diff --git a/target-i386/cpu.c b/target-i386/cpu.c index 3a9b32ef7d2fedcef9820d87906ac94b0f5d515c..d543e2b53704ae8db7e2a9eac9a878ef99818cae 100644 --- a/target-i386/cpu.c +++ b/target-i386/cpu.c @@ -2163,8 +2163,7 @@ X86CPU *cpu_x86_init(const char *cpu_model) out: if (error) { - error_report("%s", error_get_pretty(error)); - error_free(error); + error_report_err(error); if (cpu != NULL) { object_unref(OBJECT(cpu)); cpu = NULL; diff --git a/target-sparc/cpu.c b/target-sparc/cpu.c index aa7626c1bfea56a60fd598cd26688558c290c80d..a9520970964bb1672c08ff7f7fddfa7281b0d907 100644 --- a/target-sparc/cpu.c +++ b/target-sparc/cpu.c @@ -111,8 +111,7 @@ static int cpu_sparc_register(SPARCCPU *cpu, const char *cpu_model) cc->parse_features(CPU(cpu), featurestr, &err); g_free(s); if (err) { - error_report("%s", error_get_pretty(err)); - error_free(err); + error_report_err(err); return -1; } diff --git a/util/error.c b/util/error.c index 1ff6ae538b328edf1196100afa9dc1825eeaf6de..14f43518792e3debe3381bf73ab035663fded4e2 100644 --- a/util/error.c +++ b/util/error.c @@ -41,7 +41,7 @@ void error_set(Error **errp, ErrorClass err_class, const char *fmt, ...) err->err_class = err_class; if (errp == &error_abort) { - error_report("%s", error_get_pretty(err)); + error_report_err(err); abort(); } @@ -77,7 +77,7 @@ void error_set_errno(Error **errp, int os_errno, ErrorClass err_class, err->err_class = err_class; if (errp == &error_abort) { - error_report("%s", error_get_pretty(err)); + error_report_err(err); abort(); } @@ -122,7 +122,7 @@ void error_set_win32(Error **errp, int win32_err, ErrorClass err_class, err->err_class = err_class; if (errp == &error_abort) { - error_report("%s", error_get_pretty(err)); + error_report_err(err); abort(); } @@ -169,7 +169,7 @@ void error_free(Error *err) void error_propagate(Error **dst_errp, Error *local_err) { if (local_err && dst_errp == &error_abort) { - error_report("%s", error_get_pretty(local_err)); + error_report_err(local_err); abort(); } else if (dst_errp && !*dst_errp) { *dst_errp = local_err; diff --git a/util/qemu-config.c b/util/qemu-config.c index ba375c014892ca6e216857e1dfaadd54c60898f3..b13efe2788339c9c9a3d0f377cfe03f62e953d00 100644 --- a/util/qemu-config.c +++ b/util/qemu-config.c @@ -32,8 +32,7 @@ QemuOptsList *qemu_find_opts(const char *group) ret = find_list(vm_config_groups, group, &local_err); if (local_err) { - error_report("%s", error_get_pretty(local_err)); - error_free(local_err); + error_report_err(local_err); } return ret; @@ -314,8 +313,7 @@ int qemu_config_parse(FILE *fp, QemuOptsList **lists, const char *fname) /* group with id */ list = find_list(lists, group, &local_err); if (local_err) { - error_report("%s", error_get_pretty(local_err)); - error_free(local_err); + error_report_err(local_err); goto out; } opts = qemu_opts_create(list, id, 1, NULL); @@ -325,8 +323,7 @@ int qemu_config_parse(FILE *fp, QemuOptsList **lists, const char *fname) /* group without id */ list = find_list(lists, group, &local_err); if (local_err) { - error_report("%s", error_get_pretty(local_err)); - error_free(local_err); + error_report_err(local_err); goto out; } opts = qemu_opts_create(list, NULL, 0, &error_abort); diff --git a/vl.c b/vl.c index 8c8f14287e17e04c46361fbc1612da9eb0ea0eb4..1e9aff66591efc44fd22735226d739caa0e59fa7 100644 --- a/vl.c +++ b/vl.c @@ -2137,8 +2137,7 @@ static int chardev_init_func(QemuOpts *opts, void *opaque) qemu_chr_new_from_opts(opts, NULL, &local_err); if (local_err) { - error_report("%s", error_get_pretty(local_err)); - error_free(local_err); + error_report_err(local_err); return -1; } return 0; @@ -2218,8 +2217,7 @@ static void monitor_parse(const char *optarg, const char *mode, bool pretty) opts = qemu_opts_create(qemu_find_opts("mon"), label, 1, &local_err); if (!opts) { - error_report("%s", error_get_pretty(local_err)); - error_free(local_err); + error_report_err(local_err); exit(1); } qemu_opt_set(opts, "mode", mode); @@ -3766,7 +3764,7 @@ int main(int argc, char **argv, char **envp) os_daemonize(); if (qemu_init_main_loop(&main_loop_err)) { - error_report("%s", error_get_pretty(main_loop_err)); + error_report_err(main_loop_err); exit(1); } @@ -4033,8 +4031,7 @@ int main(int argc, char **argv, char **envp) Error *local_err = NULL; qtest_init(qtest_chrdev, qtest_log, &local_err); if (local_err) { - error_report("%s", error_get_pretty(local_err)); - error_free(local_err); + error_report_err(local_err); exit(1); } } @@ -4056,7 +4053,7 @@ int main(int argc, char **argv, char **envp) if (order) { validate_bootdevices(order, &local_err); if (local_err) { - error_report("%s", error_get_pretty(local_err)); + error_report_err(local_err); exit(1); } boot_order = order; @@ -4066,7 +4063,7 @@ int main(int argc, char **argv, char **envp) if (once) { validate_bootdevices(once, &local_err); if (local_err) { - error_report("%s", error_get_pretty(local_err)); + error_report_err(local_err); exit(1); } normal_boot_order = g_strdup(boot_order);