aboutsummaryrefslogtreecommitdiff
path: root/hw
diff options
context:
space:
mode:
authorAlistair Francis <alistair.francis@xilinx.com>2018-02-03 09:43:03 +0100
committerMarkus Armbruster <armbru@redhat.com>2018-02-06 18:26:42 +0100
commitc0dbca36dca9077184bfaedf6943982d4bc6d630 (patch)
tree36128c7ecd3db1235847943184f30362cd0df2d5 /hw
parent470bcabd8f56b950c8b9c7a0531d62d3b85978c0 (diff)
downloadqemu-c0dbca36dca9077184bfaedf6943982d4bc6d630.zip
qemu-c0dbca36dca9077184bfaedf6943982d4bc6d630.tar.gz
qemu-c0dbca36dca9077184bfaedf6943982d4bc6d630.tar.bz2
hw/arm: Replace fprintf(stderr, "*\n" with error_report()
Replace a large number of the fprintf(stderr, "*\n" calls with error_report(). The functions were renamed with these commands and then compiler issues where manually fixed. find ./* -type f -exec sed -i \ 'N;N;N;N;N;N;N;N;N;N;N;N; {s|fprintf(stderr, "\(.*\)\\n"\(.*\));|error_report("\1"\2);|Ig}' \ {} + find ./* -type f -exec sed -i \ 'N;N;N;N;N;N;N;N;N;N;N; {s|fprintf(stderr, "\(.*\)\\n"\(.*\));|error_report("\1"\2);|Ig}' \ {} + find ./* -type f -exec sed -i \ 'N;N;N;N;N;N;N;N;N; {s|fprintf(stderr, "\(.*\)\\n"\(.*\));|error_report("\1"\2);|Ig}' \ {} + find ./* -type f -exec sed -i \ 'N;N;N;N;N;N;N;N; {s|fprintf(stderr, "\(.*\)\\n"\(.*\));|error_report("\1"\2);|Ig}' \ {} + find ./* -type f -exec sed -i \ 'N;N;N;N;N;N;N; {s|fprintf(stderr, "\(.*\)\\n"\(.*\));|error_report("\1"\2);|Ig}' \ {} + find ./* -type f -exec sed -i \ 'N;N;N;N;N;N; {s|fprintf(stderr, "\(.*\)\\n"\(.*\));|error_report("\1"\2);|Ig}' \ {} + find ./* -type f -exec sed -i \ 'N;N;N;N;N; {s|fprintf(stderr, "\(.*\)\\n"\(.*\));|error_report("\1"\2);|Ig}' \ {} + find ./* -type f -exec sed -i \ 'N;N;N;N; {s|fprintf(stderr, "\(.*\)\\n"\(.*\));|error_report("\1"\2);|Ig}' \ {} + find ./* -type f -exec sed -i \ 'N;N;N; {s|fprintf(stderr, "\(.*\)\\n"\(.*\));|error_report("\1"\2);|Ig}' \ {} + find ./* -type f -exec sed -i \ 'N;N; {s|fprintf(stderr, "\(.*\)\\n"\(.*\));|error_report("\1"\2);|Ig}' \ {} + find ./* -type f -exec sed -i \ 'N; {s|fprintf(stderr, "\(.*\)\\n"\(.*\));|error_report("\1"\2);|Ig}' \ {} + Some lines where then manually tweaked to pass checkpatch. The 'qemu: ' prefix was manually removed from the hw/arm/boot.c file. Signed-off-by: Alistair Francis <alistair.francis@xilinx.com> Cc: qemu-arm@nongnu.org Conversions that aren't followed by exit() dropped, because they might be inappropriate. Also trim trailing punctuation from error messages. Signed-off-by: Markus Armbruster <armbru@redhat.com> Reviewed-by: Eric Blake <eblake@redhat.com> Reviewed-by: Philippe Mathieu-Daudé <f4bug@amsat.org> Message-Id: <20180203084315.20497-3-armbru@redhat.com>
Diffstat (limited to 'hw')
-rw-r--r--hw/arm/armv7m.c2
-rw-r--r--hw/arm/boot.c16
-rw-r--r--hw/arm/gumstix.c13
-rw-r--r--hw/arm/mainstone.c7
-rw-r--r--hw/arm/musicpal.c2
-rw-r--r--hw/arm/omap1.c5
-rw-r--r--hw/arm/omap2.c3
-rw-r--r--hw/arm/omap_sx1.c2
-rw-r--r--hw/arm/pxa2xx.c7
-rw-r--r--hw/arm/vexpress.c8
-rw-r--r--hw/arm/z2.c6
11 files changed, 38 insertions, 33 deletions
diff --git a/hw/arm/armv7m.c b/hw/arm/armv7m.c
index bb2dfc9..56770a7 100644
--- a/hw/arm/armv7m.c
+++ b/hw/arm/armv7m.c
@@ -278,7 +278,7 @@ void armv7m_load_kernel(ARMCPU *cpu, const char *kernel_filename, int mem_size)
#endif
if (!kernel_filename && !qtest_enabled()) {
- fprintf(stderr, "Guest image must be specified (using -kernel)\n");
+ error_report("Guest image must be specified (using -kernel)");
exit(1);
}
diff --git a/hw/arm/boot.c b/hw/arm/boot.c
index c2720c8..bb244ec 100644
--- a/hw/arm/boot.c
+++ b/hw/arm/boot.c
@@ -8,6 +8,7 @@
*/
#include "qemu/osdep.h"
+#include "qemu/error-report.h"
#include "qapi/error.h"
#include <libfdt.h>
#include "hw/hw.h"
@@ -690,7 +691,7 @@ static void load_image_to_fw_cfg(FWCfgState *fw_cfg, uint16_t size_key,
gsize length;
if (!g_file_get_contents(image_name, &contents, &length, NULL)) {
- fprintf(stderr, "failed to load \"%s\"\n", image_name);
+ error_report("failed to load \"%s\"", image_name);
exit(1);
}
size = length;
@@ -956,8 +957,7 @@ static void arm_load_kernel_notify(Notifier *notifier, void *data)
is_linux = 1;
}
if (kernel_size < 0) {
- fprintf(stderr, "qemu: could not load kernel '%s'\n",
- info->kernel_filename);
+ error_report("could not load kernel '%s'", info->kernel_filename);
exit(1);
}
info->entry = entry;
@@ -976,8 +976,8 @@ static void arm_load_kernel_notify(Notifier *notifier, void *data)
info->initrd_start);
}
if (initrd_size < 0) {
- fprintf(stderr, "qemu: could not load initrd '%s'\n",
- info->initrd_filename);
+ error_report("could not load initrd '%s'",
+ info->initrd_filename);
exit(1);
}
} else {
@@ -1021,9 +1021,9 @@ static void arm_load_kernel_notify(Notifier *notifier, void *data)
} else {
fixupcontext[FIXUP_ARGPTR] = info->loader_start + KERNEL_ARGS_ADDR;
if (info->ram_size >= (1ULL << 32)) {
- fprintf(stderr, "qemu: RAM size must be less than 4GB to boot"
- " Linux kernel using ATAGS (try passing a device tree"
- " using -dtb)\n");
+ error_report("RAM size must be less than 4GB to boot"
+ " Linux kernel using ATAGS (try passing a device tree"
+ " using -dtb)");
exit(1);
}
}
diff --git a/hw/arm/gumstix.c b/hw/arm/gumstix.c
index bba9e9f..ea2a3c5 100644
--- a/hw/arm/gumstix.c
+++ b/hw/arm/gumstix.c
@@ -35,6 +35,7 @@
*/
#include "qemu/osdep.h"
+#include "qemu/error-report.h"
#include "hw/hw.h"
#include "hw/arm/pxa.h"
#include "net/net.h"
@@ -62,8 +63,8 @@ static void connex_init(MachineState *machine)
dinfo = drive_get(IF_PFLASH, 0, 0);
if (!dinfo && !qtest_enabled()) {
- fprintf(stderr, "A flash image must be given with the "
- "'pflash' parameter\n");
+ error_report("A flash image must be given with the "
+ "'pflash' parameter");
exit(1);
}
@@ -76,7 +77,7 @@ static void connex_init(MachineState *machine)
dinfo ? blk_by_legacy_dinfo(dinfo) : NULL,
sector_len, connex_rom / sector_len,
2, 0, 0, 0, 0, be)) {
- fprintf(stderr, "qemu: Error registering flash memory.\n");
+ error_report("Error registering flash memory");
exit(1);
}
@@ -99,8 +100,8 @@ static void verdex_init(MachineState *machine)
dinfo = drive_get(IF_PFLASH, 0, 0);
if (!dinfo && !qtest_enabled()) {
- fprintf(stderr, "A flash image must be given with the "
- "'pflash' parameter\n");
+ error_report("A flash image must be given with the "
+ "'pflash' parameter");
exit(1);
}
@@ -113,7 +114,7 @@ static void verdex_init(MachineState *machine)
dinfo ? blk_by_legacy_dinfo(dinfo) : NULL,
sector_len, verdex_rom / sector_len,
2, 0, 0, 0, 0, be)) {
- fprintf(stderr, "qemu: Error registering flash memory.\n");
+ error_report("Error registering flash memory");
exit(1);
}
diff --git a/hw/arm/mainstone.c b/hw/arm/mainstone.c
index d07972a..4215c02 100644
--- a/hw/arm/mainstone.c
+++ b/hw/arm/mainstone.c
@@ -12,6 +12,7 @@
* GNU GPL, version 2 or (at your option) any later version.
*/
#include "qemu/osdep.h"
+#include "qemu/error-report.h"
#include "qapi/error.h"
#include "hw/hw.h"
#include "hw/arm/pxa.h"
@@ -143,8 +144,8 @@ static void mainstone_common_init(MemoryRegion *address_space_mem,
if (qtest_enabled()) {
break;
}
- fprintf(stderr, "Two flash images must be given with the "
- "'pflash' parameter\n");
+ error_report("Two flash images must be given with the "
+ "'pflash' parameter");
exit(1);
}
@@ -154,7 +155,7 @@ static void mainstone_common_init(MemoryRegion *address_space_mem,
blk_by_legacy_dinfo(dinfo),
sector_len, MAINSTONE_FLASH / sector_len,
4, 0, 0, 0, 0, be)) {
- fprintf(stderr, "qemu: Error registering flash memory.\n");
+ error_report("Error registering flash memory");
exit(1);
}
}
diff --git a/hw/arm/musicpal.c b/hw/arm/musicpal.c
index 4172caf..38d7322 100644
--- a/hw/arm/musicpal.c
+++ b/hw/arm/musicpal.c
@@ -1627,7 +1627,7 @@ static void musicpal_init(MachineState *machine)
flash_size = blk_getlength(blk);
if (flash_size != 8*1024*1024 && flash_size != 16*1024*1024 &&
flash_size != 32*1024*1024) {
- fprintf(stderr, "Invalid flash image size\n");
+ error_report("Invalid flash image size");
exit(1);
}
diff --git a/hw/arm/omap1.c b/hw/arm/omap1.c
index 92e58f0..b3a23a8 100644
--- a/hw/arm/omap1.c
+++ b/hw/arm/omap1.c
@@ -18,6 +18,7 @@
*/
#include "qemu/osdep.h"
+#include "qemu/error-report.h"
#include "qapi/error.h"
#include "qemu-common.h"
#include "cpu.h"
@@ -2313,7 +2314,7 @@ void omap_uwire_attach(struct omap_uwire_s *s,
uWireSlave *slave, int chipselect)
{
if (chipselect < 0 || chipselect > 3) {
- fprintf(stderr, "%s: Bad chipselect %i\n", __func__, chipselect);
+ error_report("%s: Bad chipselect %i", __func__, chipselect);
exit(-1);
}
@@ -3987,7 +3988,7 @@ struct omap_mpu_state_s *omap310_mpu_init(MemoryRegion *system_memory,
dinfo = drive_get(IF_SD, 0, 0);
if (!dinfo) {
- fprintf(stderr, "qemu: missing SecureDigital device\n");
+ error_report("missing SecureDigital device");
exit(1);
}
s->mmc = omap_mmc_init(0xfffb7800, system_memory,
diff --git a/hw/arm/omap2.c b/hw/arm/omap2.c
index b53878b..647b119 100644
--- a/hw/arm/omap2.c
+++ b/hw/arm/omap2.c
@@ -19,6 +19,7 @@
*/
#include "qemu/osdep.h"
+#include "qemu/error-report.h"
#include "qapi/error.h"
#include "qemu-common.h"
#include "cpu.h"
@@ -2486,7 +2487,7 @@ struct omap_mpu_state_s *omap2420_mpu_init(MemoryRegion *sysmem,
dinfo = drive_get(IF_SD, 0, 0);
if (!dinfo) {
- fprintf(stderr, "qemu: missing SecureDigital device\n");
+ error_report("missing SecureDigital device");
exit(1);
}
s->mmc = omap2_mmc_init(omap_l4tao(s->l4, 9),
diff --git a/hw/arm/omap_sx1.c b/hw/arm/omap_sx1.c
index 9a14270..eccc19c 100644
--- a/hw/arm/omap_sx1.c
+++ b/hw/arm/omap_sx1.c
@@ -194,7 +194,7 @@ static void sx1_init(MachineState *machine, const int version)
}
if (!machine->kernel_filename && !fl_idx && !qtest_enabled()) {
- fprintf(stderr, "Kernel or Flash image must be specified\n");
+ error_report("Kernel or Flash image must be specified");
exit(1);
}
diff --git a/hw/arm/pxa2xx.c b/hw/arm/pxa2xx.c
index db860c2..5805a2c 100644
--- a/hw/arm/pxa2xx.c
+++ b/hw/arm/pxa2xx.c
@@ -8,6 +8,7 @@
*/
#include "qemu/osdep.h"
+#include "qemu/error-report.h"
#include "qapi/error.h"
#include "qemu-common.h"
#include "cpu.h"
@@ -2062,7 +2063,7 @@ PXA2xxState *pxa270_init(MemoryRegion *address_space,
s = g_new0(PXA2xxState, 1);
if (strncmp(cpu_type, "pxa27", 5)) {
- fprintf(stderr, "Machine requires a PXA27x processor.\n");
+ error_report("Machine requires a PXA27x processor");
exit(1);
}
@@ -2095,7 +2096,7 @@ PXA2xxState *pxa270_init(MemoryRegion *address_space,
dinfo = drive_get(IF_SD, 0, 0);
if (!dinfo) {
- fprintf(stderr, "qemu: missing SecureDigital device\n");
+ error_report("missing SecureDigital device");
exit(1);
}
s->mmc = pxa2xx_mmci_init(address_space, 0x41100000,
@@ -2220,7 +2221,7 @@ PXA2xxState *pxa255_init(MemoryRegion *address_space, unsigned int sdram_size)
dinfo = drive_get(IF_SD, 0, 0);
if (!dinfo) {
- fprintf(stderr, "qemu: missing SecureDigital device\n");
+ error_report("missing SecureDigital device");
exit(1);
}
s->mmc = pxa2xx_mmci_init(address_space, 0x41100000,
diff --git a/hw/arm/vexpress.c b/hw/arm/vexpress.c
index efb5a29..dc5928a 100644
--- a/hw/arm/vexpress.c
+++ b/hw/arm/vexpress.c
@@ -266,7 +266,7 @@ static void a9_daughterboard_init(const VexpressMachineState *vms,
if (ram_size > 0x40000000) {
/* 1GB is the maximum the address space permits */
- fprintf(stderr, "vexpress-a9: cannot model more than 1GB RAM\n");
+ error_report("vexpress-a9: cannot model more than 1GB RAM");
exit(1);
}
@@ -355,7 +355,7 @@ static void a15_daughterboard_init(const VexpressMachineState *vms,
*/
uint64_t rsz = ram_size;
if (rsz > (30ULL * 1024 * 1024 * 1024)) {
- fprintf(stderr, "vexpress-a15: cannot model more than 30GB RAM\n");
+ error_report("vexpress-a15: cannot model more than 30GB RAM");
exit(1);
}
}
@@ -640,7 +640,7 @@ static void vexpress_common_init(MachineState *machine)
pflash0 = ve_pflash_cfi01_register(map[VE_NORFLASH0], "vexpress.flash0",
dinfo);
if (!pflash0) {
- fprintf(stderr, "vexpress: error registering flash 0.\n");
+ error_report("vexpress: error registering flash 0");
exit(1);
}
@@ -655,7 +655,7 @@ static void vexpress_common_init(MachineState *machine)
dinfo = drive_get_next(IF_PFLASH);
if (!ve_pflash_cfi01_register(map[VE_NORFLASH1], "vexpress.flash1",
dinfo)) {
- fprintf(stderr, "vexpress: error registering flash 1.\n");
+ error_report("vexpress: error registering flash 1");
exit(1);
}
diff --git a/hw/arm/z2.c b/hw/arm/z2.c
index 300e933..730a539 100644
--- a/hw/arm/z2.c
+++ b/hw/arm/z2.c
@@ -320,8 +320,8 @@ static void z2_init(MachineState *machine)
#endif
dinfo = drive_get(IF_PFLASH, 0, 0);
if (!dinfo && !qtest_enabled()) {
- fprintf(stderr, "Flash image must be given with the "
- "'pflash' parameter\n");
+ error_report("Flash image must be given with the "
+ "'pflash' parameter");
exit(1);
}
@@ -330,7 +330,7 @@ static void z2_init(MachineState *machine)
dinfo ? blk_by_legacy_dinfo(dinfo) : NULL,
sector_len, Z2_FLASH_SIZE / sector_len,
4, 0, 0, 0, 0, be)) {
- fprintf(stderr, "qemu: Error registering flash memory.\n");
+ error_report("Error registering flash memory");
exit(1);
}