From 565f65d271984a32eed2c324ff6ef8be33f7f3d2 Mon Sep 17 00:00:00 2001 From: Markus Armbruster Date: Thu, 12 Feb 2015 13:55:05 +0100 Subject: error: Use error_report_err() where appropriate Coccinelle semantic patch: @@ expression E; @@ - error_report("%s", error_get_pretty(E)); - error_free(E); + error_report_err(E); @@ expression E, S; @@ - error_report("%s", error_get_pretty(E)); + error_report_err(E); ( exit(S); | abort(); ) Trivial manual touch-ups in block/sheepdog.c. Signed-off-by: Markus Armbruster Reviewed-by: Eric Blake --- hw/i386/kvm/pci-assign.c | 9 +++------ hw/i386/pc.c | 5 ++--- hw/i386/smbios.c | 14 +++++++------- 3 files changed, 12 insertions(+), 16 deletions(-) (limited to 'hw/i386') diff --git a/hw/i386/kvm/pci-assign.c b/hw/i386/kvm/pci-assign.c index bb206da05f..29ce2c4eb8 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 c7af6aae01..05008cbf6a 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 12d213769d..f2e9ab62ce 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"); -- cgit v1.2.3