trivial: use exit(EXIT_SUCCESS) and exit(EXIT_FAILURE)
Subsystems (5)
cover trivial: use exit(EXIT_SUCCESS) and exit(EXIT_FAILURE)
This series is the result of coccinelle patch scripts/coccinelle/exit.cocci
provided by the first patch of the series.
It replaces exit(0) by exit(EXIT_SUCCESS)
and exit(1) by exit(EXIT_FAILURE).
All other exit() are not modified as we don't want to change the behavior.
In some cases, I've added manually a line break to comply with the maximum line length.
Laurent Vivier (26):
coccinelle: use exit(EXIT_SUCCESS) and exit(EXIT_FAILURE)
arm: use exit(EXIT_SUCCESS) and exit(EXIT_FAILURE)
cris: use exit(EXIT_SUCCESS) and exit(EXIT_FAILURE)
block: use exit(EXIT_SUCCESS) and exit(EXIT_FAILURE)
ppc: use exit(EXIT_SUCCESS) and exit(EXIT_FAILURE)
graphics: use exit(EXIT_SUCCESS) and exit(EXIT_FAILURE)
tests: use exit(EXIT_SUCCESS) and exit(EXIT_FAILURE)
replay: use exit(EXIT_SUCCESS) and exit(EXIT_FAILURE)
qemu-user: use exit(EXIT_SUCCESS) and exit(EXIT_FAILURE)
m68k: use exit(EXIT_SUCCESS) and exit(EXIT_FAILURE) pci,virtio: use exit(EXIT_SUCCESS) and exit(EXIT_FAILURE)
sparc: use exit(EXIT_SUCCESS) and exit(EXIT_FAILURE)
sh4: use exit(EXIT_SUCCESS) and exit(EXIT_FAILURE)
x86: use exit(EXIT_SUCCESS) and exit(EXIT_FAILURE)
mips: use exit(EXIT_SUCCESS) and exit(EXIT_FAILURE)
s390: use exit(EXIT_SUCCESS) and exit(EXIT_FAILURE)
tcg: use exit(EXIT_SUCCESS) and exit(EXIT_FAILURE)
posix: use exit(EXIT_SUCCESS) and exit(EXIT_FAILURE)
alpha: use exit(EXIT_SUCCESS) and exit(EXIT_FAILURE)
common: use exit(EXIT_SUCCESS) and exit(EXIT_FAILURE) misc machine: use exit(EXIT_SUCCESS) and exit(EXIT_FAILURE)
blockdev: use exit(EXIT_SUCCESS) and exit(EXIT_FAILURE)
core: use exit(EXIT_SUCCESS) and exit(EXIT_FAILURE) error,trace: use exit(EXIT_SUCCESS) and exit(EXIT_FAILURE)
hw: use exit(EXIT_SUCCESS) and exit(EXIT_FAILURE)
net: use exit(EXIT_SUCCESS) and exit(EXIT_FAILURE)
accel.c | 2 +- arch_init.c | 6 +- bootdevice.c | 2 +- bsd-user/main.c | 20 +-- contrib/ivshmem-server/main.c | 12 +- cpus.c | 16 +- cputlb.c | 2 +- device_tree.c | 18 +- exec.c | 2 +- gdbstub.c | 2 +- hw/9pfs/9p.c | 2 +- hw/alpha/dp264.c | 8 +- hw/arm/armv7m.c | 6 +- hw/arm/boot.c | 16 +- hw/arm/cubieboard.c | 8 +- hw/arm/digic_boards.c | 6 +- hw/arm/fsl-imx6.c | 2 +- hw/arm/gumstix.c | 8 +- hw/arm/highbank.c | 4 +- hw/arm/integratorcp.c | 2 +- hw/arm/mainstone.c | 4 +- hw/arm/musicpal.c | 4 +- hw/arm/omap1.c | 4 +- hw/arm/omap2.c | 4 +- hw/arm/omap_sx1.c | 2 +- hw/arm/palm.c | 2 +- hw/arm/pxa2xx.c | 10 +- hw/arm/raspi.c | 4 +- hw/arm/realview.c | 2 +- hw/arm/sabrelite.c | 4 +- hw/arm/strongarm.c | 4 +- hw/arm/sysbus-fdt.c | 2 +- hw/arm/versatilepb.c | 2 +- hw/arm/vexpress.c | 16 +- hw/arm/virt.c | 24 +-- hw/arm/xlnx-ep108.c | 4 +- hw/arm/z2.c | 4 +- hw/block/pflash_cfi01.c | 2 +- hw/block/tc58128.c | 2 +- hw/block/virtio-blk.c | 6 +- hw/char/exynos4210_uart.c | 4 +- hw/core/machine.c | 2 +- hw/core/platform-bus.c | 4 +- hw/core/qdev.c | 2 +- hw/cris/axis_dev88.c | 2 +- hw/cris/boot.c | 4 +- hw/display/pl110.c | 2 +- hw/display/pxa2xx_lcd.c | 2 +- hw/display/ssd0303.c | 3 +- hw/gpio/pl061.c | 3 +- hw/i2c/smbus.c | 3 +- hw/i386/intel_iommu.c | 2 +- hw/i386/multiboot.c | 10 +- hw/i386/pc.c | 24 +-- hw/i386/pc_piix.c | 2 +- hw/i386/pc_sysfw.c | 6 +- hw/i386/x86-iommu.c | 2 +- hw/ide/core.c | 2 +- hw/intc/ioapic.c | 2 +- hw/intc/xics_kvm.c | 6 +- hw/lm32/lm32_boards.c | 8 +- hw/lm32/milkymist.c | 6 +- hw/m68k/an5206.c | 6 +- hw/m68k/dummy_m68k.c | 4 +- hw/m68k/mcf5208.c | 8 +- hw/mips/mips_fulong2e.c | 12 +- hw/mips/mips_jazz.c | 10 +- hw/mips/mips_malta.c | 20 +-- hw/mips/mips_mipssim.c | 10 +- hw/mips/mips_r4k.c | 10 +- hw/moxie/moxiesim.c | 8 +- hw/net/stellaris_enet.c | 3 +- hw/net/virtio-net.c | 10 +- hw/nvram/eeprom93xx.c | 2 +- hw/nvram/fw_cfg.c | 2 +- hw/openrisc/openrisc_sim.c | 4 +- hw/pci-host/bonito.c | 2 +- hw/pci/pci.c | 12 +- hw/ppc/e500.c | 14 +- hw/ppc/mac_newworld.c | 12 +- hw/ppc/mac_oldworld.c | 16 +- hw/ppc/mpc8544ds.c | 2 +- hw/ppc/ppc.c | 4 +- hw/ppc/ppc405_boards.c | 16 +- hw/ppc/ppc440_bamboo.c | 10 +- hw/ppc/ppc4xx_devs.c | 2 +- hw/ppc/prep.c | 12 +- hw/ppc/spapr.c | 52 +++--- hw/ppc/virtex_ml507.c | 4 +- hw/scsi/lsi53c895a.c | 7 +- hw/scsi/vhost-scsi.c | 4 +- hw/scsi/virtio-scsi-dataplane.c | 2 +- hw/scsi/virtio-scsi.c | 6 +- hw/sd/omap_mmc.c | 4 +- hw/sd/ssi-sd.c | 3 +- hw/sh4/r2d.c | 6 +- hw/sh4/shix.c | 4 +- hw/smbios/smbios.c | 22 +-- hw/sparc/leon3.c | 12 +- hw/sparc/sun4m.c | 22 +-- hw/sparc64/sun4u.c | 8 +- hw/ssi/pl022.c | 3 +- hw/tricore/tricore_testboard.c | 4 +- hw/unicore32/puv3.c | 6 +- hw/virtio/virtio.c | 28 +-- hw/watchdog/watchdog.c | 2 +- hw/xenpv/xen_machine_pv.c | 8 +- kvm-all.c | 8 +- linux-user/main.c | 4 +- linux-user/syscall.c | 2 +- net/net.c | 4 +- numa.c | 12 +- os-posix.c | 34 ++-- qemu-char.c | 6 +- qemu-img.c | 4 +- qemu-io.c | 24 +-- qemu-nbd.c | 6 +- replay/replay-char.c | 6 +- replay/replay-events.c | 6 +- replay/replay-internal.c | 2 +- replay/replay-time.c | 2 +- replay/replay.c | 14 +- scripts/coccinelle/exit.cocci | 12 ++ slirp/misc.c | 2 +- target-arm/kvm.c | 2 +- target-arm/machine.c | 2 +- target-i386/kvm.c | 8 +- target-i386/machine.c | 2 +- target-ppc/kvm.c | 6 +- target-ppc/translate.c | 2 +- target-ppc/translate_init.c | 28 +-- target-s390x/cpu.c | 2 +- target-s390x/kvm.c | 18 +- target-s390x/mmu_helper.c | 2 +- tcg/ppc/tcg-target.inc.c | 6 +- tcg/tcg.c | 2 +- tests/ipmi-bt-test.c | 6 +- tests/libqtest.c | 8 +- tests/migration/stress.c | 4 +- tests/qht-bench.c | 2 +- tests/rcutorture.c | 4 +- tests/tcg/cris/check_gcctorture_pr28634-1.c | 2 +- tests/tcg/cris/check_gcctorture_pr28634.c | 2 +- tests/tcg/cris/check_glibc_kernelversion.c | 2 +- tests/tcg/cris/check_hello.c | 2 +- tests/tcg/cris/check_lz.c | 2 +- tests/tcg/cris/check_mapbrk.c | 6 +- tests/tcg/cris/check_mmap1.c | 2 +- tests/tcg/cris/check_mmap2.c | 2 +- tests/tcg/cris/check_mmap3.c | 2 +- tests/tcg/cris/check_openpf5.c | 2 +- tests/tcg/cris/check_stat1.c | 2 +- tests/tcg/cris/check_stat2.c | 2 +- tests/tcg/cris/check_stat3.c | 2 +- tests/tcg/cris/check_stat4.c | 2 +- tests/tcg/cris/check_time1.c | 2 +- tests/tcg/cris/check_time2.c | 2 +- tests/tcg/cris/sys.c | 2 +- tests/tcg/hello-i386.c | 2 +- tests/tcg/linux-test.c | 4 +- tests/tcg/runcom.c | 12 +- tests/tcg/test_path.c | 2 +- tests/test-aio.c | 2 +- tests/test-iov.c | 8 +- tests/test-thread-pool.c | 2 +- tests/vhost-user-bridge.c | 18 +- trace/control.c | 10 +- translate-all.c | 2 +- ui/console-gl.c | 2 +- ui/console.c | 2 +- ui/curses.c | 4 +- ui/gtk.c | 2 +- ui/sdl.c | 8 +- ui/sdl2.c | 2 +- ui/spice-core.c | 22 +-- ui/vnc.c | 4 +- util/error.c | 2 +- util/oslib-posix.c | 2 +- util/qemu-timer-common.c | 2 +- vl.c | 270 ++++++++++++++-------------- xen-common.c | 4 +- xen-hvm.c | 2 +- 182 files changed, 734 insertions(+), 715 deletions(-) create mode 100644 scripts/coccinelle/exit.cocci
Signature · 1 line
2.5.5
PATCH 1/26 coccinelle: use exit(EXIT_SUCCESS) and exit(EXIT_FAILURE)
--- scripts/coccinelle/exit.cocci | 12 ++++++++++++ 1 file changed, 12 insertions(+) create mode 100644 scripts/coccinelle/exit.cocci
scripts/coccinelle/exit.cocci new file +12 -0
@@ -0,0 +1,12 @@ +// replace exit(0) by exit(EXIT_SUCCESS) +// exit(1) by exit(EXIT_FAILURE) + +@@ +@@ +( +- exit(0) ++ exit(EXIT_SUCCESS) +| +- exit(1) ++ exit(EXIT_FAILURE) +)
Signature · 1 line
2.5.5
Re: [Qemu-devel] [PATCH 01/26] coccinelle: use exit(EXIT_SUCCESS) and exit(EXIT_FAILURE)
Quoted 6 lines · Laurent Vivier
Signed-off-by Laurent Vivier <[email protected]>--- scripts/coccinelle/exit.cocci | 12 ++++++++++++ 1 file changed, 12 insertions(+) create mode 100644 scripts/coccinelle/exit.cocci
Script itself is fine. Whether to apply it throughout the tree is a cosmetic question, but I'm in favor of it; and the script will help us keep the tree clean. Do we need/want to update HACKING to mention our new enforced style as well, later in the series?
However, Coccinelle doesn't seem to catch comments; your series has missed at least the 'exit(1)' in the comments of include/qapi/error.h.
Quoted 19 lines
scripts/coccinelle/exit.cocci new file +12
-0@@ -0,0 +1,12 @@ +// replace exit(0) by exit(EXIT_SUCCESS) +// exit(1) by exit(EXIT_FAILURE) + +@@ +@@ +( +- exit(0) ++ exit(EXIT_SUCCESS) +| +- exit(1) ++ exit(EXIT_FAILURE) +)
Signature · 2 lines
Eric Blake eblake redhat com +1-919-301-3266 Libvirt virtualization library http://libvirt.org
PATCH 2/26 arm: use exit(EXIT_SUCCESS) and exit(EXIT_FAILURE)
In reply to Laurent VivierThis patch is the result of coccinelle scriptscripts/coccinelle/exit.cocci
--- hw/arm/armv7m.c | 6 +++--- hw/arm/boot.c | 16 ++++++++-------- hw/arm/cubieboard.c | 8 ++++---- hw/arm/digic_boards.c | 6 +++--- hw/arm/fsl-imx6.c | 2 +- hw/arm/gumstix.c | 8 ++++---- hw/arm/highbank.c | 4 ++-- hw/arm/integratorcp.c | 2 +- hw/arm/mainstone.c | 4 ++-- hw/arm/musicpal.c | 4 ++-- hw/arm/omap1.c | 4 ++-- hw/arm/omap2.c | 4 ++-- hw/arm/omap_sx1.c | 2 +- hw/arm/palm.c | 2 +- hw/arm/pxa2xx.c | 10 +++++----- hw/arm/raspi.c | 4 ++-- hw/arm/realview.c | 2 +- hw/arm/sabrelite.c | 4 ++-- hw/arm/strongarm.c | 4 ++-- hw/arm/sysbus-fdt.c | 2 +- hw/arm/versatilepb.c | 2 +- hw/arm/vexpress.c | 16 ++++++++-------- hw/arm/virt.c | 24 ++++++++++++------------ hw/arm/xlnx-ep108.c | 4 ++-- hw/arm/z2.c | 4 ++-- hw/char/exynos4210_uart.c | 4 ++-- hw/display/pl110.c | 2 +- hw/display/pxa2xx_lcd.c | 2 +- hw/gpio/pl061.c | 3 ++- hw/net/stellaris_enet.c | 3 ++- hw/sd/omap_mmc.c | 4 ++-- hw/ssi/pl022.c | 3 ++- target-arm/kvm.c | 2 +- target-arm/machine.c | 2 +- 34 files changed, 88 insertions(+), 85 deletions(-)
hw/arm/armv7m.c +3 -3
@@ -188,7 +188,7 @@ DeviceState *armv7m_init(MemoryRegion *system_memory, int mem_size, int num_irq, cpu =cpu_arm_init (cpu_model);if (cpu ==NULL ) {fprintf (stderr,"Unable to find CPU definition\n" ); -exit (1 ); +exit (EXIT_FAILURE ); } env = &cpu->env;
@@ -209,7 +209,7 @@ DeviceState *armv7m_init(MemoryRegion *system_memory, int mem_size, int num_irq,if (!kernel_filename && !qtest_enabled ()) {fprintf (stderr,"Guest image must be specified (using -kernel)\n" ); -exit (1 ); +exit (EXIT_FAILURE ); }if (kernel_filename) {
@@ -221,7 +221,7 @@ DeviceState *armv7m_init(MemoryRegion *system_memory, int mem_size, int num_irq, }if (image_size <0 ) {error_report ("Could not load kernel '%s'" , kernel_filename); -exit (1 ); +exit (EXIT_FAILURE ); } }
hw/arm/boot.c +8 -8
@@ -671,7 +671,7 @@ static void load_image_to_fw_cfg(FWCfgState *fw_cfg, uint16_t size_key,if (!g_file_get_contents (image_name, &contents, &length,NULL )) {fprintf (stderr,"failed to load \"%s\"\n" , image_name); -exit (1 ); +exit (EXIT_FAILURE ); } size = length; data = (uint8_t *)contents;
@@ -745,7 +745,7 @@ static uint64_t arm_load_elf(struct arm_boot_info *info, uint64_t *pentry, 1, data_swab);if (ret <=0 ) {/* The header loaded but the image didn't */ -exit (1 ); +exit (EXIT_FAILURE ); }return ret;
@@ -782,7 +782,7 @@ static void arm_load_kernel_notify(Notifier *notifier, void *data)* DTB to the base of RAM for the bootloader to pick up. */ if (load_dtb (info->loader_start, info,0 ) <0 ) { -exit (1 ); +exit (EXIT_FAILURE ); } }
@@ -874,7 +874,7 @@ static void arm_load_kernel_notify(Notifier *notifier, void *data) elf_low_addr =0 ; }if (load_dtb (info->loader_start, info, elf_low_addr) <0 ) { -exit (1 ); +exit (EXIT_FAILURE ); } } }
@@ -899,7 +899,7 @@ static void arm_load_kernel_notify(Notifier *notifier, void *data)if (kernel_size <0 ) {fprintf (stderr,"qemu: could not load kernel '%s'\n" , info->kernel_filename); -exit (1 ); +exit (EXIT_FAILURE ); } info->entry = entry;if (is_linux) {
@@ -919,7 +919,7 @@ static void arm_load_kernel_notify(Notifier *notifier, void *data)if (initrd_size <0 ) {fprintf (stderr,"qemu: could not load initrd '%s'\n" , info->initrd_filename); -exit (1 ); +exit (EXIT_FAILURE ); } }else { initrd_size =0 ;
@@ -956,7 +956,7 @@ static void arm_load_kernel_notify(Notifier *notifier, void *data)/* Place the DTB after the initrd in memory with alignment. */ dtb_start =QEMU_ALIGN_UP (info->initrd_start + initrd_size, align);if (load_dtb (dtb_start, info,0 ) <0 ) { -exit (1 ); +exit (EXIT_FAILURE ); } fixupcontext[FIXUP_ARGPTR ] = dtb_start; }else {
@@ -965,7 +965,7 @@ static void arm_load_kernel_notify(Notifier *notifier, void *data)fprintf (stderr,"qemu: RAM size must be less than 4GB to boot" " Linux kernel using ATAGS (try passing a device tree" " using -dtb)\n" ); -exit (1 ); +exit (EXIT_FAILURE ); } } fixupcontext[FIXUP_ENTRYPOINT ] = entry;
hw/arm/cubieboard.c +4 -4
@@ -44,26 +44,26 @@ static void cubieboard_init(MachineState *machine)object_property_set_int (OBJECT (&s->a10->emac),1 ,"phy-addr" , &err);if (err !=NULL ) {error_reportf_err (err,"Couldn't set phy address: " ); -exit (1 ); +exit (EXIT_FAILURE ); }object_property_set_int (OBJECT (&s->a10->timer),32768 ,"clk0-freq" , &err);if (err !=NULL ) {error_reportf_err (err,"Couldn't set clk0 frequency: " ); -exit (1 ); +exit (EXIT_FAILURE ); }object_property_set_int (OBJECT (&s->a10->timer),24000000 ,"clk1-freq" , &err);if (err !=NULL ) {error_reportf_err (err,"Couldn't set clk1 frequency: " ); -exit (1 ); +exit (EXIT_FAILURE ); }object_property_set_bool (OBJECT (s->a10), true,"realized" , &err);if (err !=NULL ) {error_reportf_err (err,"Couldn't realize Allwinner A10: " ); -exit (1 ); +exit (EXIT_FAILURE ); } memory_region_allocate_system_memory(&s->sdram, NULL, "cubieboard.ram",
hw/arm/digic_boards.c +3 -3
@@ -69,7 +69,7 @@ static void digic4_board_init(DigicBoard *board)object_property_set_bool (OBJECT (s->digic), true,"realized" , &err);if (err !=NULL ) {error_reportf_err (err,"Couldn't realize DIGIC SoC: " ); -exit (1 ); +exit (EXIT_FAILURE ); }digic4_board_setup_ram (s, board->ram_size);
@@ -107,13 +107,13 @@ static void digic_load_rom(DigicBoardState *s, hwaddr addr,if (!fn) {error_report ("Couldn't find rom image '%s'." , filename); -exit (1 ); +exit (EXIT_FAILURE ); } rom_size =load_image_targphys (fn, addr, max_size);if (rom_size <0 || rom_size > max_size) {error_report ("Couldn't load rom image '%s'." , filename); -exit (1 ); +exit (EXIT_FAILURE ); }g_free (fn); }
hw/arm/fsl-imx6.c +1 -1
@@ -38,7 +38,7 @@ static void fsl_imx6_init(Object *obj)if (smp_cpus >FSL_IMX6_NUM_CPUS ) {error_report ("%s: Only %d CPUs are supported (%d requested)" ,TYPE_FSL_IMX6 ,FSL_IMX6_NUM_CPUS , smp_cpus); -exit (1 ); +exit (EXIT_FAILURE ); }for (i =0 ; i < smp_cpus; i++) {
hw/arm/gumstix.c +4 -4
@@ -63,7 +63,7 @@ static void connex_init(MachineState *machine)if (!dinfo && !qtest_enabled ()) {fprintf (stderr,"A flash image must be given with the " "'pflash' parameter\n" ); -exit (1 ); +exit (EXIT_FAILURE ); }#ifdef TARGET_WORDS_BIGENDIAN
@@ -76,7 +76,7 @@ static void connex_init(MachineState *machine) sector_len, connex_rom / sector_len, 2, 0, 0, 0, 0, be)) {fprintf (stderr,"qemu: Error registering flash memory.\n" ); -exit (1 ); +exit (EXIT_FAILURE ); }/* Interrupt line of NIC is connected to GPIO line 36 */
@@ -101,7 +101,7 @@ static void verdex_init(MachineState *machine)if (!dinfo && !qtest_enabled ()) {fprintf (stderr,"A flash image must be given with the " "'pflash' parameter\n" ); -exit (1 ); +exit (EXIT_FAILURE ); }#ifdef TARGET_WORDS_BIGENDIAN
@@ -114,7 +114,7 @@ static void verdex_init(MachineState *machine) sector_len, verdex_rom / sector_len, 2, 0, 0, 0, 0, be)) {fprintf (stderr,"qemu: Error registering flash memory.\n" ); -exit (1 ); +exit (EXIT_FAILURE ); }/* Interrupt line of NIC is connected to GPIO line 99 */
hw/arm/highbank.c +2 -2
@@ -284,12 +284,12 @@ static void calxeda_init(MachineState *machine, enum cxmachines machine_id)if (sysboot_filename !=NULL ) {if (load_image_targphys (sysboot_filename,0xfff88000 ,0x8000 ) <0 ) {error_report ("Unable to load %s" , bios_name); -exit (1 ); +exit (EXIT_FAILURE ); }g_free (sysboot_filename); }else {error_report ("Unable to find %s" , bios_name); -exit (1 ); +exit (EXIT_FAILURE ); } }
hw/arm/integratorcp.c +1 -1
@@ -546,7 +546,7 @@ static void integratorcp_init(MachineState *machine) cpu_oc =cpu_class_by_name (TYPE_ARM_CPU , cpu_model);if (!cpu_oc) {fprintf (stderr,"Unable to find CPU definition\n" ); -exit (1 ); +exit (EXIT_FAILURE ); } cpuobj =object_new (object_class_get_name (cpu_oc));
hw/arm/mainstone.c +2 -2
@@ -145,7 +145,7 @@ static void mainstone_common_init(MemoryRegion *address_space_mem, }fprintf (stderr,"Two flash images must be given with the " "'pflash' parameter\n" ); -exit (1 ); +exit (EXIT_FAILURE ); } if (!pflash_cfi01_register(mainstone_flash_base[i], NULL,
@@ -155,7 +155,7 @@ static void mainstone_common_init(MemoryRegion *address_space_mem, sector_len, MAINSTONE_FLASH / sector_len, 4, 0, 0, 0, 0, be)) {fprintf (stderr,"qemu: Error registering flash memory.\n" ); -exit (1 ); +exit (EXIT_FAILURE ); } }
hw/arm/musicpal.c +2 -2
@@ -1594,7 +1594,7 @@ static void musicpal_init(MachineState *machine) cpu =cpu_arm_init (cpu_model);if (!cpu) {fprintf (stderr,"Unable to find CPU definition\n" ); -exit (1 ); +exit (EXIT_FAILURE ); }/* For now we use a fixed - the original - RAM size */
@@ -1634,7 +1634,7 @@ static void musicpal_init(MachineState *machine)if (flash_size !=8 *1024 *1024 && flash_size !=16 *1024 *1024 && flash_size !=32 *1024 *1024 ) {fprintf (stderr,"Invalid flash image size\n" ); -exit (1 ); +exit (EXIT_FAILURE ); }/*
hw/arm/omap1.c +2 -2
@@ -3864,7 +3864,7 @@ struct omap_mpu_state_s *omap310_mpu_init(MemoryRegion *system_memory, s->cpu =cpu_arm_init (core);if (s->cpu ==NULL ) {fprintf (stderr,"Unable to find CPU definition\n" ); -exit (1 ); +exit (EXIT_FAILURE ); } s->sdram_size = sdram_size; s->sram_size =OMAP15XX_SRAM_SIZE ;
@@ -3996,7 +3996,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" ); -exit (1 ); +exit (EXIT_FAILURE ); } s->mmc = omap_mmc_init(0xfffb7800, system_memory, blk_by_legacy_dinfo(dinfo),
hw/arm/omap2.c +2 -2
@@ -2262,7 +2262,7 @@ struct omap_mpu_state_s *omap2420_mpu_init(MemoryRegion *sysmem, s->cpu =cpu_arm_init (core ?:"arm1136-r2" );if (s->cpu ==NULL ) {fprintf (stderr,"Unable to find CPU definition\n" ); -exit (1 ); +exit (EXIT_FAILURE ); } s->sdram_size = sdram_size; s->sram_size =OMAP242X_SRAM_SIZE ;
@@ -2465,7 +2465,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" ); -exit (1 ); +exit (EXIT_FAILURE ); } s->mmc = omap2_mmc_init(omap_l4tao(s->l4, 9), blk_by_legacy_dinfo(dinfo),
hw/arm/omap_sx1.c +1 -1
@@ -196,7 +196,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" ); -exit (1 ); +exit (EXIT_FAILURE ); }/* Load the kernel. */
hw/arm/palm.c +1 -1
@@ -261,7 +261,7 @@ static void palmte_init(MachineState *machine)if (!rom_loaded && !kernel_filename && !qtest_enabled ()) {fprintf (stderr,"Kernel or ROM image must be specified\n" ); -exit (1 ); +exit (EXIT_FAILURE ); }/* Load the kernel. */
hw/arm/pxa2xx.c +5 -5
@@ -2067,7 +2067,7 @@ PXA2xxState *pxa270_init(MemoryRegion *address_space,if (revision &&strncmp (revision,"pxa27" ,5 )) {fprintf (stderr,"Machine requires a PXA27x processor.\n" ); -exit (1 ); +exit (EXIT_FAILURE ); }if (!revision) revision ="pxa270" ;
@@ -2075,7 +2075,7 @@ PXA2xxState *pxa270_init(MemoryRegion *address_space, s->cpu =cpu_arm_init (revision);if (s->cpu ==NULL ) {fprintf (stderr,"Unable to find CPU definition\n" ); -exit (1 ); +exit (EXIT_FAILURE ); } s->reset =qemu_allocate_irq (pxa2xx_reset, s,0 );
@@ -2108,7 +2108,7 @@ PXA2xxState *pxa270_init(MemoryRegion *address_space, dinfo =drive_get (IF_SD ,0 ,0 );if (!dinfo) {fprintf (stderr,"qemu: missing SecureDigital device\n" ); -exit (1 ); +exit (EXIT_FAILURE ); } s->mmc = pxa2xx_mmci_init(address_space, 0x41100000, blk_by_legacy_dinfo(dinfo),
@@ -2207,7 +2207,7 @@ PXA2xxState *pxa255_init(MemoryRegion *address_space, unsigned int sdram_size) s->cpu =cpu_arm_init ("pxa255" );if (s->cpu ==NULL ) {fprintf (stderr,"Unable to find CPU definition\n" ); -exit (1 ); +exit (EXIT_FAILURE ); } s->reset =qemu_allocate_irq (pxa2xx_reset, s,0 );
@@ -2239,7 +2239,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" ); -exit (1 ); +exit (EXIT_FAILURE ); } s->mmc = pxa2xx_mmci_init(address_space, 0x41100000, blk_by_legacy_dinfo(dinfo),
hw/arm/raspi.c +2 -2
@@ -99,7 +99,7 @@ static void setup_boot(MachineState *machine, int version, size_t ram_size) ram_size - FIRMWARE_ADDR);if (r <0 ) {error_report ("Failed to load firmware from %s" , machine->firmware); -exit (1 ); +exit (EXIT_FAILURE ); } binfo.entry =FIRMWARE_ADDR ;
@@ -147,7 +147,7 @@ static void raspi2_init(MachineState *machine) bus =qdev_get_child_bus (DEVICE (&s->soc),"sd-bus" );if (bus ==NULL ) {error_report ("No SD bus found in SOC object" ); -exit (1 ); +exit (EXIT_FAILURE ); } carddev =qdev_create (bus,TYPE_SD_CARD );qdev_prop_set_drive (carddev,"drive" , blk, &error_fatal);
hw/arm/realview.c +1 -1
@@ -99,7 +99,7 @@ static void realview_init(MachineState *machine, cpu_oc =cpu_class_by_name (TYPE_ARM_CPU , machine->cpu_model);if (!cpu_oc) {fprintf (stderr,"Unable to find CPU definition\n" ); -exit (1 ); +exit (EXIT_FAILURE ); }for (n =0 ; n < smp_cpus; n++) {
hw/arm/sabrelite.c +2 -2
@@ -52,7 +52,7 @@ static void sabrelite_init(MachineState *machine)if (machine->ram_size >FSL_IMX6_MMDC_SIZE ) {error_report ("RAM size " RAM_ADDR_FMT " above max supported (%08x)" , machine->ram_size,FSL_IMX6_MMDC_SIZE ); -exit (1 ); +exit (EXIT_FAILURE ); }object_initialize (&s->soc,sizeof (s->soc),TYPE_FSL_IMX6 );
@@ -62,7 +62,7 @@ static void sabrelite_init(MachineState *machine)object_property_set_bool (OBJECT (&s->soc), true,"realized" , &err);if (err !=NULL ) {error_report ("%s" ,error_get_pretty (err)); -exit (1 ); +exit (EXIT_FAILURE ); } memory_region_allocate_system_memory(&s->ram, NULL, "sabrelite.ram",
hw/arm/strongarm.c +2 -2
@@ -1592,14 +1592,14 @@ StrongARMState *sa1110_init(MemoryRegion *sysmem,if (strncmp (rev,"sa1110" ,6 )) {error_report ("Machine requires a SA1110 processor." ); -exit (1 ); +exit (EXIT_FAILURE ); } s->cpu =cpu_arm_init (rev);if (!s->cpu) {error_report ("Unable to find CPU definition" ); -exit (1 ); +exit (EXIT_FAILURE ); } memory_region_allocate_system_memory(&s->sdram, NULL, "strongarm.sdram",
hw/arm/sysbus-fdt.c +1 -1
@@ -450,7 +450,7 @@ static int add_fdt_node(SysBusDevice *sbdev, void *opaque) }error_report ("Device %s can not be dynamically instantiated" ,qdev_fw_name (DEVICE (sbdev))); -exit (1 ); +exit (EXIT_FAILURE ); }/**
hw/arm/versatilepb.c +1 -1
@@ -205,7 +205,7 @@ static void versatile_init(MachineState *machine, int board_id) cpu_oc =cpu_class_by_name (TYPE_ARM_CPU , machine->cpu_model);if (!cpu_oc) {fprintf (stderr,"Unable to find CPU definition\n" ); -exit (1 ); +exit (EXIT_FAILURE ); } cpuobj =object_new (object_class_get_name (cpu_oc));
hw/arm/vexpress.c +8 -8
@@ -210,7 +210,7 @@ static void init_cpus(const char *cpu_model, const char *privdev,if (!cpu_oc) {fprintf (stderr,"Unable to find CPU definition\n" ); -exit (1 ); +exit (EXIT_FAILURE ); }/* Create the actual CPUs */
@@ -275,7 +275,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" ); -exit (1 ); +exit (EXIT_FAILURE ); } memory_region_allocate_system_memory(ram, NULL, "vexpress.highmem",
@@ -368,7 +368,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" ); -exit (1 ); +exit (EXIT_FAILURE ); } }
@@ -571,19 +571,19 @@ static void vexpress_common_init(MachineState *machine)error_report ("The contents of the first flash device may be " "specified with -bios or with -drive if=pflash... " "but you cannot use both options at once" ); -exit (1 ); +exit (EXIT_FAILURE ); } fn =qemu_find_file (QEMU_FILE_TYPE_BIOS , bios_name);if (!fn) {error_report ("Could not find ROM image '%s'" , bios_name); -exit (1 ); +exit (EXIT_FAILURE ); } image_size =load_image_targphys (fn, map[VE_NORFLASH0 ],VEXPRESS_FLASH_SIZE );g_free (fn);if (image_size <0 ) {error_report ("Could not load ROM image '%s'" , bios_name); -exit (1 ); +exit (EXIT_FAILURE ); } }
@@ -653,7 +653,7 @@ static void vexpress_common_init(MachineState *machine) dinfo);if (!pflash0) {fprintf (stderr,"vexpress: error registering flash 0.\n" ); -exit (1 ); +exit (EXIT_FAILURE ); }if (map[VE_NORFLASHALIAS ] !=-1 ) {
@@ -668,7 +668,7 @@ static void vexpress_common_init(MachineState *machine)if (!ve_pflash_cfi01_register (map[VE_NORFLASH1 ],"vexpress.flash1" , dinfo)) {fprintf (stderr,"vexpress: error registering flash 1.\n" ); -exit (1 ); +exit (EXIT_FAILURE ); } sram_size =0x2000000 ;
hw/arm/virt.c +12 -12
@@ -241,7 +241,7 @@ static void create_fdt(VirtBoardInfo *vbi)if (!fdt) {error_report ("create_device_tree() failed" ); -exit (1 ); +exit (EXIT_FAILURE ); } vbi->fdt = fdt;
@@ -817,18 +817,18 @@ static void create_one_flash(const char *name, hwaddr flashbase,error_report ("The contents of the first flash device may be " "specified with -bios or with -drive if=pflash... " "but you cannot use both options at once" ); -exit (1 ); +exit (EXIT_FAILURE ); } fn =qemu_find_file (QEMU_FILE_TYPE_BIOS , file);if (!fn) {error_report ("Could not find ROM image '%s'" , file); -exit (1 ); +exit (EXIT_FAILURE ); } image_size =load_image_mr (fn,sysbus_mmio_get_region (sbd,0 ));g_free (fn);if (image_size <0 ) {error_report ("Could not load ROM image '%s'" , file); -exit (1 ); +exit (EXIT_FAILURE ); } } }
@@ -1196,13 +1196,13 @@ static void machvirt_init(MachineState *machine)if (!gic_version) {if (!kvm_enabled ()) {error_report ("gic-version=host requires KVM" ); -exit (1 ); +exit (EXIT_FAILURE ); } gic_version =kvm_arm_vgic_probe ();if (!gic_version) {error_report ("Unable to determine GIC version supported by host" ); -exit (1 ); +exit (EXIT_FAILURE ); } }
@@ -1213,7 +1213,7 @@ static void machvirt_init(MachineState *machine)if (!vbi) {error_report ("mach-virt: CPU %s not supported" , cpustr[0 ]); -exit (1 ); +exit (EXIT_FAILURE ); }/* If we have an EL3 boot ROM then the assumption is that it will
@@ -1240,20 +1240,20 @@ static void machvirt_init(MachineState *machine)error_report ("Number of SMP CPUs requested (%d) exceeds max CPUs " "supported by machine 'mach-virt' (%d)" , max_cpus, virt_max_cpus); -exit (1 ); +exit (EXIT_FAILURE ); } vbi->smp_cpus = smp_cpus;if (machine->ram_size > vbi->memmap[VIRT_MEM ].size) {error_report ("mach-virt: cannot model more than %dGB RAM" ,RAMLIMIT_GB ); -exit (1 ); +exit (EXIT_FAILURE ); }if (vms->secure) {if (kvm_enabled ()) {error_report ("mach-virt: KVM does not support Security extensions" ); -exit (1 ); +exit (EXIT_FAILURE ); }/* The Secure view of the world is the same as the NonSecure,
@@ -1272,7 +1272,7 @@ static void machvirt_init(MachineState *machine) oc =cpu_class_by_name (TYPE_ARM_CPU , cpustr[0 ]);if (!oc) {error_report ("Unable to find CPU definition" ); -exit (1 ); +exit (EXIT_FAILURE ); } typename =object_class_get_name (oc);
@@ -1282,7 +1282,7 @@ static void machvirt_init(MachineState *machine)g_strfreev (cpustr);if (err) {error_report_err (err); -exit (1 ); +exit (EXIT_FAILURE ); }for (n =0 ; n < smp_cpus; n++) {
hw/arm/xlnx-ep108.c +2 -2
@@ -43,7 +43,7 @@ static void xlnx_ep108_init(MachineState *machine)error_report ("ERROR: RAM size 0x%" PRIx64" above max supported of " "0x%llx" , ram_size,XLNX_ZYNQMP_MAX_RAM_SIZE ); -exit (1 ); +exit (EXIT_FAILURE ); }if (ram_size <0x08000000 ) {
@@ -76,7 +76,7 @@ static void xlnx_ep108_init(MachineState *machine)g_free (bus_name);if (!bus) {error_report ("No SD bus found for SD card %d" , i); -exit (1 ); +exit (EXIT_FAILURE ); } carddev =qdev_create (bus,TYPE_SD_CARD );qdev_prop_set_drive (carddev,"drive" , blk, &error_fatal);
hw/arm/z2.c +2 -2
@@ -330,7 +330,7 @@ static void z2_init(MachineState *machine)if (!dinfo && !qtest_enabled ()) {fprintf (stderr,"Flash image must be given with the " "'pflash' parameter\n" ); -exit (1 ); +exit (EXIT_FAILURE ); } if (!pflash_cfi01_register(Z2_FLASH_BASE,
@@ -339,7 +339,7 @@ static void z2_init(MachineState *machine) sector_len, Z2_FLASH_SIZE / sector_len, 4, 0, 0, 0, 0, be)) {fprintf (stderr,"qemu: Error registering flash memory.\n" ); -exit (1 ); +exit (EXIT_FAILURE ); }/* setup keypad */
hw/char/exynos4210_uart.c +2 -2
@@ -601,7 +601,7 @@ DeviceState *exynos4210_uart_create(hwaddr addr,if (channel >=MAX_SERIAL_PORTS ) {error_report ("Only %d serial ports are supported by QEMU" ,MAX_SERIAL_PORTS ); -exit (1 ); +exit (EXIT_FAILURE ); } chr = serial_hds[channel];if (!chr) {
@@ -609,7 +609,7 @@ DeviceState *exynos4210_uart_create(hwaddr addr, chr =qemu_chr_new (label,"null" ,NULL );if (!(chr)) {error_report ("Can't assign serial port to UART%d" , channel); -exit (1 ); +exit (EXIT_FAILURE ); } } }
hw/display/pl110.c +1 -1
@@ -175,7 +175,7 @@ static void pl110_update_display(void *opaque)break ;default :fprintf (stderr,"pl110: Bad color depth\n" ); -exit (1 ); +exit (EXIT_FAILURE ); }if (s->cr &PL110_CR_BGR ) bpp_offset =0 ;
hw/display/pxa2xx_lcd.c +1 -1
@@ -1051,7 +1051,7 @@ PXA2xxLCDState *pxa2xx_lcdc_init(MemoryRegion *sysmem,break ;default :fprintf (stderr,"%s: Bad color depth\n" , __FUNCTION__); -exit (1 ); +exit (EXIT_FAILURE ); }vmstate_register (NULL ,0 , &vmstate_pxa2xx_lcdc, s);
hw/gpio/pl061.c +2 -1
@@ -18,7 +18,8 @@#define DPRINTF (fmt, ...) \ do { printf("pl061: " fmt , ## __VA_ARGS__); } while (0)#define BADF (fmt, ...) \ -do { fprintf(stderr, "pl061: error: " fmt , ## __VA_ARGS__); exit(1);} while (0) +do { fprintf(stderr, "pl061: error: " fmt , ## __VA_ARGS__); \ + exit(EXIT_FAILURE); } while (0)#else #define DPRINTF (fmt, ...) do {} while(0)#define BADF (fmt, ...) \
hw/net/stellaris_enet.c +2 -1
@@ -17,7 +17,8 @@#define DPRINTF (fmt, ...) \ do { printf("stellaris_enet: " fmt , ## __VA_ARGS__); } while (0)#define BADF (fmt, ...) \ -do { fprintf(stderr, "stellaris_enet: error: " fmt , ## __VA_ARGS__); exit(1);} while (0) +do { fprintf(stderr, "stellaris_enet: error: " fmt , ## __VA_ARGS__); \ + exit(EXIT_FAILURE); } while (0)#else #define DPRINTF (fmt, ...) do {} while(0)#define BADF (fmt, ...) \
hw/sd/omap_mmc.c +2 -2
@@ -595,7 +595,7 @@ struct omap_mmc_s *omap_mmc_init(hwaddr base,/* Instantiate the storage */ s->card =sd_init (blk, false);if (s->card ==NULL ) { -exit (1 ); +exit (EXIT_FAILURE ); }return s;
@@ -622,7 +622,7 @@ struct omap_mmc_s *omap2_mmc_init(struct omap_target_agent_s *ta,/* Instantiate the storage */ s->card =sd_init (blk, false);if (s->card ==NULL ) { -exit (1 ); +exit (EXIT_FAILURE ); } s->cdet =qemu_allocate_irq (omap_mmc_cover_cb, s,0 );
hw/ssi/pl022.c +2 -1
@@ -18,7 +18,8 @@#define DPRINTF (fmt, ...) \ do { printf("pl022: " fmt , ## __VA_ARGS__); } while (0)#define BADF (fmt, ...) \ -do { fprintf(stderr, "pl022: error: " fmt , ## __VA_ARGS__); exit(1);} while (0) +do { fprintf(stderr, "pl022: error: " fmt , ## __VA_ARGS__); \ + exit(EXIT_FAILURE); } while (0)#else #define DPRINTF (fmt, ...) do {} while(0)#define BADF (fmt, ...) \
target-arm/kvm.c +1 -1
@@ -594,7 +594,7 @@ int kvm_arch_irqchip_create(MachineState *ms, KVMState *s) {if (machine_kernel_irqchip_split (ms)) {perror ("-machine kernel_irqchip=split is not supported on ARM." ); -exit (1 ); +exit (EXIT_FAILURE ); }/* If we can create the VGIC using the newer device control API, we
target-arm/machine.c +1 -1
@@ -340,7 +340,7 @@ const char *gicv3_class_name(void)#else error_report ("KVM GICv3 acceleration is not supported on this " "platform" ); -exit (1 ); +exit (EXIT_FAILURE );#endif }else {return "arm-gicv3" ;
Signature · 1 line
2.5.5
PATCH 3/26 cris: use exit(EXIT_SUCCESS) and exit(EXIT_FAILURE)
In reply to Laurent VivierThis patch is the result of coccinelle scriptscripts/coccinelle/exit.cocci
--- hw/cris/boot.c | 4 ++-- tests/tcg/cris/check_gcctorture_pr28634-1.c | 2 +- tests/tcg/cris/check_gcctorture_pr28634.c | 2 +- tests/tcg/cris/check_glibc_kernelversion.c | 2 +- tests/tcg/cris/check_hello.c | 2 +- tests/tcg/cris/check_lz.c | 2 +- tests/tcg/cris/check_mapbrk.c | 6 +++--- tests/tcg/cris/check_mmap1.c | 2 +- tests/tcg/cris/check_mmap2.c | 2 +- tests/tcg/cris/check_mmap3.c | 2 +- tests/tcg/cris/check_openpf5.c | 2 +- tests/tcg/cris/check_stat1.c | 2 +- tests/tcg/cris/check_stat2.c | 2 +- tests/tcg/cris/check_stat3.c | 2 +- tests/tcg/cris/check_stat4.c | 2 +- tests/tcg/cris/check_time1.c | 2 +- tests/tcg/cris/check_time2.c | 2 +- tests/tcg/cris/sys.c | 2 +- 18 files changed, 21 insertions(+), 21 deletions(-)
hw/cris/boot.c +2 -2
@@ -88,13 +88,13 @@ void cris_load_image(CRISCPU *cpu, struct cris_load_info *li)if (image_size <0 ) {fprintf (stderr,"qemu: could not load kernel '%s'\n" , li->image_filename); -exit (1 ); +exit (EXIT_FAILURE ); }if (li->cmdline && (kcmdline_len =strlen (li->cmdline))) {if (kcmdline_len >256 ) {fprintf (stderr,"Too long CRIS kernel cmdline (max 256)\n" ); -exit (1 ); +exit (EXIT_FAILURE ); }pstrcpy_targphys ("cmdline" ,0x40000000 ,256 , li->cmdline); }
tests/tcg/cris/check_gcctorture_pr28634-1.c +1 -1
@@ -11,5 +11,5 @@ main (void) y += x;if (y != x +1 )abort (); -exit (0 ); +exit (EXIT_SUCCESS ); }
tests/tcg/cris/check_gcctorture_pr28634.c +1 -1
@@ -11,5 +11,5 @@ main (void) y += x;if (y != x +1 )abort (); -exit (0 ); +exit (EXIT_SUCCESS ); }
tests/tcg/cris/check_glibc_kernelversion.c +1 -1
@@ -112,5 +112,5 @@ int main(void)if (version < __LINUX_KERNEL_VERSION)err ();pass (); -exit (0 ); +exit (EXIT_SUCCESS ); }
tests/tcg/cris/check_hello.c +1 -1
@@ -3,5 +3,5 @@int main () {printf ("pass\n" ); -exit (0 ); +exit (EXIT_SUCCESS ); }
tests/tcg/cris/check_lz.c +1 -1
@@ -45,5 +45,5 @@ int main(void) {check_lz ();pass (); -exit (0 ); +exit (EXIT_SUCCESS ); }
tests/tcg/cris/check_mapbrk.c +3 -3
@@ -16,7 +16,7 @@ int main () || (p6 = malloc (8191*1024)) == NULL) {printf ("fail\n" ); -exit (1 ); +exit (EXIT_FAILURE ); }free (p1);
@@ -30,10 +30,10 @@ int main ()if (p1 ==NULL ) {printf ("fail\n" ); -exit (1 ); +exit (EXIT_FAILURE ); }free (p1);printf ("pass\n" ); -exit (0 ); +exit (EXIT_SUCCESS ); }
tests/tcg/cris/check_mmap1.c +1 -1
@@ -44,5 +44,5 @@ int main (int argc, char *argv[])abort ();printf ("pass\n" ); -exit (0 ); +exit (EXIT_SUCCESS ); }
tests/tcg/cris/check_mmap2.c +1 -1
@@ -44,5 +44,5 @@ int main (int argc, char *argv[])abort ();printf ("pass\n" ); -exit (0 ); +exit (EXIT_SUCCESS ); }
tests/tcg/cris/check_mmap3.c +1 -1
@@ -29,5 +29,5 @@ int main (int argc, char *argv[])abort ();printf ("pass\n" ); -exit (0 ); +exit (EXIT_SUCCESS ); }
tests/tcg/cris/check_openpf5.c +1 -1
@@ -52,5 +52,5 @@ int main (int argc, char *argv[]) ok:printf ("pass\n" ); -exit (0 ); +exit (EXIT_SUCCESS ); }
tests/tcg/cris/check_stat1.c +1 -1
@@ -12,5 +12,5 @@ int main (void) || !S_ISDIR (buf.st_mode))abort ();printf ("pass\n" ); -exit (0 ); +exit (EXIT_SUCCESS ); }
tests/tcg/cris/check_stat2.c +1 -1
@@ -16,5 +16,5 @@ int main (void) || !S_ISDIR (buf.st_mode))abort ();printf ("pass\n" ); -exit (0 ); +exit (EXIT_SUCCESS ); }
tests/tcg/cris/check_stat3.c +1 -1
@@ -21,5 +21,5 @@ int main (int argc, char *argv[]) || !S_ISREG (buf.st_mode))abort ();printf ("pass\n" ); -exit (0 ); +exit (EXIT_SUCCESS ); }
tests/tcg/cris/check_stat4.c +1 -1
@@ -23,5 +23,5 @@ int main (int argc, char *argv[]) || !S_ISREG (buf.st_mode))abort ();printf ("pass\n" ); -exit (0 ); +exit (EXIT_SUCCESS ); }
tests/tcg/cris/check_time1.c +1 -1
@@ -42,5 +42,5 @@ main (void) }printf ("pass\n" ); -exit (0 ); +exit (EXIT_SUCCESS ); }
tests/tcg/cris/check_time2.c +1 -1
@@ -14,5 +14,5 @@ main (void)if (t == (time_t) -1 || t != x)abort ();printf ("pass\n" ); -exit (0 ); +exit (EXIT_SUCCESS ); }
tests/tcg/cris/sys.c +1 -1
@@ -12,7 +12,7 @@ static inline int mystrlen(char *s) {void pass (void ) {char s[] ="passed.\n" ;write (1 , s,sizeof (s) -1 ); -exit (0 ); +exit (EXIT_SUCCESS ); }void _fail (char *reason) {
Signature · 1 line
2.5.5
Re: [Qemu-devel] [PATCH 03/26] cris: use exit(EXIT_SUCCESS) and exit(EXIT_FAILURE)
Quoted 5 lines · Laurent Vivier
This patch is the result of coccinelle script
scripts/coccinelle/exit.cocciSigned-off-by Laurent Vivier <[email protected]>CC Edgar E. Iglesias <[email protected]>
Quoted 248 lines
--- hw/cris/boot.c | 4 ++-- tests/tcg/cris/check_gcctorture_pr28634-1.c | 2 +- tests/tcg/cris/check_gcctorture_pr28634.c | 2 +- tests/tcg/cris/check_glibc_kernelversion.c | 2 +- tests/tcg/cris/check_hello.c | 2 +- tests/tcg/cris/check_lz.c | 2 +- tests/tcg/cris/check_mapbrk.c | 6 +++--- tests/tcg/cris/check_mmap1.c | 2 +- tests/tcg/cris/check_mmap2.c | 2 +- tests/tcg/cris/check_mmap3.c | 2 +- tests/tcg/cris/check_openpf5.c | 2 +- tests/tcg/cris/check_stat1.c | 2 +- tests/tcg/cris/check_stat2.c | 2 +- tests/tcg/cris/check_stat3.c | 2 +- tests/tcg/cris/check_stat4.c | 2 +- tests/tcg/cris/check_time1.c | 2 +- tests/tcg/cris/check_time2.c | 2 +- tests/tcg/cris/sys.c | 2 +- 18 files changed, 21 insertions(+), 21 deletions(-)hw/cris/boot.c +2
-2@@ -88,13 +88,13 @@ void cris_load_image(CRISCPU *cpu, struct cris_load_info *li)if (image_size <0 ) {fprintf (stderr,"qemu: could not load kernel '%s'\n" , li->image_filename); -exit (1 ); +exit (EXIT_FAILURE ); }if (li->cmdline && (kcmdline_len =strlen (li->cmdline))) {if (kcmdline_len >256 ) {fprintf (stderr,"Too long CRIS kernel cmdline (max 256)\n" ); -exit (1 ); +exit (EXIT_FAILURE ); }pstrcpy_targphys ("cmdline" ,0x40000000 ,256 , li->cmdline); }tests/tcg/cris/check_gcctorture_pr28634-1.c +1
-1@@ -11,5 +11,5 @@ main (void) y += x;if (y != x +1 )abort (); -exit (0 ); +exit (EXIT_SUCCESS ); }tests/tcg/cris/check_gcctorture_pr28634.c +1
-1@@ -11,5 +11,5 @@ main (void) y += x;if (y != x +1 )abort (); -exit (0 ); +exit (EXIT_SUCCESS ); }tests/tcg/cris/check_glibc_kernelversion.c +1
-1@@ -112,5 +112,5 @@ int main(void)if (version < __LINUX_KERNEL_VERSION)err ();pass (); -exit (0 ); +exit (EXIT_SUCCESS ); }tests/tcg/cris/check_hello.c +1
-1@@ -3,5 +3,5 @@int main () {printf ("pass\n" ); -exit (0 ); +exit (EXIT_SUCCESS ); }tests/tcg/cris/check_lz.c +1
-1@@ -45,5 +45,5 @@ int main(void) {check_lz ();pass (); -exit (0 ); +exit (EXIT_SUCCESS ); }tests/tcg/cris/check_mapbrk.c +3
-3@@ -16,7 +16,7 @@ int main () || (p6 = malloc (8191*1024)) == NULL) {printf ("fail\n" ); -exit (1 ); +exit (EXIT_FAILURE ); }free (p1);@@ -30,10 +30,10 @@ int main ()if (p1 ==NULL ) {printf ("fail\n" ); -exit (1 ); +exit (EXIT_FAILURE ); }free (p1);printf ("pass\n" ); -exit (0 ); +exit (EXIT_SUCCESS ); }tests/tcg/cris/check_mmap1.c +1
-1@@ -44,5 +44,5 @@ int main (int argc, char *argv[])abort ();printf ("pass\n" ); -exit (0 ); +exit (EXIT_SUCCESS ); }tests/tcg/cris/check_mmap2.c +1
-1@@ -44,5 +44,5 @@ int main (int argc, char *argv[])abort ();printf ("pass\n" ); -exit (0 ); +exit (EXIT_SUCCESS ); }tests/tcg/cris/check_mmap3.c +1
-1@@ -29,5 +29,5 @@ int main (int argc, char *argv[])abort ();printf ("pass\n" ); -exit (0 ); +exit (EXIT_SUCCESS ); }tests/tcg/cris/check_openpf5.c +1
-1@@ -52,5 +52,5 @@ int main (int argc, char *argv[]) ok:printf ("pass\n" ); -exit (0 ); +exit (EXIT_SUCCESS ); }tests/tcg/cris/check_stat1.c +1
-1@@ -12,5 +12,5 @@ int main (void) || !S_ISDIR (buf.st_mode))abort ();printf ("pass\n" ); -exit (0 ); +exit (EXIT_SUCCESS ); }tests/tcg/cris/check_stat2.c +1
-1@@ -16,5 +16,5 @@ int main (void) || !S_ISDIR (buf.st_mode))abort ();printf ("pass\n" ); -exit (0 ); +exit (EXIT_SUCCESS ); }tests/tcg/cris/check_stat3.c +1
-1@@ -21,5 +21,5 @@ int main (int argc, char *argv[]) || !S_ISREG (buf.st_mode))abort ();printf ("pass\n" ); -exit (0 ); +exit (EXIT_SUCCESS ); }tests/tcg/cris/check_stat4.c +1
-1@@ -23,5 +23,5 @@ int main (int argc, char *argv[]) || !S_ISREG (buf.st_mode))abort ();printf ("pass\n" ); -exit (0 ); +exit (EXIT_SUCCESS ); }tests/tcg/cris/check_time1.c +1
-1@@ -42,5 +42,5 @@ main (void) }printf ("pass\n" ); -exit (0 ); +exit (EXIT_SUCCESS ); }tests/tcg/cris/check_time2.c +1
-1@@ -14,5 +14,5 @@ main (void)if (t == (time_t) -1 || t != x)abort ();printf ("pass\n" ); -exit (0 ); +exit (EXIT_SUCCESS ); }tests/tcg/cris/sys.c +1
-1@@ -12,7 +12,7 @@ static inline int mystrlen(char *s) {void pass (void ) {char s[] ="passed.\n" ;write (1 , s,sizeof (s) -1 ); -exit (0 ); +exit (EXIT_SUCCESS ); }void _fail (char *reason) {Signature · 1 line
2.5.5
PATCH 4/26 block: use exit(EXIT_SUCCESS) and exit(EXIT_FAILURE)
In reply to Laurent VivierThis patch is the result of coccinelle scriptscripts/coccinelle/exit.cocci
--- hw/block/pflash_cfi01.c | 2 +- hw/block/tc58128.c | 2 +- qemu-img.c | 4 ++-- qemu-io.c | 24 ++++++++++++------------ 4 files changed, 16 insertions(+), 16 deletions(-)
hw/block/pflash_cfi01.c +1 -1
@@ -52,7 +52,7 @@#define PFLASH_BUG (fmt, ...) \ do { \ fprintf(stderr, "PFLASH: Possible BUG - " fmt, ## __VA_ARGS__); \ - exit(1); \ + exit(EXIT_FAILURE); \ } while(0)/* #define PFLASH_DEBUG */
hw/block/tc58128.c +1 -1
@@ -41,7 +41,7 @@ static void init_dev(tc58128_dev * dev, const char *filename)if (ret <0 ) {if (!qtest_enabled ()) {error_report ("Could not load flash image %s" , filename); -exit (1 ); +exit (EXIT_FAILURE ); } }else {/* Build first block with number of blocks */
qemu-img.c +2 -2
@@ -2418,7 +2418,7 @@ static void dump_map_entry(OutputFormat output_format, MapEntry *e,case OFORMAT_HUMAN :if (e->data && !e->has_offset) {error_report ("File contains external, encrypted or compressed clusters." ); -exit (1 ); +exit (EXIT_FAILURE ); }if (e->data && !e->zero) { printf("%#-16"PRIx64"%#-16"PRIx64"%#-16"PRIx64"%s\n",
@@ -3870,7 +3870,7 @@ int main(int argc, char **argv) optind =0 ;if (!trace_init_backends ()) { -exit (1 ); +exit (EXIT_FAILURE ); }trace_init_file (trace_file);qemu_set_log (LOG_TRACE );
qemu-io.c +12 -12
@@ -489,7 +489,7 @@ int main(int argc, char **argv)case 'd' :if (bdrv_parse_discard_flags (optarg, &flags) <0 ) {error_report ("Invalid discard option: %s" , optarg); -exit (1 ); +exit (EXIT_FAILURE ); }break ;case 'f' :
@@ -510,7 +510,7 @@ int main(int argc, char **argv)case 't' :if (bdrv_parse_cache_mode (optarg, &flags, &writethrough) <0 ) {error_report ("Invalid cache option: %s" , optarg); -exit (1 ); +exit (EXIT_FAILURE ); }break ;case 'T' :
@@ -519,16 +519,16 @@ int main(int argc, char **argv)break ;case 'V' :printf ("%s version %s\n" , progname,QEMU_VERSION ); -exit (0 ); +exit (EXIT_SUCCESS );case 'h' :usage (progname); -exit (0 ); +exit (EXIT_SUCCESS );case OPTION_OBJECT : {QemuOpts *qopts; qopts =qemu_opts_parse_noisily (&qemu_object_opts, optarg, true);if (!qopts) { -exit (1 ); +exit (EXIT_FAILURE ); } }break ;case OPTION_IMAGE_OPTS :
@@ -536,33 +536,33 @@ int main(int argc, char **argv)break ;default :usage (progname); -exit (1 ); +exit (EXIT_FAILURE ); } }if ((argc - optind) >1 ) {usage (progname); -exit (1 ); +exit (EXIT_FAILURE ); }if (format && imageOpts) {error_report ("--image-opts and -f are mutually exclusive" ); -exit (1 ); +exit (EXIT_FAILURE ); }if (qemu_init_main_loop (&local_error)) {error_report_err (local_error); -exit (1 ); +exit (EXIT_FAILURE ); }if (qemu_opts_foreach (&qemu_object_opts, user_creatable_add_opts_foreach,NULL ,NULL )) { -exit (1 ); +exit (EXIT_FAILURE ); }if (!trace_init_backends ()) { -exit (1 ); +exit (EXIT_FAILURE ); }trace_init_file (trace_file);qemu_set_log (LOG_TRACE );
@@ -591,7 +591,7 @@ int main(int argc, char **argv)QemuOpts *qopts =NULL ; qopts =qemu_opts_parse_noisily (&file_opts, argv[optind], false);if (!qopts) { -exit (1 ); +exit (EXIT_FAILURE ); } opts =qemu_opts_to_qdict (qopts,NULL );openfile (NULL , flags, writethrough, opts);
Signature · 1 line
2.5.5
PATCH 5/26 ppc: use exit(EXIT_SUCCESS) and exit(EXIT_FAILURE)
In reply to Laurent VivierThis patch is the result of coccinelle scriptscripts/coccinelle/exit.cocci
--- device_tree.c | 18 ++++++++-------- hw/intc/xics_kvm.c | 6 +++--- hw/ppc/e500.c | 14 ++++++------ hw/ppc/mac_newworld.c | 12 +++++------ hw/ppc/mac_oldworld.c | 16 +++++++------- hw/ppc/mpc8544ds.c | 2 +- hw/ppc/ppc.c | 4 ++-- hw/ppc/ppc405_boards.c | 16 +++++++------- hw/ppc/ppc440_bamboo.c | 10 ++++----- hw/ppc/ppc4xx_devs.c | 2 +- hw/ppc/prep.c | 12 +++++------ hw/ppc/spapr.c | 52 ++++++++++++++++++++++----------------------- hw/ppc/virtex_ml507.c | 4 ++-- target-ppc/kvm.c | 6 +++--- target-ppc/translate.c | 2 +- target-ppc/translate_init.c | 28 ++++++++++++------------ tcg/ppc/tcg-target.inc.c | 6 +++--- 17 files changed, 105 insertions(+), 105 deletions(-)
device_tree.c +9 -9
@@ -61,13 +61,13 @@ void *create_device_tree(int *sizep) ret =fdt_open_into (fdt, fdt, *sizep);if (ret) {error_report ("Unable to copy device tree in memory" ); -exit (1 ); +exit (EXIT_FAILURE ); }return fdt; fail:error_report ("%s Couldn't create dt: %s" , __func__,fdt_strerror (ret)); -exit (1 ); +exit (EXIT_FAILURE ); }void *load_device_tree (const char *filename_path,int *sizep)
@@ -222,7 +222,7 @@ static int findnode_nofail(void *fdt, const char *node_path)if (offset <0 ) {error_report ("%s Couldn't find node %s: %s" , __func__, node_path,fdt_strerror (offset)); -exit (1 ); +exit (EXIT_FAILURE ); }return offset;
@@ -291,7 +291,7 @@ int qemu_fdt_setprop(void *fdt, const char *node_path,if (r <0 ) {error_report ("%s: Couldn't set %s/%s: %s" , __func__, node_path, property,fdt_strerror (r)); -exit (1 ); +exit (EXIT_FAILURE ); }return r;
@@ -306,7 +306,7 @@ int qemu_fdt_setprop_cell(void *fdt, const char *node_path,if (r <0 ) {error_report ("%s: Couldn't set %s/%s = %#08x: %s" , __func__, node_path, property, val,fdt_strerror (r)); -exit (1 ); +exit (EXIT_FAILURE ); }return r;
@@ -328,7 +328,7 @@ int qemu_fdt_setprop_string(void *fdt, const char *node_path,if (r <0 ) {error_report ("%s: Couldn't set %s/%s = %s: %s" , __func__, node_path, property, string,fdt_strerror (r)); -exit (1 ); +exit (EXIT_FAILURE ); }return r;
@@ -380,7 +380,7 @@ uint32_t qemu_fdt_get_phandle(void *fdt, const char *path)if (r ==0 ) {error_report ("%s: Couldn't get phandle for %s: %s" , __func__, path,fdt_strerror (r)); -exit (1 ); +exit (EXIT_FAILURE ); }return r;
@@ -425,7 +425,7 @@ int qemu_fdt_nop_node(void *fdt, const char *node_path)if (r <0 ) {error_report ("%s: Couldn't nop node %s: %s" , __func__, node_path,fdt_strerror (r)); -exit (1 ); +exit (EXIT_FAILURE ); }return r;
@@ -454,7 +454,7 @@ int qemu_fdt_add_subnode(void *fdt, const char *name)if (retval <0 ) {error_report ("FDT: Failed to create subnode %s: %s" , name,fdt_strerror (retval)); -exit (1 ); +exit (EXIT_FAILURE ); }g_free (dupname);
hw/intc/xics_kvm.c +3 -3
@@ -67,7 +67,7 @@ static void icp_get_kvm_state(ICPState *ss)if (ret !=0 ) {error_report ("Unable to retrieve KVM interrupt controller state" " for CPU %ld: %s" ,kvm_arch_vcpu_id (ss->cs),strerror (errno)); -exit (1 ); +exit (EXIT_FAILURE ); } ss->xirr = state >>KVM_REG_PPC_ICP_XISR_SHIFT ;
@@ -164,7 +164,7 @@ static void ics_get_kvm_state(ICSState *ics)if (ret !=0 ) {error_report ("Unable to retrieve KVM interrupt controller state" " for IRQ %d: %s" , i + ics->offset,strerror (errno)); -exit (1 ); +exit (EXIT_FAILURE ); } irq->server = state &KVM_XICS_DESTINATION_MASK ;
@@ -353,7 +353,7 @@ static void xics_kvm_cpu_setup(XICSState *xics, PowerPCCPU *cpu)if (ret <0 ) {error_report ("Unable to connect CPU%ld to kernel XICS: %s" ,kvm_arch_vcpu_id (cs),strerror (errno)); -exit (1 ); +exit (EXIT_FAILURE ); } ss->cap_irq_xics_enabled = true; }
hw/ppc/e500.c +7 -7
@@ -209,7 +209,7 @@ static int sysbus_device_create_devtree(SysBusDevice *sbdev, void *opaque)if (!matched) {error_report ("Device %s is not supported by this machine yet." ,qdev_fw_name (DEVICE (sbdev))); -exit (1 ); +exit (EXIT_FAILURE ); }return 0 ;
@@ -754,7 +754,7 @@ static qemu_irq *ppce500_init_mpic(MachineState *machine, PPCE500Params *params,if (machine_kernel_irqchip_required (machine) && !dev) {error_reportf_err (err,"kernel_irqchip requested but unavailable: " ); -exit (1 ); +exit (EXIT_FAILURE ); } }
@@ -824,7 +824,7 @@ void ppce500_init(MachineState *machine, PPCE500Params *params) cpu =cpu_ppc_init (machine->cpu_model);if (cpu ==NULL ) {fprintf (stderr,"Unable to initialize CPU!\n" ); -exit (1 ); +exit (EXIT_FAILURE ); } env = &cpu->env; cs =CPU (cpu);
@@ -972,7 +972,7 @@ void ppce500_init(MachineState *machine, PPCE500Params *params)if (kernel_size <0 ) {fprintf (stderr,"qemu: could not load kernel '%s'\n" , machine->kernel_filename); -exit (1 ); +exit (EXIT_FAILURE ); } cur_base += kernel_size;
@@ -987,7 +987,7 @@ void ppce500_init(MachineState *machine, PPCE500Params *params)if (initrd_size <0 ) {fprintf (stderr,"qemu: could not load initial ram disk '%s'\n" , machine->initrd_filename); -exit (1 ); +exit (EXIT_FAILURE ); } cur_base = initrd_base + initrd_size;
@@ -1028,7 +1028,7 @@ void ppce500_init(MachineState *machine, PPCE500Params *params) NULL, NULL);if (kernel_size <0 ) {fprintf (stderr,"qemu: could not load firmware '%s'\n" , filename); -exit (1 ); +exit (EXIT_FAILURE ); } }g_free (filename);
@@ -1041,7 +1041,7 @@ void ppce500_init(MachineState *machine, PPCE500Params *params) kernel_base, kernel_size);if (dt_size <0 ) {fprintf (stderr,"couldn't load device tree\n" ); -exit (1 ); +exit (EXIT_FAILURE ); }assert (dt_size <DTB_MAX_SIZE );
hw/ppc/mac_newworld.c +6 -6
@@ -196,7 +196,7 @@ static void ppc_core99_init(MachineState *machine) cpu =cpu_ppc_init (machine->cpu_model);if (cpu ==NULL ) {fprintf (stderr,"Unable to find PowerPC CPU definition\n" ); -exit (1 ); +exit (EXIT_FAILURE ); } env = &cpu->env;
@@ -231,7 +231,7 @@ static void ppc_core99_init(MachineState *machine) }if (bios_size <0 || bios_size >BIOS_SIZE ) {error_report ("could not load PowerPC bios '%s'" , bios_name); -exit (1 ); +exit (EXIT_FAILURE ); }if (linux_boot) {
@@ -258,7 +258,7 @@ static void ppc_core99_init(MachineState *machine) ram_size - kernel_base);if (kernel_size <0 ) {error_report ("could not load kernel '%s'" , kernel_filename); -exit (1 ); +exit (EXIT_FAILURE ); }/* load initrd */ if (initrd_filename) {
@@ -268,7 +268,7 @@ static void ppc_core99_init(MachineState *machine)if (initrd_size <0 ) {error_report ("could not load initial ram disk '%s'" , initrd_filename); -exit (1 ); +exit (EXIT_FAILURE ); } cmdline_base =round_page (initrd_base + initrd_size); }else {
@@ -294,7 +294,7 @@ static void ppc_core99_init(MachineState *machine) }if (ppc_boot_device =='\0' ) {fprintf (stderr,"No valid boot device for Mac99 machine\n" ); -exit (1 ); +exit (EXIT_FAILURE ); } }
@@ -350,7 +350,7 @@ static void ppc_core99_init(MachineState *machine)#endif /* defined(TARGET_PPC64) */ default :error_report ("Bus model not supported on mac99 machine" ); -exit (1 ); +exit (EXIT_FAILURE ); } }
hw/ppc/mac_oldworld.c +8 -8
@@ -116,7 +116,7 @@ static void ppc_heathrow_init(MachineState *machine) cpu =cpu_ppc_init (machine->cpu_model);if (cpu ==NULL ) {fprintf (stderr,"Unable to find PowerPC CPU definition\n" ); -exit (1 ); +exit (EXIT_FAILURE ); } env = &cpu->env;
@@ -130,7 +130,7 @@ static void ppc_heathrow_init(MachineState *machine)fprintf (stderr,"qemu: Too much memory for this machine: %d MB, maximum 2047 MB\n" , ((unsigned int )ram_size / (1 <<20 ))); -exit (1 ); +exit (EXIT_FAILURE ); } memory_region_allocate_system_memory(ram, NULL, "ppc_heathrow.ram",
@@ -158,7 +158,7 @@ static void ppc_heathrow_init(MachineState *machine) }if (bios_size <0 || bios_size >BIOS_SIZE ) {error_report ("could not load PowerPC bios '%s'" , bios_name); -exit (1 ); +exit (EXIT_FAILURE ); }if (linux_boot) {
@@ -184,7 +184,7 @@ static void ppc_heathrow_init(MachineState *machine) ram_size - kernel_base);if (kernel_size <0 ) {error_report ("could not load kernel '%s'" , kernel_filename); -exit (1 ); +exit (EXIT_FAILURE ); }/* load initrd */ if (initrd_filename) {
@@ -194,7 +194,7 @@ static void ppc_heathrow_init(MachineState *machine)if (initrd_size <0 ) {error_report ("could not load initial ram disk '%s'" , initrd_filename); -exit (1 ); +exit (EXIT_FAILURE ); } cmdline_base =round_page (initrd_base + initrd_size); }else {
@@ -228,7 +228,7 @@ static void ppc_heathrow_init(MachineState *machine) }if (ppc_boot_device =='\0' ) {fprintf (stderr,"No valid boot device for G3 Beige machine\n" ); -exit (1 ); +exit (EXIT_FAILURE ); } }
@@ -251,7 +251,7 @@ static void ppc_heathrow_init(MachineState *machine)break ;default :error_report ("Bus model not supported on OldWorld Mac machine" ); -exit (1 ); +exit (EXIT_FAILURE ); } }
@@ -265,7 +265,7 @@ static void ppc_heathrow_init(MachineState *machine)/* init basic PC hardware */ if (PPC_INPUT (env) != PPC_FLAGS_INPUT_6xx) {error_report ("Only 6xx bus is supported on heathrow machine" ); -exit (1 ); +exit (EXIT_FAILURE ); } pic =heathrow_pic_init (&pic_mem,1 , heathrow_irqs); pci_bus = pci_grackle_init(0xfec00000, pic,
hw/ppc/mpc8544ds.c +1 -1
@@ -43,7 +43,7 @@ static void mpc8544ds_init(MachineState *machine)if (machine->ram_size >0xc0000000 ) {error_report ("The MPC8544DS board only supports up to 3GB of RAM" ); -exit (1 ); +exit (EXIT_FAILURE ); }ppce500_init (machine, ¶ms);
hw/ppc/ppc.c +2 -2
@@ -1362,13 +1362,13 @@ void ppc_cpu_parse_features(const char *cpu_model) model_pieces =g_strsplit (cpu_model,"," ,2 );if (!model_pieces[0 ]) {error_report ("Invalid/empty CPU model name" ); -exit (1 ); +exit (EXIT_FAILURE ); } oc =cpu_class_by_name (TYPE_POWERPC_CPU , model_pieces[0 ]);if (oc ==NULL ) {error_report ("Unable to find CPU definition: %s" , model_pieces[0 ]); -exit (1 ); +exit (EXIT_FAILURE ); } typename =object_class_get_name (oc);
hw/ppc/ppc405_boards.c +8 -8
@@ -266,13 +266,13 @@ static void ref405ep_init(MachineState *machine)g_free (filename);if (bios_size <0 || bios_size >BIOS_SIZE ) {error_report ("Could not load PowerPC BIOS '%s'" , bios_name); -exit (1 ); +exit (EXIT_FAILURE ); } bios_size = (bios_size +0xfff ) & ~0xfff ;memory_region_add_subregion (sysmem, (uint32_t )(-bios_size), bios); }else if (!qtest_enabled () || kernel_filename !=NULL ) {error_report ("Could not load PowerPC BIOS '%s'" , bios_name); -exit (1 ); +exit (EXIT_FAILURE ); }else {/* Avoid an uninitialized variable warning */ bios_size =-1 ;
@@ -329,7 +329,7 @@ static void ref405ep_init(MachineState *machine)if (kernel_size <0 ) {fprintf (stderr,"qemu: could not load kernel '%s'\n" , kernel_filename); -exit (1 ); +exit (EXIT_FAILURE ); }printf ("Load kernel size %ld at " TARGET_FMT_lx, kernel_size, kernel_base);
@@ -341,7 +341,7 @@ static void ref405ep_init(MachineState *machine)if (initrd_size <0 ) {fprintf (stderr,"qemu: could not load initial ram disk '%s'\n" , initrd_filename); -exit (1 ); +exit (EXIT_FAILURE ); } }else { initrd_base =0 ;
@@ -564,13 +564,13 @@ static void taihu_405ep_init(MachineState *machine)g_free (filename);if (bios_size <0 || bios_size >BIOS_SIZE ) {error_report ("Could not load PowerPC BIOS '%s'" , bios_name); -exit (1 ); +exit (EXIT_FAILURE ); } bios_size = (bios_size +0xfff ) & ~0xfff ;memory_region_add_subregion (sysmem, (uint32_t )(-bios_size), bios); }else if (!qtest_enabled ()) {error_report ("Could not load PowerPC BIOS '%s'" , bios_name); -exit (1 ); +exit (EXIT_FAILURE ); }memory_region_set_readonly (bios, true); }
@@ -613,7 +613,7 @@ static void taihu_405ep_init(MachineState *machine)if (kernel_size <0 ) {fprintf (stderr,"qemu: could not load kernel '%s'\n" , kernel_filename); -exit (1 ); +exit (EXIT_FAILURE ); }/* load initrd */ if (initrd_filename) {
@@ -624,7 +624,7 @@ static void taihu_405ep_init(MachineState *machine)fprintf (stderr,"qemu: could not load initial ram disk '%s'\n" , initrd_filename); -exit (1 ); +exit (EXIT_FAILURE ); } }else { initrd_base =0 ;
hw/ppc/ppc440_bamboo.c +5 -5
@@ -189,7 +189,7 @@ static void bamboo_init(MachineState *machine) cpu =cpu_ppc_init (machine->cpu_model);if (cpu ==NULL ) {fprintf (stderr,"Unable to initialize CPU!\n" ); -exit (1 ); +exit (EXIT_FAILURE ); } env = &cpu->env;
@@ -223,7 +223,7 @@ static void bamboo_init(MachineState *machine) pcibus = (PCIBus *)qdev_get_child_bus (dev,"pci.0" );if (!pcibus) {fprintf (stderr,"couldn't create PCI controller!\n" ); -exit (1 ); +exit (EXIT_FAILURE ); } memory_region_init_alias(isa, NULL, "isa_mmio",
@@ -265,7 +265,7 @@ static void bamboo_init(MachineState *machine)if (success <0 ) {fprintf (stderr,"qemu: could not load kernel '%s'\n" , kernel_filename); -exit (1 ); +exit (EXIT_FAILURE ); } }
@@ -277,7 +277,7 @@ static void bamboo_init(MachineState *machine)if (initrd_size <0 ) {fprintf (stderr,"qemu: could not load ram disk '%s' at %x\n" , initrd_filename,RAMDISK_ADDR ); -exit (1 ); +exit (EXIT_FAILURE ); } }
@@ -286,7 +286,7 @@ static void bamboo_init(MachineState *machine)if (bamboo_load_device_tree (FDT_ADDR , ram_size,RAMDISK_ADDR , initrd_size, kernel_cmdline) <0 ) {fprintf (stderr,"couldn't load device tree\n" ); -exit (1 ); +exit (EXIT_FAILURE ); } } }
hw/ppc/ppc4xx_devs.c +1 -1
@@ -60,7 +60,7 @@ PowerPCCPU *ppc4xx_init(const char *cpu_model,if (cpu ==NULL ) {fprintf (stderr,"Unable to find PowerPC %s CPU definition\n" , cpu_model); -exit (1 ); +exit (EXIT_FAILURE ); } env = &cpu->env;
hw/ppc/prep.c +6 -6
@@ -512,7 +512,7 @@ static void ppc_prep_init(MachineState *machine) cpu =cpu_ppc_init (machine->cpu_model);if (cpu ==NULL ) {fprintf (stderr,"Unable to find PowerPC CPU definition\n" ); -exit (1 ); +exit (EXIT_FAILURE ); } env = &cpu->env;
@@ -537,7 +537,7 @@ static void ppc_prep_init(MachineState *machine) ram_size - kernel_base);if (kernel_size <0 ) {error_report ("could not load kernel '%s'" , kernel_filename); -exit (1 ); +exit (EXIT_FAILURE ); }/* load initrd */ if (initrd_filename) {
@@ -547,7 +547,7 @@ static void ppc_prep_init(MachineState *machine)if (initrd_size <0 ) {error_report ("could not load initial ram disk '%s'" , initrd_filename); -exit (1 ); +exit (EXIT_FAILURE ); } }else { initrd_base =0 ;
@@ -569,13 +569,13 @@ static void ppc_prep_init(MachineState *machine) }if (ppc_boot_device =='\0' ) {fprintf (stderr,"No valid boot device for Mac99 machine\n" ); -exit (1 ); +exit (EXIT_FAILURE ); } }if (PPC_INPUT (env) != PPC_FLAGS_INPUT_6xx) {error_report ("Only 6xx bus is supported on PREP machine" ); -exit (1 ); +exit (EXIT_FAILURE ); } dev =qdev_create (NULL ,"raven-pcihost" );
@@ -590,7 +590,7 @@ static void ppc_prep_init(MachineState *machine) pci_bus = (PCIBus *)qdev_get_child_bus (dev,"pci.0" );if (pci_bus ==NULL ) {fprintf (stderr,"Couldn't create PCI host controller.\n" ); -exit (1 ); +exit (EXIT_FAILURE ); } sysctrl->contiguous_map_irq =qdev_get_gpio_in (dev,0 );
hw/ppc/spapr.c +26 -26
197 lines not on this page · raw message
hw/ppc/virtex_ml507.c +2 -2
@@ -99,7 +99,7 @@ static PowerPCCPU *ppc440_init_xilinx(ram_addr_t *ram_size, cpu =cpu_ppc_init (cpu_model);if (cpu ==NULL ) {fprintf (stderr,"Unable to initialize CPU!\n" ); -exit (1 ); +exit (EXIT_FAILURE ); } env = &cpu->env;
@@ -284,7 +284,7 @@ static void virtex_init(MachineState *machine)if (initrd_size <0 ) {error_report ("couldn't load ram disk '%s'" , machine->initrd_filename); -exit (1 ); +exit (EXIT_FAILURE ); } high =ROUND_UP (high + initrd_size,4 ); }
target-ppc/kvm.c +3 -3
@@ -323,7 +323,7 @@ static long gethugepagesize(const char *mem_path)if (ret !=0 ) {fprintf (stderr,"Couldn't statfs() memory path: %s\n" ,strerror (errno)); -exit (1 ); +exit (EXIT_FAILURE ); }#define HUGETLBFS_MAGIC 0x958458f6
@@ -2063,7 +2063,7 @@ void kvmppc_set_papr(PowerPCCPU *cpu) ret =kvm_vcpu_enable_cap (cs,KVM_CAP_PPC_PAPR ,0 );if (ret) {error_report ("This vCPU type or KVM version does not support PAPR" ); -exit (1 ); +exit (EXIT_FAILURE ); }/* Update the capability flag so we sync the right information
@@ -2084,7 +2084,7 @@ void kvmppc_set_mpic_proxy(PowerPCCPU *cpu, int mpic_proxy) ret =kvm_vcpu_enable_cap (cs,KVM_CAP_PPC_EPR ,0 , mpic_proxy);if (ret && mpic_proxy) {error_report ("This KVM version does not support EPR" ); -exit (1 ); +exit (EXIT_FAILURE ); } }
target-ppc/translate.c +1 -1
@@ -7149,7 +7149,7 @@ void gen_intermediate_code(CPUPPCState *env, struct TranslationBlock *tb)fprintf (stderr,"Opcode %02x %02x %02x %02x (%08x) leaked " "temporaries\n" ,opc1 (ctx.opcode),opc2 (ctx.opcode),opc3 (ctx.opcode),opc4 (ctx.opcode), ctx.opcode); -exit (1 ); +exit (EXIT_FAILURE ); } }if (tb->cflags &CF_LAST_IO )
target-ppc/translate_init.c +14 -14
@@ -656,7 +656,7 @@ static inline void _spr_register(CPUPPCState *env, int num,#endif spr->uea_read != NULL || spr->uea_write != NULL) {printf ("Error: Trying to register SPR %d (%03x) twice !\n" , num, num); -exit (1 ); +exit (EXIT_FAILURE ); }#if defined(PPC_DEBUG_SPR ) printf("*** register spr %d (%03x) %s val " TARGET_FMT_lx "\n", num, num,
@@ -1742,7 +1742,7 @@ static void gen_spr_BookE (CPUPPCState *env, uint64_t ivor_mask)if (ivor_mask & (1ULL << i)) {if (ivor_sprn[i] == SPR_BOOKE_IVORxx) {fprintf (stderr,"ERROR: IVOR %d SPR is not defined\n" , i); -exit (1 ); +exit (EXIT_FAILURE ); } spr_register(env, ivor_sprn[i], ivor_names[i], SPR_NOACCESS, SPR_NOACCESS,
@@ -8974,12 +8974,12 @@ static void init_ppc_proc(PowerPCCPU *cpu)default :fprintf (stderr,"PowerPC MSR definition inconsistency\n" "Should define POWERPC_FLAG_SPE or POWERPC_FLAG_VRE\n" ); -exit (1 ); +exit (EXIT_FAILURE ); } }else if (env->flags & (POWERPC_FLAG_SPE |POWERPC_FLAG_VRE )) {fprintf (stderr,"PowerPC MSR definition inconsistency\n" "Should not define POWERPC_FLAG_SPE nor POWERPC_FLAG_VRE\n" ); -exit (1 ); +exit (EXIT_FAILURE ); }if (env->msr_mask & (1 <<17 )) {switch (env->flags & (POWERPC_FLAG_TGPR |POWERPC_FLAG_CE )) {
@@ -8989,12 +8989,12 @@ static void init_ppc_proc(PowerPCCPU *cpu)default :fprintf (stderr,"PowerPC MSR definition inconsistency\n" "Should define POWERPC_FLAG_TGPR or POWERPC_FLAG_CE\n" ); -exit (1 ); +exit (EXIT_FAILURE ); } }else if (env->flags & (POWERPC_FLAG_TGPR |POWERPC_FLAG_CE )) {fprintf (stderr,"PowerPC MSR definition inconsistency\n" "Should not define POWERPC_FLAG_TGPR nor POWERPC_FLAG_CE\n" ); -exit (1 ); +exit (EXIT_FAILURE ); }if (env->msr_mask & (1 <<10 )) { switch (env->flags & (POWERPC_FLAG_SE | POWERPC_FLAG_DWE |
@@ -9007,14 +9007,14 @@ static void init_ppc_proc(PowerPCCPU *cpu)fprintf (stderr,"PowerPC MSR definition inconsistency\n" "Should define POWERPC_FLAG_SE or POWERPC_FLAG_DWE or " "POWERPC_FLAG_UBLE\n" ); -exit (1 ); +exit (EXIT_FAILURE ); } }else if (env->flags & (POWERPC_FLAG_SE |POWERPC_FLAG_DWE |POWERPC_FLAG_UBLE )) {fprintf (stderr,"PowerPC MSR definition inconsistency\n" "Should not define POWERPC_FLAG_SE nor POWERPC_FLAG_DWE nor " "POWERPC_FLAG_UBLE\n" ); -exit (1 ); +exit (EXIT_FAILURE ); }if (env->msr_mask & (1 <<9 )) {switch (env->flags & (POWERPC_FLAG_BE |POWERPC_FLAG_DE )) {
@@ -9024,12 +9024,12 @@ static void init_ppc_proc(PowerPCCPU *cpu)default :fprintf (stderr,"PowerPC MSR definition inconsistency\n" "Should define POWERPC_FLAG_BE or POWERPC_FLAG_DE\n" ); -exit (1 ); +exit (EXIT_FAILURE ); } }else if (env->flags & (POWERPC_FLAG_BE |POWERPC_FLAG_DE )) {fprintf (stderr,"PowerPC MSR definition inconsistency\n" "Should not define POWERPC_FLAG_BE nor POWERPC_FLAG_DE\n" ); -exit (1 ); +exit (EXIT_FAILURE ); }if (env->msr_mask & (1 <<2 )) {switch (env->flags & (POWERPC_FLAG_PX |POWERPC_FLAG_PMM )) {
@@ -9039,17 +9039,17 @@ static void init_ppc_proc(PowerPCCPU *cpu)default :fprintf (stderr,"PowerPC MSR definition inconsistency\n" "Should define POWERPC_FLAG_PX or POWERPC_FLAG_PMM\n" ); -exit (1 ); +exit (EXIT_FAILURE ); } }else if (env->flags & (POWERPC_FLAG_PX |POWERPC_FLAG_PMM )) {fprintf (stderr,"PowerPC MSR definition inconsistency\n" "Should not define POWERPC_FLAG_PX nor POWERPC_FLAG_PMM\n" ); -exit (1 ); +exit (EXIT_FAILURE ); }if ((env->flags & (POWERPC_FLAG_RTC_CLK |POWERPC_FLAG_BUS_CLK )) ==0 ) {fprintf (stderr,"PowerPC flags inconsistency\n" "Should define the time-base and decrementer clock source\n" ); -exit (1 ); +exit (EXIT_FAILURE ); }/* Allocate TLBs buffer when needed */ #if !defined(CONFIG_USER_ONLY )
@@ -10365,7 +10365,7 @@ static void ppc_cpu_reset(CPUState *s) msr |= (target_ulong )1 <<MSR_LE ;/* Little-endian user mode */ if (!((env->msr_mask >>MSR_LE ) &1 )) {fprintf (stderr,"Selected CPU does not support little-endian.\n" ); -exit (1 ); +exit (EXIT_FAILURE ); }#endif #endif
tcg/ppc/tcg-target.inc.c +3 -3
@@ -2742,7 +2742,7 @@ static void __attribute__((constructor)) tcg_cache_init(void)if (isize ==0 ) {fprintf (stderr,"getauxval AT_ICACHEBSIZE failed\n" ); } -exit (1 ); +exit (EXIT_FAILURE ); } dcache_bsize = dsize; icache_bsize = isize;
@@ -2760,7 +2760,7 @@ static void __attribute__((constructor)) tcg_cache_init(void) len =sizeof (cacheline);if (sysctl (name,2 , &cacheline, &len,NULL ,0 )) {perror ("sysctl CTL_HW HW_CACHELINE failed" ); -exit (1 ); +exit (EXIT_FAILURE ); } dcache_bsize = cacheline; icache_bsize = cacheline;
@@ -2777,7 +2777,7 @@ static void __attribute__((constructor)) tcg_cache_init(void)if (sysctlbyname ("machdep.cacheline_size" , &cacheline, &len,NULL ,0 )) {fprintf (stderr,"sysctlbyname machdep.cacheline_size failed: %s\n" ,strerror (errno)); -exit (1 ); +exit (EXIT_FAILURE ); } dcache_bsize = cacheline; icache_bsize = cacheline;
Signature · 1 line
2.5.5
Re: [Qemu-devel] [PATCH 05/26] ppc: use exit(EXIT_SUCCESS) and exit(EXIT_FAILURE)
Quoted 5 lines · Laurent Vivier
This patch is the result of coccinelle script
scripts/coccinelle/exit.cocciSigned-off-by Laurent Vivier <[email protected]>CC David Gibson <[email protected]>
Quoted 992 lines
--- device_tree.c | 18 ++++++++-------- hw/intc/xics_kvm.c | 6 +++--- hw/ppc/e500.c | 14 ++++++------ hw/ppc/mac_newworld.c | 12 +++++------ hw/ppc/mac_oldworld.c | 16 +++++++------- hw/ppc/mpc8544ds.c | 2 +- hw/ppc/ppc.c | 4 ++-- hw/ppc/ppc405_boards.c | 16 +++++++------- hw/ppc/ppc440_bamboo.c | 10 ++++----- hw/ppc/ppc4xx_devs.c | 2 +- hw/ppc/prep.c | 12 +++++------ hw/ppc/spapr.c | 52 ++++++++++++++++++++++----------------------- hw/ppc/virtex_ml507.c | 4 ++-- target-ppc/kvm.c | 6 +++--- target-ppc/translate.c | 2 +- target-ppc/translate_init.c | 28 ++++++++++++------------ tcg/ppc/tcg-target.inc.c | 6 +++--- 17 files changed, 105 insertions(+), 105 deletions(-)device_tree.c +9
-9@@ -61,13 +61,13 @@ void *create_device_tree(int *sizep) ret =fdt_open_into (fdt, fdt, *sizep);if (ret) {error_report ("Unable to copy device tree in memory" ); -exit (1 ); +exit (EXIT_FAILURE ); }return fdt; fail:error_report ("%s Couldn't create dt: %s" , __func__,fdt_strerror (ret)); -exit (1 ); +exit (EXIT_FAILURE ); }void *load_device_tree (const char *filename_path,int *sizep)@@ -222,7 +222,7 @@ static int findnode_nofail(void *fdt, const char *node_path)if (offset <0 ) {error_report ("%s Couldn't find node %s: %s" , __func__, node_path,fdt_strerror (offset)); -exit (1 ); +exit (EXIT_FAILURE ); }return offset;@@ -291,7 +291,7 @@ int qemu_fdt_setprop(void *fdt, const char *node_path,if (r <0 ) {error_report ("%s: Couldn't set %s/%s: %s" , __func__, node_path, property,fdt_strerror (r)); -exit (1 ); +exit (EXIT_FAILURE ); }return r;@@ -306,7 +306,7 @@ int qemu_fdt_setprop_cell(void *fdt, const char *node_path,if (r <0 ) {error_report ("%s: Couldn't set %s/%s = %#08x: %s" , __func__, node_path, property, val,fdt_strerror (r)); -exit (1 ); +exit (EXIT_FAILURE ); }return r;@@ -328,7 +328,7 @@ int qemu_fdt_setprop_string(void *fdt, const char *node_path,if (r <0 ) {error_report ("%s: Couldn't set %s/%s = %s: %s" , __func__, node_path, property, string,fdt_strerror (r)); -exit (1 ); +exit (EXIT_FAILURE ); }return r;@@ -380,7 +380,7 @@ uint32_t qemu_fdt_get_phandle(void *fdt, const char *path)if (r ==0 ) {error_report ("%s: Couldn't get phandle for %s: %s" , __func__, path,fdt_strerror (r)); -exit (1 ); +exit (EXIT_FAILURE ); }return r;@@ -425,7 +425,7 @@ int qemu_fdt_nop_node(void *fdt, const char *node_path)if (r <0 ) {error_report ("%s: Couldn't nop node %s: %s" , __func__, node_path,fdt_strerror (r)); -exit (1 ); +exit (EXIT_FAILURE ); }return r;@@ -454,7 +454,7 @@ int qemu_fdt_add_subnode(void *fdt, const char *name)if (retval <0 ) {error_report ("FDT: Failed to create subnode %s: %s" , name,fdt_strerror (retval)); -exit (1 ); +exit (EXIT_FAILURE ); }g_free (dupname);hw/intc/xics_kvm.c +3
-3@@ -67,7 +67,7 @@ static void icp_get_kvm_state(ICPState *ss)if (ret !=0 ) {error_report ("Unable to retrieve KVM interrupt controller state" " for CPU %ld: %s" ,kvm_arch_vcpu_id (ss->cs),strerror (errno)); -exit (1 ); +exit (EXIT_FAILURE ); } ss->xirr = state >>KVM_REG_PPC_ICP_XISR_SHIFT ;@@ -164,7 +164,7 @@ static void ics_get_kvm_state(ICSState *ics)if (ret !=0 ) {error_report ("Unable to retrieve KVM interrupt controller state" " for IRQ %d: %s" , i + ics->offset,strerror (errno)); -exit (1 ); +exit (EXIT_FAILURE ); } irq->server = state &KVM_XICS_DESTINATION_MASK ;@@ -353,7 +353,7 @@ static void xics_kvm_cpu_setup(XICSState *xics, PowerPCCPU *cpu)if (ret <0 ) {error_report ("Unable to connect CPU%ld to kernel XICS: %s" ,kvm_arch_vcpu_id (cs),strerror (errno)); -exit (1 ); +exit (EXIT_FAILURE ); } ss->cap_irq_xics_enabled = true; }hw/ppc/e500.c +7
-7@@ -209,7 +209,7 @@ static int sysbus_device_create_devtree(SysBusDevice *sbdev, void *opaque)if (!matched) {error_report ("Device %s is not supported by this machine yet." ,qdev_fw_name (DEVICE (sbdev))); -exit (1 ); +exit (EXIT_FAILURE ); }return 0 ;@@ -754,7 +754,7 @@ static qemu_irq *ppce500_init_mpic(MachineState *machine, PPCE500Params *params,if (machine_kernel_irqchip_required (machine) && !dev) {error_reportf_err (err,"kernel_irqchip requested but unavailable: " ); -exit (1 ); +exit (EXIT_FAILURE ); } }@@ -824,7 +824,7 @@ void ppce500_init(MachineState *machine, PPCE500Params *params) cpu =cpu_ppc_init (machine->cpu_model);if (cpu ==NULL ) {fprintf (stderr,"Unable to initialize CPU!\n" ); -exit (1 ); +exit (EXIT_FAILURE ); } env = &cpu->env; cs =CPU (cpu);@@ -972,7 +972,7 @@ void ppce500_init(MachineState *machine, PPCE500Params *params)if (kernel_size <0 ) {fprintf (stderr,"qemu: could not load kernel '%s'\n" , machine->kernel_filename); -exit (1 ); +exit (EXIT_FAILURE ); } cur_base += kernel_size;@@ -987,7 +987,7 @@ void ppce500_init(MachineState *machine, PPCE500Params *params)if (initrd_size <0 ) {fprintf (stderr,"qemu: could not load initial ram disk '%s'\n" , machine->initrd_filename); -exit (1 ); +exit (EXIT_FAILURE ); } cur_base = initrd_base + initrd_size;@@ -1028,7 +1028,7 @@ void ppce500_init(MachineState *machine, PPCE500Params *params) NULL, NULL);if (kernel_size <0 ) {fprintf (stderr,"qemu: could not load firmware '%s'\n" , filename); -exit (1 ); +exit (EXIT_FAILURE ); } }g_free (filename);@@ -1041,7 +1041,7 @@ void ppce500_init(MachineState *machine, PPCE500Params *params) kernel_base, kernel_size);if (dt_size <0 ) {fprintf (stderr,"couldn't load device tree\n" ); -exit (1 ); +exit (EXIT_FAILURE ); }assert (dt_size <DTB_MAX_SIZE );hw/ppc/mac_newworld.c +6
-6@@ -196,7 +196,7 @@ static void ppc_core99_init(MachineState *machine) cpu =cpu_ppc_init (machine->cpu_model);if (cpu ==NULL ) {fprintf (stderr,"Unable to find PowerPC CPU definition\n" ); -exit (1 ); +exit (EXIT_FAILURE ); } env = &cpu->env;@@ -231,7 +231,7 @@ static void ppc_core99_init(MachineState *machine) }if (bios_size <0 || bios_size >BIOS_SIZE ) {error_report ("could not load PowerPC bios '%s'" , bios_name); -exit (1 ); +exit (EXIT_FAILURE ); }if (linux_boot) {@@ -258,7 +258,7 @@ static void ppc_core99_init(MachineState *machine) ram_size - kernel_base);if (kernel_size <0 ) {error_report ("could not load kernel '%s'" , kernel_filename); -exit (1 ); +exit (EXIT_FAILURE ); }/* load initrd */ if (initrd_filename) {@@ -268,7 +268,7 @@ static void ppc_core99_init(MachineState *machine)if (initrd_size <0 ) {error_report ("could not load initial ram disk '%s'" , initrd_filename); -exit (1 ); +exit (EXIT_FAILURE ); } cmdline_base =round_page (initrd_base + initrd_size); }else {@@ -294,7 +294,7 @@ static void ppc_core99_init(MachineState *machine) }if (ppc_boot_device =='\0' ) {fprintf (stderr,"No valid boot device for Mac99 machine\n" ); -exit (1 ); +exit (EXIT_FAILURE ); } }@@ -350,7 +350,7 @@ static void ppc_core99_init(MachineState *machine)#endif /* defined(TARGET_PPC64) */ default :error_report ("Bus model not supported on mac99 machine" ); -exit (1 ); +exit (EXIT_FAILURE ); } }hw/ppc/mac_oldworld.c +8
-8@@ -116,7 +116,7 @@ static void ppc_heathrow_init(MachineState *machine) cpu =cpu_ppc_init (machine->cpu_model);if (cpu ==NULL ) {fprintf (stderr,"Unable to find PowerPC CPU definition\n" ); -exit (1 ); +exit (EXIT_FAILURE ); } env = &cpu->env;@@ -130,7 +130,7 @@ static void ppc_heathrow_init(MachineState *machine)fprintf (stderr,"qemu: Too much memory for this machine: %d MB, maximum 2047 MB\n" , ((unsigned int )ram_size / (1 <<20 ))); -exit (1 ); +exit (EXIT_FAILURE ); } memory_region_allocate_system_memory(ram, NULL, "ppc_heathrow.ram",@@ -158,7 +158,7 @@ static void ppc_heathrow_init(MachineState *machine) }if (bios_size <0 || bios_size >BIOS_SIZE ) {error_report ("could not load PowerPC bios '%s'" , bios_name); -exit (1 ); +exit (EXIT_FAILURE ); }if (linux_boot) {@@ -184,7 +184,7 @@ static void ppc_heathrow_init(MachineState *machine) ram_size - kernel_base);if (kernel_size <0 ) {error_report ("could not load kernel '%s'" , kernel_filename); -exit (1 ); +exit (EXIT_FAILURE ); }/* load initrd */ if (initrd_filename) {@@ -194,7 +194,7 @@ static void ppc_heathrow_init(MachineState *machine)if (initrd_size <0 ) {error_report ("could not load initial ram disk '%s'" , initrd_filename); -exit (1 ); +exit (EXIT_FAILURE ); } cmdline_base =round_page (initrd_base + initrd_size); }else {@@ -228,7 +228,7 @@ static void ppc_heathrow_init(MachineState *machine) }if (ppc_boot_device =='\0' ) {fprintf (stderr,"No valid boot device for G3 Beige machine\n" ); -exit (1 ); +exit (EXIT_FAILURE ); } }@@ -251,7 +251,7 @@ static void ppc_heathrow_init(MachineState *machine)break ;default :error_report ("Bus model not supported on OldWorld Mac machine" ); -exit (1 ); +exit (EXIT_FAILURE ); } }@@ -265,7 +265,7 @@ static void ppc_heathrow_init(MachineState *machine)/* init basic PC hardware */ if (PPC_INPUT (env) != PPC_FLAGS_INPUT_6xx) {error_report ("Only 6xx bus is supported on heathrow machine" ); -exit (1 ); +exit (EXIT_FAILURE ); } pic =heathrow_pic_init (&pic_mem,1 , heathrow_irqs); pci_bus = pci_grackle_init(0xfec00000, pic,hw/ppc/mpc8544ds.c +1
-1@@ -43,7 +43,7 @@ static void mpc8544ds_init(MachineState *machine)if (machine->ram_size >0xc0000000 ) {error_report ("The MPC8544DS board only supports up to 3GB of RAM" ); -exit (1 ); +exit (EXIT_FAILURE ); }ppce500_init (machine, ¶ms);hw/ppc/ppc.c +2
-2@@ -1362,13 +1362,13 @@ void ppc_cpu_parse_features(const char *cpu_model) model_pieces =g_strsplit (cpu_model,"," ,2 );if (!model_pieces[0 ]) {error_report ("Invalid/empty CPU model name" ); -exit (1 ); +exit (EXIT_FAILURE ); } oc =cpu_class_by_name (TYPE_POWERPC_CPU , model_pieces[0 ]);if (oc ==NULL ) {error_report ("Unable to find CPU definition: %s" , model_pieces[0 ]); -exit (1 ); +exit (EXIT_FAILURE ); } typename =object_class_get_name (oc);hw/ppc/ppc405_boards.c +8
-8@@ -266,13 +266,13 @@ static void ref405ep_init(MachineState *machine)g_free (filename);if (bios_size <0 || bios_size >BIOS_SIZE ) {error_report ("Could not load PowerPC BIOS '%s'" , bios_name); -exit (1 ); +exit (EXIT_FAILURE ); } bios_size = (bios_size +0xfff ) & ~0xfff ;memory_region_add_subregion (sysmem, (uint32_t )(-bios_size), bios); }else if (!qtest_enabled () || kernel_filename !=NULL ) {error_report ("Could not load PowerPC BIOS '%s'" , bios_name); -exit (1 ); +exit (EXIT_FAILURE ); }else {/* Avoid an uninitialized variable warning */ bios_size =-1 ;@@ -329,7 +329,7 @@ static void ref405ep_init(MachineState *machine)if (kernel_size <0 ) {fprintf (stderr,"qemu: could not load kernel '%s'\n" , kernel_filename); -exit (1 ); +exit (EXIT_FAILURE ); }printf ("Load kernel size %ld at " TARGET_FMT_lx, kernel_size, kernel_base);@@ -341,7 +341,7 @@ static void ref405ep_init(MachineState *machine)if (initrd_size <0 ) {fprintf (stderr,"qemu: could not load initial ram disk '%s'\n" , initrd_filename); -exit (1 ); +exit (EXIT_FAILURE ); } }else { initrd_base =0 ;@@ -564,13 +564,13 @@ static void taihu_405ep_init(MachineState *machine)g_free (filename);if (bios_size <0 || bios_size >BIOS_SIZE ) {error_report ("Could not load PowerPC BIOS '%s'" , bios_name); -exit (1 ); +exit (EXIT_FAILURE ); } bios_size = (bios_size +0xfff ) & ~0xfff ;memory_region_add_subregion (sysmem, (uint32_t )(-bios_size), bios); }else if (!qtest_enabled ()) {error_report ("Could not load PowerPC BIOS '%s'" , bios_name); -exit (1 ); +exit (EXIT_FAILURE ); }memory_region_set_readonly (bios, true); }@@ -613,7 +613,7 @@ static void taihu_405ep_init(MachineState *machine)if (kernel_size <0 ) {fprintf (stderr,"qemu: could not load kernel '%s'\n" , kernel_filename); -exit (1 ); +exit (EXIT_FAILURE ); }/* load initrd */ if (initrd_filename) {@@ -624,7 +624,7 @@ static void taihu_405ep_init(MachineState *machine)fprintf (stderr,"qemu: could not load initial ram disk '%s'\n" , initrd_filename); -exit (1 ); +exit (EXIT_FAILURE ); } }else { initrd_base =0 ;hw/ppc/ppc440_bamboo.c +5
-5@@ -189,7 +189,7 @@ static void bamboo_init(MachineState *machine) cpu =cpu_ppc_init (machine->cpu_model);if (cpu ==NULL ) {fprintf (stderr,"Unable to initialize CPU!\n" ); -exit (1 ); +exit (EXIT_FAILURE ); } env = &cpu->env;@@ -223,7 +223,7 @@ static void bamboo_init(MachineState *machine) pcibus = (PCIBus *)qdev_get_child_bus (dev,"pci.0" );if (!pcibus) {fprintf (stderr,"couldn't create PCI controller!\n" ); -exit (1 ); +exit (EXIT_FAILURE ); } memory_region_init_alias(isa, NULL, "isa_mmio",@@ -265,7 +265,7 @@ static void bamboo_init(MachineState *machine)if (success <0 ) {fprintf (stderr,"qemu: could not load kernel '%s'\n" , kernel_filename); -exit (1 ); +exit (EXIT_FAILURE ); } }@@ -277,7 +277,7 @@ static void bamboo_init(MachineState *machine)if (initrd_size <0 ) {fprintf (stderr,"qemu: could not load ram disk '%s' at %x\n" , initrd_filename,RAMDISK_ADDR ); -exit (1 ); +exit (EXIT_FAILURE ); } }@@ -286,7 +286,7 @@ static void bamboo_init(MachineState *machine)if (bamboo_load_device_tree (FDT_ADDR , ram_size,RAMDISK_ADDR , initrd_size, kernel_cmdline) <0 ) {fprintf (stderr,"couldn't load device tree\n" ); -exit (1 ); +exit (EXIT_FAILURE ); } } }hw/ppc/ppc4xx_devs.c +1
-1@@ -60,7 +60,7 @@ PowerPCCPU *ppc4xx_init(const char *cpu_model,if (cpu ==NULL ) {fprintf (stderr,"Unable to find PowerPC %s CPU definition\n" , cpu_model); -exit (1 ); +exit (EXIT_FAILURE ); } env = &cpu->env;hw/ppc/prep.c +6
-6@@ -512,7 +512,7 @@ static void ppc_prep_init(MachineState *machine) cpu =cpu_ppc_init (machine->cpu_model);if (cpu ==NULL ) {fprintf (stderr,"Unable to find PowerPC CPU definition\n" ); -exit (1 ); +exit (EXIT_FAILURE ); } env = &cpu->env;@@ -537,7 +537,7 @@ static void ppc_prep_init(MachineState *machine) ram_size - kernel_base);if (kernel_size <0 ) {error_report ("could not load kernel '%s'" , kernel_filename); -exit (1 ); +exit (EXIT_FAILURE ); }/* load initrd */ if (initrd_filename) {@@ -547,7 +547,7 @@ static void ppc_prep_init(MachineState *machine)if (initrd_size <0 ) {error_report ("could not load initial ram disk '%s'" , initrd_filename); -exit (1 ); +exit (EXIT_FAILURE ); } }else { initrd_base =0 ;@@ -569,13 +569,13 @@ static void ppc_prep_init(MachineState *machine) }if (ppc_boot_device =='\0' ) {fprintf (stderr,"No valid boot device for Mac99 machine\n" ); -exit (1 ); +exit (EXIT_FAILURE ); } }if (PPC_INPUT (env) != PPC_FLAGS_INPUT_6xx) {error_report ("Only 6xx bus is supported on PREP machine" ); -exit (1 ); +exit (EXIT_FAILURE ); } dev =qdev_create (NULL ,"raven-pcihost" );@@ -590,7 +590,7 @@ static void ppc_prep_init(MachineState *machine) pci_bus = (PCIBus *)qdev_get_child_bus (dev,"pci.0" );if (pci_bus ==NULL ) {fprintf (stderr,"Couldn't create PCI host controller.\n" ); -exit (1 ); +exit (EXIT_FAILURE ); } sysctrl->contiguous_map_irq =qdev_get_gpio_in (dev,0 );hw/ppc/spapr.c +26
-26@@ -912,20 +912,20 @@ static void spapr_finalize_fdt(sPAPRMachineState *spapr, ret =spapr_populate_memory (spapr, fdt);if (ret <0 ) {error_report ("couldn't setup memory nodes in fdt" ); -exit (1 ); +exit (EXIT_FAILURE ); } ret =spapr_populate_vdevice (spapr->vio_bus, fdt);if (ret <0 ) {error_report ("couldn't setup vio devices in fdt" ); -exit (1 ); +exit (EXIT_FAILURE ); }if (object_resolve_path_type ("" ,TYPE_SPAPR_RNG ,NULL )) { ret =spapr_rng_populate_dt (fdt);if (ret <0 ) {error_report ("could not set up rng device in the fdt" ); -exit (1 ); +exit (EXIT_FAILURE ); } }@@ -933,7 +933,7 @@ static void spapr_finalize_fdt(sPAPRMachineState *spapr, ret =spapr_populate_pci_dt (phb,PHANDLE_XICP , fdt);if (ret <0 ) {error_report ("couldn't setup PCI devices in fdt" ); -exit (1 ); +exit (EXIT_FAILURE ); } }@@ -950,7 +950,7 @@ static void spapr_finalize_fdt(sPAPRMachineState *spapr,if (cb && bootlist) {int offset =fdt_path_offset (fdt,"/chosen" );if (offset <0 ) { -exit (1 ); +exit (EXIT_FAILURE ); }for (i =0 ; i < cb; i++) {if (bootlist[i] =='\n' ) {@@ -965,7 +965,7 @@ static void spapr_finalize_fdt(sPAPRMachineState *spapr,int offset =fdt_path_offset (fdt,"/chosen" );if (offset <0 ) { -exit (1 ); +exit (EXIT_FAILURE ); }fdt_setprop_string (fdt, offset,"qemu,boot-device" , boot_device); }@@ -984,7 +984,7 @@ static void spapr_finalize_fdt(sPAPRMachineState *spapr, SPAPR_DR_CONNECTOR_TYPE_CPU);if (ret <0 ) {error_report ("Couldn't set up CPU DR device tree properties" ); -exit (1 ); +exit (EXIT_FAILURE ); } }@@ -993,7 +993,7 @@ static void spapr_finalize_fdt(sPAPRMachineState *spapr,if (fdt_totalsize (fdt) >FDT_MAX_SIZE ) {error_report ("FDT too big ! 0x%x bytes (max is 0x%x)" ,fdt_totalsize (fdt),FDT_MAX_SIZE ); -exit (1 ); +exit (EXIT_FAILURE ); }qemu_fdt_dumpdtb (fdt,fdt_totalsize (fdt));@@ -1126,7 +1126,7 @@ static int find_unknown_sysbus_device(SysBusDevice *sbdev, void *opaque)if (!matched) {error_report ("Device %s is not supported by this machine yet." ,qdev_fw_name (DEVICE (sbdev))); -exit (1 ); +exit (EXIT_FAILURE ); }return 0 ;@@ -1696,12 +1696,12 @@ static void ppc_spapr_init(MachineState *machine)if (smp_cpus % smp_threads) {error_report ("smp_cpus (%u) must be multiple of threads (%u)" , smp_cpus, smp_threads); -exit (1 ); +exit (EXIT_FAILURE ); }if (max_cpus % smp_threads) {error_report ("max_cpus (%u) must be multiple of threads (%u)" , max_cpus, smp_threads); -exit (1 ); +exit (EXIT_FAILURE ); } }@@ -1716,7 +1716,7 @@ static void ppc_spapr_init(MachineState *machine)if (rma_alloc_size ==-1 ) {error_report ("Unable to create RMA" ); -exit (1 ); +exit (EXIT_FAILURE ); }if (rma_alloc_size && (rma_alloc_size < node0_size)) {@@ -1749,7 +1749,7 @@ static void ppc_spapr_init(MachineState *machine)if (spapr->rma_size > node0_size) {error_report ("Numa node 0 has to span the RMA (%#08" HWADDR_PRIx")" , spapr->rma_size); -exit (1 ); +exit (EXIT_FAILURE ); }/* Setup a load limit for the ramdisk leaving room for SLOF and FDT */ @@ -1776,7 +1776,7 @@ static void ppc_spapr_init(MachineState *machine)if (type ==NULL ) {error_report ("Unable to find sPAPR CPU Core definition" ); -exit (1 ); +exit (EXIT_FAILURE ); } spapr->cores = g_new0(Object *, spapr_max_cores);@@ -1804,7 +1804,7 @@ static void ppc_spapr_init(MachineState *machine)PowerPCCPU *cpu =cpu_ppc_init (machine->cpu_model);if (cpu ==NULL ) {error_report ("Unable to find PowerPC CPU definition" ); -exit (1 ); +exit (EXIT_FAILURE ); }spapr_cpu_init (spapr, cpu, &error_fatal); }@@ -1847,7 +1847,7 @@ static void ppc_spapr_init(MachineState *machine)error_report ("Specified number of memory slots %" PRIu64" exceeds max supported %d" , machine->ram_slots, max_memslots); -exit (1 ); +exit (EXIT_FAILURE ); } spapr->hotplug_memory.base = ROUND_UP(machine->ram_size,@@ -1865,22 +1865,22 @@ static void ppc_spapr_init(MachineState *machine) filename =qemu_find_file (QEMU_FILE_TYPE_BIOS ,"spapr-rtas.bin" );if (!filename) {error_report ("Could not find LPAR rtas '%s'" ,"spapr-rtas.bin" ); -exit (1 ); +exit (EXIT_FAILURE ); } spapr->rtas_size =get_image_size (filename);if (spapr->rtas_size <0 ) {error_report ("Could not get size of LPAR rtas '%s'" , filename); -exit (1 ); +exit (EXIT_FAILURE ); } spapr->rtas_blob =g_malloc (spapr->rtas_size);if (load_image_size (filename, spapr->rtas_blob, spapr->rtas_size) <0 ) {error_report ("Could not load LPAR rtas '%s'" , filename); -exit (1 ); +exit (EXIT_FAILURE ); }if (spapr->rtas_size >RTAS_MAX_SIZE ) {error_report ("RTAS too big ! 0x%zx bytes (max is 0x%x)" , (size_t )spapr->rtas_size,RTAS_MAX_SIZE ); -exit (1 ); +exit (EXIT_FAILURE ); }g_free (filename);@@ -1950,7 +1950,7 @@ static void ppc_spapr_init(MachineState *machine)error_report ("pSeries SLOF firmware requires >= %ldM guest RMA (Real Mode Area memory)" ,MIN_RMA_SLOF ); -exit (1 ); +exit (EXIT_FAILURE ); }if (kernel_filename) {@@ -1969,7 +1969,7 @@ static void ppc_spapr_init(MachineState *machine)if (kernel_size <0 ) {error_report ("error loading %s: %s" , kernel_filename,load_elf_strerror (kernel_size)); -exit (1 ); +exit (EXIT_FAILURE ); }/* load initrd */ @@ -1983,7 +1983,7 @@ static void ppc_spapr_init(MachineState *machine)if (initrd_size <0 ) {error_report ("could not load initial ram disk '%s'" , initrd_filename); -exit (1 ); +exit (EXIT_FAILURE ); } }else { initrd_base =0 ;@@ -1997,12 +1997,12 @@ static void ppc_spapr_init(MachineState *machine) filename =qemu_find_file (QEMU_FILE_TYPE_BIOS , bios_name);if (!filename) {error_report ("Could not find LPAR firmware '%s'" , bios_name); -exit (1 ); +exit (EXIT_FAILURE ); } fw_size =load_image_targphys (filename,0 ,FW_MAX_SIZE );if (fw_size <=0 ) {error_report ("Could not load LPAR firmware '%s'" , filename); -exit (1 ); +exit (EXIT_FAILURE ); }g_free (filename);@@ -2042,7 +2042,7 @@ static int spapr_kvm_type(const char *vm_type) }error_report ("Unknown kvm-type specified '%s'" , vm_type); -exit (1 ); +exit (EXIT_FAILURE ); }/* hw/ppc/virtex_ml507.c +2
-2@@ -99,7 +99,7 @@ static PowerPCCPU *ppc440_init_xilinx(ram_addr_t *ram_size, cpu =cpu_ppc_init (cpu_model);if (cpu ==NULL ) {fprintf (stderr,"Unable to initialize CPU!\n" ); -exit (1 ); +exit (EXIT_FAILURE ); } env = &cpu->env;@@ -284,7 +284,7 @@ static void virtex_init(MachineState *machine)if (initrd_size <0 ) {error_report ("couldn't load ram disk '%s'" , machine->initrd_filename); -exit (1 ); +exit (EXIT_FAILURE ); } high =ROUND_UP (high + initrd_size,4 ); }target-ppc/kvm.c +3
-3@@ -323,7 +323,7 @@ static long gethugepagesize(const char *mem_path)if (ret !=0 ) {fprintf (stderr,"Couldn't statfs() memory path: %s\n" ,strerror (errno)); -exit (1 ); +exit (EXIT_FAILURE ); }#define HUGETLBFS_MAGIC 0x958458f6@@ -2063,7 +2063,7 @@ void kvmppc_set_papr(PowerPCCPU *cpu) ret =kvm_vcpu_enable_cap (cs,KVM_CAP_PPC_PAPR ,0 );if (ret) {error_report ("This vCPU type or KVM version does not support PAPR" ); -exit (1 ); +exit (EXIT_FAILURE ); }/* Update the capability flag so we sync the right information @@ -2084,7 +2084,7 @@ void kvmppc_set_mpic_proxy(PowerPCCPU *cpu, int mpic_proxy) ret =kvm_vcpu_enable_cap (cs,KVM_CAP_PPC_EPR ,0 , mpic_proxy);if (ret && mpic_proxy) {error_report ("This KVM version does not support EPR" ); -exit (1 ); +exit (EXIT_FAILURE ); } }target-ppc/translate.c +1
-1@@ -7149,7 +7149,7 @@ void gen_intermediate_code(CPUPPCState *env, struct TranslationBlock *tb)fprintf (stderr,"Opcode %02x %02x %02x %02x (%08x) leaked " "temporaries\n" ,opc1 (ctx.opcode),opc2 (ctx.opcode),opc3 (ctx.opcode),opc4 (ctx.opcode), ctx.opcode); -exit (1 ); +exit (EXIT_FAILURE ); } }if (tb->cflags &CF_LAST_IO )target-ppc/translate_init.c +14
-14@@ -656,7 +656,7 @@ static inline void _spr_register(CPUPPCState *env, int num,#endif spr->uea_read != NULL || spr->uea_write != NULL) {printf ("Error: Trying to register SPR %d (%03x) twice !\n" , num, num); -exit (1 ); +exit (EXIT_FAILURE ); }#if defined(PPC_DEBUG_SPR ) printf("*** register spr %d (%03x) %s val " TARGET_FMT_lx "\n", num, num,@@ -1742,7 +1742,7 @@ static void gen_spr_BookE (CPUPPCState *env, uint64_t ivor_mask)if (ivor_mask & (1ULL << i)) {if (ivor_sprn[i] == SPR_BOOKE_IVORxx) {fprintf (stderr,"ERROR: IVOR %d SPR is not defined\n" , i); -exit (1 ); +exit (EXIT_FAILURE ); } spr_register(env, ivor_sprn[i], ivor_names[i], SPR_NOACCESS, SPR_NOACCESS,@@ -8974,12 +8974,12 @@ static void init_ppc_proc(PowerPCCPU *cpu)default :fprintf (stderr,"PowerPC MSR definition inconsistency\n" "Should define POWERPC_FLAG_SPE or POWERPC_FLAG_VRE\n" ); -exit (1 ); +exit (EXIT_FAILURE ); } }else if (env->flags & (POWERPC_FLAG_SPE |POWERPC_FLAG_VRE )) {fprintf (stderr,"PowerPC MSR definition inconsistency\n" "Should not define POWERPC_FLAG_SPE nor POWERPC_FLAG_VRE\n" ); -exit (1 ); +exit (EXIT_FAILURE ); }if (env->msr_mask & (1 <<17 )) {switch (env->flags & (POWERPC_FLAG_TGPR |POWERPC_FLAG_CE )) {@@ -8989,12 +8989,12 @@ static void init_ppc_proc(PowerPCCPU *cpu)default :fprintf (stderr,"PowerPC MSR definition inconsistency\n" "Should define POWERPC_FLAG_TGPR or POWERPC_FLAG_CE\n" ); -exit (1 ); +exit (EXIT_FAILURE ); } }else if (env->flags & (POWERPC_FLAG_TGPR |POWERPC_FLAG_CE )) {fprintf (stderr,"PowerPC MSR definition inconsistency\n" "Should not define POWERPC_FLAG_TGPR nor POWERPC_FLAG_CE\n" ); -exit (1 ); +exit (EXIT_FAILURE ); }if (env->msr_mask & (1 <<10 )) { switch (env->flags & (POWERPC_FLAG_SE | POWERPC_FLAG_DWE |@@ -9007,14 +9007,14 @@ static void init_ppc_proc(PowerPCCPU *cpu)fprintf (stderr,"PowerPC MSR definition inconsistency\n" "Should define POWERPC_FLAG_SE or POWERPC_FLAG_DWE or " "POWERPC_FLAG_UBLE\n" ); -exit (1 ); +exit (EXIT_FAILURE ); } }else if (env->flags & (POWERPC_FLAG_SE |POWERPC_FLAG_DWE |POWERPC_FLAG_UBLE )) {fprintf (stderr,"PowerPC MSR definition inconsistency\n" "Should not define POWERPC_FLAG_SE nor POWERPC_FLAG_DWE nor " "POWERPC_FLAG_UBLE\n" ); -exit (1 ); +exit (EXIT_FAILURE ); }if (env->msr_mask & (1 <<9 )) {switch (env->flags & (POWERPC_FLAG_BE |POWERPC_FLAG_DE )) {@@ -9024,12 +9024,12 @@ static void init_ppc_proc(PowerPCCPU *cpu)default :fprintf (stderr,"PowerPC MSR definition inconsistency\n" "Should define POWERPC_FLAG_BE or POWERPC_FLAG_DE\n" ); -exit (1 ); +exit (EXIT_FAILURE ); } }else if (env->flags & (POWERPC_FLAG_BE |POWERPC_FLAG_DE )) {fprintf (stderr,"PowerPC MSR definition inconsistency\n" "Should not define POWERPC_FLAG_BE nor POWERPC_FLAG_DE\n" ); -exit (1 ); +exit (EXIT_FAILURE ); }if (env->msr_mask & (1 <<2 )) {switch (env->flags & (POWERPC_FLAG_PX |POWERPC_FLAG_PMM )) {@@ -9039,17 +9039,17 @@ static void init_ppc_proc(PowerPCCPU *cpu)default :fprintf (stderr,"PowerPC MSR definition inconsistency\n" "Should define POWERPC_FLAG_PX or POWERPC_FLAG_PMM\n" ); -exit (1 ); +exit (EXIT_FAILURE ); } }else if (env->flags & (POWERPC_FLAG_PX |POWERPC_FLAG_PMM )) {fprintf (stderr,"PowerPC MSR definition inconsistency\n" "Should not define POWERPC_FLAG_PX nor POWERPC_FLAG_PMM\n" ); -exit (1 ); +exit (EXIT_FAILURE ); }if ((env->flags & (POWERPC_FLAG_RTC_CLK |POWERPC_FLAG_BUS_CLK )) ==0 ) {fprintf (stderr,"PowerPC flags inconsistency\n" "Should define the time-base and decrementer clock source\n" ); -exit (1 ); +exit (EXIT_FAILURE ); }/* Allocate TLBs buffer when needed */ #if !defined(CONFIG_USER_ONLY )@@ -10365,7 +10365,7 @@ static void ppc_cpu_reset(CPUState *s) msr |= (target_ulong )1 <<MSR_LE ;/* Little-endian user mode */ if (!((env->msr_mask >>MSR_LE ) &1 )) {fprintf (stderr,"Selected CPU does not support little-endian.\n" ); -exit (1 ); +exit (EXIT_FAILURE ); }#endif #endif tcg/ppc/tcg-target.inc.c +3
-3@@ -2742,7 +2742,7 @@ static void __attribute__((constructor)) tcg_cache_init(void)if (isize ==0 ) {fprintf (stderr,"getauxval AT_ICACHEBSIZE failed\n" ); } -exit (1 ); +exit (EXIT_FAILURE ); } dcache_bsize = dsize; icache_bsize = isize;@@ -2760,7 +2760,7 @@ static void __attribute__((constructor)) tcg_cache_init(void) len =sizeof (cacheline);if (sysctl (name,2 , &cacheline, &len,NULL ,0 )) {perror ("sysctl CTL_HW HW_CACHELINE failed" ); -exit (1 ); +exit (EXIT_FAILURE ); } dcache_bsize = cacheline; icache_bsize = cacheline;@@ -2777,7 +2777,7 @@ static void __attribute__((constructor)) tcg_cache_init(void)if (sysctlbyname ("machdep.cacheline_size" , &cacheline, &len,NULL ,0 )) {fprintf (stderr,"sysctlbyname machdep.cacheline_size failed: %s\n" ,strerror (errno)); -exit (1 ); +exit (EXIT_FAILURE ); } dcache_bsize = cacheline; icache_bsize = cacheline;Signature · 1 line
2.5.5
Signature · 4 lines
David Gibson | I'll have my music baroque, and my code david AT gibson.dropbear.id.au | minimalist, thank you. NOT _the_ _other_ | _way_ _around_! http://www.ozlabs.org/~dgibson
PATCH 6/26 graphics: use exit(EXIT_SUCCESS) and exit(EXIT_FAILURE)
In reply to Laurent VivierThis patch is the result of coccinelle scriptscripts/coccinelle/exit.cocci
--- ui/console-gl.c | 2 +- ui/console.c | 2 +- ui/curses.c | 4 ++-- ui/gtk.c | 2 +- ui/sdl.c | 8 ++++---- ui/sdl2.c | 2 +- ui/spice-core.c | 22 +++++++++++----------- ui/vnc.c | 4 ++-- 8 files changed, 23 insertions(+), 23 deletions(-)
ui/console-gl.c +1 -1
@@ -46,7 +46,7 @@ ConsoleGLState *console_gl_init_context(void) gls->texture_blit_prog =qemu_gl_create_compile_link_program (texture_blit_vert_src, texture_blit_frag_src);if (!gls->texture_blit_prog) { -exit (1 ); +exit (EXIT_FAILURE ); } gls->texture_blit_vao =
ui/console.c +1 -1
@@ -1389,7 +1389,7 @@ void register_displaychangelistener(DisplayChangeListener *dcl)if (dcl->con->gl) {fprintf (stderr,"can't register two opengl displays (%s, %s)\n" , dcl->ops->dpy_name, dcl->con->gl->ops->dpy_name); -exit (1 ); +exit (EXIT_FAILURE ); } dcl->con->gl = dcl; }
ui/curses.c +2 -2
@@ -408,7 +408,7 @@ static void curses_keyboard_setup(void)if (keyboard_layout) { kbd_layout =init_keyboard_layout (name2keysym, keyboard_layout);if (!kbd_layout) -exit (1 ); +exit (EXIT_FAILURE ); } }
@@ -425,7 +425,7 @@ void curses_display_init(DisplayState *ds, int full_screen)#ifndef _WIN32if (!isatty (1 )) {fprintf (stderr,"We need a terminal output\n" ); -exit (1 ); +exit (EXIT_FAILURE ); }#endif
ui/gtk.c +1 -1
@@ -2158,7 +2158,7 @@ void gtk_display_init(DisplayState *ds, bool full_screen, bool grab_on_hover)if (!gtkinit) {fprintf (stderr,"gtk initialization failed\n" ); -exit (1 ); +exit (EXIT_FAILURE ); } s->window =gtk_window_new (GTK_WINDOW_TOPLEVEL );
ui/sdl.c +4 -4
@@ -92,7 +92,7 @@ static void sdl_update(DisplayChangeListener *dcl, }else {if (sdl_zoom_blit (guest_screen, real_screen,SMOOTHING_ON , &rec) <0 ) {fprintf (stderr,"Zoom blit failed\n" ); -exit (1 ); +exit (EXIT_FAILURE ); } } }
@@ -122,7 +122,7 @@ static void do_sdl_resize(int width, int height, int bpp)if (!tmp_screen) {fprintf (stderr,"Could not open SDL display (%dx%dx%d): %s\n" , width, height, bpp,SDL_GetError ()); -exit (1 ); +exit (EXIT_FAILURE ); } }else {/*
@@ -957,7 +957,7 @@ void sdl_display_init(DisplayState *ds, int full_screen, int no_frame)if (keyboard_layout) { kbd_layout =init_keyboard_layout (name2keysym, keyboard_layout);if (!kbd_layout) -exit (1 ); +exit (EXIT_FAILURE ); }if (no_frame)
@@ -987,7 +987,7 @@ void sdl_display_init(DisplayState *ds, int full_screen, int no_frame)if (SDL_Init (flags)) {fprintf (stderr,"Could not initialize SDL(%s) - exiting\n" ,SDL_GetError ()); -exit (1 ); +exit (EXIT_FAILURE ); } vi =SDL_GetVideoInfo (); host_format = *(vi->vfmt);
ui/sdl2.c +1 -1
@@ -783,7 +783,7 @@ void sdl_display_init(DisplayState *ds, int full_screen, int no_frame)if (SDL_Init (flags)) {fprintf (stderr,"Could not initialize SDL(%s) - exiting\n" ,SDL_GetError ()); -exit (1 ); +exit (EXIT_FAILURE ); }SDL_SetHint (SDL_HINT_GRAB_KEYBOARD ,"1" );
ui/spice-core.c +11 -11
@@ -333,7 +333,7 @@ static int parse_name(const char *string, const char *optname,return value; }error_report ("spice: invalid %s: %s" , optname, string); -exit (1 ); +exit (EXIT_FAILURE ); }static const char *stream_video_names[] = {
@@ -605,7 +605,7 @@ static int add_channel(void *opaque, const char *name, const char *value,if (!*tls_port) {error_report ("spice: tried to setup tls-channel" " without specifying a TLS port" ); -exit (1 ); +exit (EXIT_FAILURE ); } security =SPICE_CHANNEL_SECURITY_SSL ; }
@@ -622,7 +622,7 @@ static int add_channel(void *opaque, const char *name, const char *value, }if (rc !=0 ) {error_report ("spice: failed to set channel security for %s" , value); -exit (1 ); +exit (EXIT_FAILURE ); }return 0 ; }
@@ -661,11 +661,11 @@ void qemu_spice_init(void) tls_port =qemu_opt_get_number (opts,"tls-port" ,0 );if (port <0 || port >65535 ) {error_report ("spice port is out of range" ); -exit (1 ); +exit (EXIT_FAILURE ); }if (tls_port <0 || tls_port >65535 ) {error_report ("spice tls-port is out of range" ); -exit (1 ); +exit (EXIT_FAILURE ); } password =qemu_opt_get (opts,"password" );
@@ -736,7 +736,7 @@ void qemu_spice_init(void)if (qemu_opt_get_bool (opts,"sasl" ,0 )) {if (spice_server_set_sasl (spice_server,1 ) ==-1 ) {error_report ("spice: failed to enable sasl" ); -exit (1 ); +exit (EXIT_FAILURE ); } auth ="sasl" ; }
@@ -755,7 +755,7 @@ void qemu_spice_init(void)#else error_report ("this qemu build does not support the " "\"disable-agent-file-xfer\" option" ); -exit (1 ); +exit (EXIT_FAILURE );#endif }
@@ -803,7 +803,7 @@ void qemu_spice_init(void)spice_server_set_sasl_appname (spice_server,"qemu" );if (spice_server_init (spice_server, &core_interface) !=0 ) {error_report ("failed to initialize spice server" ); -exit (1 ); +exit (EXIT_FAILURE ); }; using_spice =1 ;
@@ -831,11 +831,11 @@ void qemu_spice_init(void)if ((port !=0 ) || (tls_port !=0 )) {error_report ("SPICE GL support is local-only for now and " "incompatible with -spice port/tls-port" ); -exit (1 ); +exit (EXIT_FAILURE ); }if (egl_rendernode_init () !=0 ) {error_report ("Failed to initialize EGL render node for SPICE GL" ); -exit (1 ); +exit (EXIT_FAILURE ); } display_opengl =1 ; }
@@ -847,7 +847,7 @@ int qemu_spice_add_interface(SpiceBaseInstance *sin)if (!spice_server) {if (QTAILQ_FIRST (&qemu_spice_opts.head) !=NULL ) {error_report ("Oops: spice configured but not active" ); -exit (1 ); +exit (EXIT_FAILURE ); }/* * Create a spice server instance.
ui/vnc.c +2 -2
@@ -3154,7 +3154,7 @@ void vnc_display_init(const char *id) }if (!vs->kbd_layout) -exit (1 ); +exit (EXIT_FAILURE ); vs->share_policy =VNC_SHARE_POLICY_ALLOW_EXCLUSIVE ; vs->connections_limit =32 ;
@@ -3929,7 +3929,7 @@ int vnc_init_func(void *opaque, QemuOpts *opts, Error **errp)vnc_display_open (id, &local_err);if (local_err !=NULL ) {error_reportf_err (local_err,"Failed to start VNC server: " ); -exit (1 ); +exit (EXIT_FAILURE ); }return 0 ; }
Signature · 1 line
2.5.5
PATCH 7/26 tests: use exit(EXIT_SUCCESS) and exit(EXIT_FAILURE)
In reply to Laurent VivierThis patch is the result of coccinelle scriptscripts/coccinelle/exit.cocci
--- tests/ipmi-bt-test.c | 6 +++--- tests/libqtest.c | 8 ++++---- tests/migration/stress.c | 4 ++-- tests/qht-bench.c | 2 +- tests/rcutorture.c | 4 ++-- tests/tcg/hello-i386.c | 2 +- tests/tcg/linux-test.c | 4 ++-- tests/tcg/runcom.c | 12 ++++++------ tests/tcg/test_path.c | 2 +- tests/test-aio.c | 2 +- tests/test-iov.c | 8 ++++---- tests/test-thread-pool.c | 2 +- tests/vhost-user-bridge.c | 18 +++++++++--------- 13 files changed, 37 insertions(+), 37 deletions(-)
tests/ipmi-bt-test.c +3 -3
@@ -383,16 +383,16 @@ static void open_socket(void) emu_lfd =socket (AF_INET ,SOCK_STREAM ,IPPROTO_TCP );if (emu_lfd ==-1 ) {perror ("socket" ); -exit (1 ); +exit (EXIT_FAILURE ); }if (bind (emu_lfd, (struct sockaddr *) &myaddr,sizeof (myaddr)) ==-1 ) {perror ("bind" ); -exit (1 ); +exit (EXIT_FAILURE ); } addrlen =sizeof (myaddr);if (getsockname (emu_lfd, (struct sockaddr *) &myaddr , &addrlen) ==-1 ) {perror ("getsockname" ); -exit (1 ); +exit (EXIT_FAILURE ); } emu_port =ntohs (myaddr.sin_port);assert (listen (emu_lfd,1 ) !=-1 );
tests/libqtest.c +4 -4
@@ -182,7 +182,7 @@ QTestState *qtest_init(const char *extra_args) qmp_socket_path, extra_args ?: "");execlp ("/bin/sh" ,"sh" ,"-c" , command,NULL ); -exit (1 ); +exit (EXIT_FAILURE ); } s->fd =socket_accept (sock);
@@ -284,7 +284,7 @@ static GString *qtest_recv_line(QTestState *s)if (len ==-1 || len ==0 ) {fprintf (stderr,"Broken pipe\n" ); -exit (1 ); +exit (EXIT_FAILURE ); }g_string_append_len (s->rx, buffer, len);
@@ -355,7 +355,7 @@ static void qmp_response(JSONMessageParser *parser, GQueue *tokens) obj =json_parser_parse (tokens,NULL );if (!obj) {fprintf (stderr,"QMP JSON response parsing failed\n" ); -exit (1 ); +exit (EXIT_FAILURE ); }g_assert (qobject_type (obj) ==QTYPE_QDICT );
@@ -381,7 +381,7 @@ QDict *qmp_fd_receive(int fd)if (len ==-1 || len ==0 ) {fprintf (stderr,"Broken pipe\n" ); -exit (1 ); +exit (EXIT_FAILURE ); }if (log) {
tests/migration/stress.c +2 -2
@@ -51,7 +51,7 @@ static __attribute__((noreturn)) void exit_failure(void) argv0, gettid(), strerror(errno));abort (); }else { -exit (1 ); +exit (EXIT_FAILURE ); } }
@@ -64,7 +64,7 @@ static __attribute__((noreturn)) void exit_success(void) argv0, gettid(), strerror(errno));abort (); }else { -exit (0 ); +exit (EXIT_SUCCESS ); } }
tests/qht-bench.c +1 -1
@@ -432,7 +432,7 @@ static void parse_args(int argc, char *argv[])break ;case 'h' :usage_complete (argc, argv); -exit (0 ); +exit (EXIT_SUCCESS );case 'k' : init_size =atol (optarg);break ;
tests/rcutorture.c +2 -2
@@ -179,7 +179,7 @@ static void perftestrun(int nthreads, int duration, int nreaders, int nupdaters) (double)n_reads), ((duration *1000 *1000 *1000. *(double )nupdaters) / (double)n_updates)); -exit (0 ); +exit (EXIT_SUCCESS ); }static void perftest (int nreaders,int duration)
@@ -362,7 +362,7 @@ static void stresstest(int nreaders, int duration)printf (" %lld" , rcu_stress_count[i]); }printf ("\n" ); -exit (0 ); +exit (EXIT_SUCCESS ); }/* GTest interface */
tests/tcg/hello-i386.c +1 -1
@@ -23,5 +23,5 @@ static inline int write(int fd, const char * buf, int len)void _start (void ) {write (1 ,"Hello World\n" ,12 ); -exit (0 ); +exit (EXIT_SUCCESS ); }
tests/tcg/linux-test.c +2 -2
@@ -53,7 +53,7 @@ void error1(const char *filename, int line, const char *fmt, ...)vfprintf (stderr, fmt, ap);fprintf (stderr,"\n" );va_end (ap); -exit (1 ); +exit (EXIT_FAILURE ); }int __chk_error (const char *filename,int line,int ret)
@@ -334,7 +334,7 @@ void test_socket(void) client_fd =client_socket ();send (client_fd, socket_msg,sizeof (socket_msg),0 );close (client_fd); -exit (0 ); +exit (EXIT_SUCCESS ); } len =sizeof (sockaddr); fd =chk_error (accept (server_fd, (struct sockaddr *)&sockaddr, &len));
tests/tcg/runcom.c +6 -6
@@ -27,7 +27,7 @@ static void usage(void)printf ("runcom version 0.1 (c) 2003 Fabrice Bellard\n" "usage: runcom file.com\n" "VM86 Run simple .com DOS executables (linux vm86 test mode)\n" ); -exit (1 ); +exit (EXIT_FAILURE ); }static inline void set_bit (uint8_t *a,unsigned int bit)
@@ -83,7 +83,7 @@ int main(int argc, char **argv) MAP_FIXED | MAP_ANON | MAP_PRIVATE, -1, 0);if (vm86_mem ==MAP_FAILED ) {perror ("mmap" ); -exit (1 ); +exit (EXIT_FAILURE ); }#ifdef SIGTEST {
@@ -101,12 +101,12 @@ int main(int argc, char **argv) fd =open (filename,O_RDONLY );if (fd <0 ) {perror (filename); -exit (1 ); +exit (EXIT_FAILURE ); } ret =read (fd, vm86_mem +COM_BASE_ADDR ,65536 -256 );if (ret <0 ) {perror ("read" ); -exit (1 ); +exit (EXIT_FAILURE ); }close (fd);
@@ -151,7 +151,7 @@ int main(int argc, char **argv) ah = (r->eax >>8 ) &0xff ;switch (ah) {case 0x00 :/* exit */ -exit (0 ); +exit (EXIT_SUCCESS );case 0x02 :/* write char */ {uint8_t c = r->edx;
@@ -186,7 +186,7 @@ int main(int argc, char **argv)default :fprintf (stderr,"unhandled vm86 return code (0x%x)\n" , ret);dump_regs (&ctx.regs); -exit (1 ); +exit (EXIT_FAILURE ); } } }
tests/tcg/test_path.c +1 -1
@@ -20,7 +20,7 @@ void qemu_log(const char *fmt, ...)va_start (ap, fmt);vfprintf (stderr, fmt, ap);va_end (ap); -exit (1 ); +exit (EXIT_FAILURE ); }#define NO_CHANGE (_path) \
tests/test-aio.c +1 -1
@@ -834,7 +834,7 @@ int main(int argc, char **argv) ctx =aio_context_new (&local_error);if (!ctx) {error_reportf_err (local_error,"Failed to create AIO Context: " ); -exit (1 ); +exit (EXIT_FAILURE ); } src =aio_get_g_source (ctx);g_source_attach (src,NULL );
tests/test-iov.c +4 -4
@@ -172,7 +172,7 @@ static void test_io(void)if (socketpair (PF_UNIX ,SOCK_STREAM ,0 , sv) <0 ) {perror ("socketpair" ); -exit (1 ); +exit (EXIT_FAILURE ); }FD_ZERO (&fds);
@@ -203,7 +203,7 @@ static void test_io(void)continue ; }else {perror ("send" ); -exit (1 ); +exit (EXIT_FAILURE ); } }while (k < j); }
@@ -211,7 +211,7 @@ static void test_io(void)iov_free (iov, niov);g_free (buf);g_free (siov); -exit (0 ); +exit (EXIT_SUCCESS ); }else {/* reader & verifier */
@@ -243,7 +243,7 @@ static void test_io(void)continue ; }else {perror ("recv" ); -exit (1 ); +exit (EXIT_FAILURE ); } }while (k < j);test_iov_bytes (iov, niov, i, j - i);
tests/test-thread-pool.c +1 -1
@@ -231,7 +231,7 @@ int main(int argc, char **argv) ctx =aio_context_new (&local_error);if (!ctx) {error_reportf_err (local_error,"Failed to create AIO Context: " ); -exit (1 ); +exit (EXIT_FAILURE ); } pool =aio_get_thread_pool (ctx);
tests/vhost-user-bridge.c +9 -9
@@ -68,7 +68,7 @@ static void vubr_die(const char *s) {perror (s); -exit (1 ); +exit (EXIT_FAILURE ); } static int
@@ -389,7 +389,7 @@ vubr_message_read(int conn_fd, VhostUserMsg *vmsg)if (rc ==0 ) {vubr_die ("recvmsg" );fprintf (stderr,"Peer disconnected.\n" ); -exit (1 ); +exit (EXIT_FAILURE ); }if (rc <0 ) {vubr_die ("recvmsg" );
@@ -413,7 +413,7 @@ vubr_message_read(int conn_fd, VhostUserMsg *vmsg)"Error: too big message request: %d, size: vmsg->size: %u, " "while sizeof(vmsg->payload) = %zu\n" , vmsg->request, vmsg->size, sizeof(vmsg->payload)); -exit (1 ); +exit (EXIT_FAILURE ); }if (vmsg->size) {
@@ -421,7 +421,7 @@ vubr_message_read(int conn_fd, VhostUserMsg *vmsg)if (rc ==0 ) {vubr_die ("recvmsg" );fprintf (stderr,"Peer disconnected.\n" ); -exit (1 ); +exit (EXIT_FAILURE ); }if (rc <0 ) {vubr_die ("recvmsg" );
@@ -572,7 +572,7 @@ vubr_post_buffer(VubrDev *dev, VubrVirtq *vq, uint8_t *buf, int32_t len)if (!(desc[i].flags &VRING_DESC_F_WRITE )) {/* FIXME: we should find writable descriptor. */ fprintf (stderr,"Error: descriptor is not writable. Exiting.\n" ); -exit (1 ); +exit (EXIT_FAILURE ); }void *chunk_start = (void *)(uintptr_t )gpa_to_va (dev, desc[i].addr);
@@ -1276,14 +1276,14 @@ vubr_set_host(struct sockaddr_in *saddr, const char *host)if (isdigit (host[0 ])) {if (!inet_aton (host, &saddr->sin_addr)) {fprintf (stderr,"inet_aton() failed.\n" ); -exit (1 ); +exit (EXIT_FAILURE ); } }else {struct hostent *he =gethostbyname (host);if (!he) {fprintf (stderr,"gethostbyname() failed.\n" ); -exit (1 ); +exit (EXIT_FAILURE ); } saddr->sin_addr = *(struct in_addr *)he->h_addr; }
@@ -1304,13 +1304,13 @@ vubr_backend_udp_setup(VubrDev *dev, lport =strtol (local_port, (char **)&r,0 );if (r == local_port) {fprintf (stderr,"lport parsing failed.\n" ); -exit (1 ); +exit (EXIT_FAILURE ); } rport =strtol (remote_port, (char **)&r,0 );if (r == remote_port) {fprintf (stderr,"rport parsing failed.\n" ); -exit (1 ); +exit (EXIT_FAILURE ); }struct sockaddr_in si_local = {
Signature · 1 line
2.5.5
PATCH 8/26 replay: use exit(EXIT_SUCCESS) and exit(EXIT_FAILURE)
In reply to Laurent VivierThis patch is the result of coccinelle scriptscripts/coccinelle/exit.cocci
--- replay/replay-char.c | 6 +++--- replay/replay-events.c | 6 +++--- replay/replay-internal.c | 2 +- replay/replay-time.c | 2 +- replay/replay.c | 14 +++++++------- 5 files changed, 15 insertions(+), 15 deletions(-)
replay/replay-char.c +3 -3
@@ -56,7 +56,7 @@ void replay_chr_be_write(CharDriverState *s, uint8_t *buf, int len) event->id =find_char_driver (s);if (event->id <0 ) {fprintf (stderr,"Replay: cannot find char driver\n" ); -exit (1 ); +exit (EXIT_FAILURE ); } event->buf =g_malloc (len);memcpy (event->buf, buf, len);
@@ -116,7 +116,7 @@ void replay_char_write_event_load(int *res, int *offset) }else {replay_mutex_unlock ();error_report ("Missing character write event in the replay log" ); -exit (1 ); +exit (EXIT_FAILURE ); } }
@@ -140,7 +140,7 @@ int replay_char_read_all_load(uint8_t *buf) }else {replay_mutex_unlock ();error_report ("Missing character read all event in the replay log" ); -exit (1 ); +exit (EXIT_FAILURE ); } }
replay/replay-events.c +3 -3
@@ -57,7 +57,7 @@ static void replay_run_event(Event *event)default :error_report ("Replay: invalid async event ID (%d) in the queue" , event->event_kind); -exit (1 ); +exit (EXIT_FAILURE );break ; } }
@@ -191,7 +191,7 @@ static void replay_save_event(Event *event, int checkpoint)break ;default :error_report ("Unknown ID %" PRId64" of replay event" , event->id); -exit (1 ); +exit (EXIT_FAILURE ); } } }
@@ -254,7 +254,7 @@ static Event *replay_read_event(int checkpoint)break ;default :error_report ("Unknown ID %d of replay event" , read_event_kind); -exit (1 ); +exit (EXIT_FAILURE );break ; }
replay/replay-internal.c +1 -1
@@ -159,7 +159,7 @@ void replay_fetch_data_kind(void) replay_has_unread_data =1 ;if (replay_data_kind >=EVENT_COUNT ) {error_report ("Replay: unknown event kind %d" , replay_data_kind); -exit (1 ); +exit (EXIT_FAILURE ); } } }
replay/replay-time.c +1 -1
@@ -61,5 +61,5 @@ int64_t replay_read_clock(ReplayClockKind kind) }error_report ("REPLAY INTERNAL ERROR %d" , __LINE__); -exit (1 ); +exit (EXIT_FAILURE ); }
replay/replay.c +7 -7
@@ -221,7 +221,7 @@ static void replay_enable(const char *fname, int mode)break ;default :fprintf (stderr,"Replay: internal error: invalid replay mode\n" ); -exit (1 ); +exit (EXIT_FAILURE ); }atexit (replay_finish);
@@ -231,7 +231,7 @@ static void replay_enable(const char *fname, int mode) replay_file =fopen (fname, fmode);if (replay_file ==NULL ) {fprintf (stderr,"Replay: open %s: %s\n" , fname,strerror (errno)); -exit (1 ); +exit (EXIT_FAILURE ); } replay_filename =g_strdup (fname);
@@ -248,7 +248,7 @@ static void replay_enable(const char *fname, int mode)unsigned int version =replay_get_dword ();if (version !=REPLAY_VERSION ) {fprintf (stderr,"Replay: invalid input log file version\n" ); -exit (1 ); +exit (EXIT_FAILURE ); }/* go to the beginning */ fseek (replay_file,HEADER_SIZE ,SEEK_SET );
@@ -282,13 +282,13 @@ void replay_configure(QemuOpts *opts) mode =REPLAY_MODE_PLAY ; }else {error_report ("Invalid icount rr option: %s" , rr); -exit (1 ); +exit (EXIT_FAILURE ); } fname =qemu_opt_get (opts,"rrfile" );if (!fname) {error_report ("File name not specified for replay" ); -exit (1 ); +exit (EXIT_FAILURE ); }replay_enable (fname, mode);
@@ -305,11 +305,11 @@ void replay_start(void)if (replay_blockers) {error_reportf_err (replay_blockers->data,"Record/replay: " ); -exit (1 ); +exit (EXIT_FAILURE ); }if (!use_icount) {error_report ("Please enable icount to use record/replay" ); -exit (1 ); +exit (EXIT_FAILURE ); }/* Timer for snapshotting will be set up here. */
Signature · 1 line
2.5.5
PATCH 9/26 qemu-user: use exit(EXIT_SUCCESS) and exit(EXIT_FAILURE)
In reply to Laurent VivierThis patch is the result of coccinelle scriptscripts/coccinelle/exit.cocci
--- bsd-user/main.c | 20 ++++++++++---------- linux-user/main.c | 4 ++-- linux-user/syscall.c | 2 +- 3 files changed, 13 insertions(+), 13 deletions(-)
bsd-user/main.c +10 -10
@@ -658,7 +658,7 @@ void cpu_loop(CPUSPARCState *env)#endif printf ("Unhandled trap: 0x%x\n" , trapnr);cpu_dump_state (cs, stderr, fprintf,0 ); -exit (1 ); +exit (EXIT_FAILURE ); }process_pending_signals (env); }
@@ -708,7 +708,7 @@ static void usage(void)TARGET_NAME , interp_prefix, x86_stack_size); -exit (1 ); +exit (EXIT_FAILURE ); } THREAD CPUState *thread_cpu;
@@ -752,7 +752,7 @@ int main(int argc, char **argv)if ((envlist =envlist_create ()) ==NULL ) { (void )fprintf (stderr,"Unable to allocate envlist\n" ); -exit (1 ); +exit (EXIT_FAILURE ); }/* add current environment into the list */
@@ -793,7 +793,7 @@ int main(int argc, char **argv)envlist_free (envlist);if ((envlist =envlist_create ()) ==NULL ) { (void )fprintf (stderr,"Unable to allocate envlist\n" ); -exit (1 ); +exit (EXIT_FAILURE ); } }else if (!strcmp (r,"U" )) { r = argv[optind++];
@@ -815,7 +815,7 @@ int main(int argc, char **argv)if (qemu_host_page_size ==0 || (qemu_host_page_size & (qemu_host_page_size -1 )) !=0 ) {fprintf (stderr,"page size must be a power of two\n" ); -exit (1 ); +exit (EXIT_FAILURE ); } }else if (!strcmp (r,"g" )) { gdbstub_port =atoi (argv[optind++]);
@@ -828,7 +828,7 @@ int main(int argc, char **argv)#if defined(cpu_list)cpu_list (stdout, &fprintf);#endif -exit (1 ); +exit (EXIT_FAILURE ); } }else if (!strcmp (r,"B" )) { guest_base =strtol (argv[optind++],NULL ,0 );
@@ -867,7 +867,7 @@ int main(int argc, char **argv) mask =qemu_str_to_log_mask (log_mask);if (!mask) {qemu_print_log_usage (stdout); -exit (1 ); +exit (EXIT_FAILURE ); }qemu_set_log (mask); }
@@ -878,7 +878,7 @@ int main(int argc, char **argv) filename = argv[optind];if (!trace_init_backends ()) { -exit (1 ); +exit (EXIT_FAILURE ); }trace_init_file (trace_file);
@@ -914,7 +914,7 @@ int main(int argc, char **argv) cpu =cpu_init (cpu_model);if (!cpu) {fprintf (stderr,"Unable to find CPU definition\n" ); -exit (1 ); +exit (EXIT_FAILURE ); } env = cpu->env_ptr;#if defined(TARGET_SPARC ) || defined(TARGET_PPC )
@@ -1010,7 +1010,7 @@ int main(int argc, char **argv)/* enable 64 bit mode if possible */ if (!(env->features[FEAT_8000_0001_EDX ] &CPUID_EXT2_LM )) {fprintf (stderr,"The selected x86 CPU does not support 64 bit mode\n" ); -exit (1 ); +exit (EXIT_FAILURE ); } env->cr[4 ] |=CR4_PAE_MASK ; env->efer |=MSR_EFER_LMA |MSR_EFER_LME ;
linux-user/main.c +2 -2
@@ -4243,7 +4243,7 @@ int main(int argc, char **argv, char **envp) optind =parse_args (argc, argv);if (!trace_init_backends ()) { -exit (1 ); +exit (EXIT_FAILURE ); }trace_init_file (trace_file);
@@ -4700,7 +4700,7 @@ int main(int argc, char **argv, char **envp)if ((env->active_fpu.fcr31_rw_bitmask & (1 <<FCR31_NAN2008 )) ==0 ) {fprintf (stderr,"ELF binary's NaN mode not supported by CPU\n" ); -exit (1 ); +exit (EXIT_FAILURE ); }if ((info->elf_flags &EF_MIPS_NAN2008 ) !=0 ) { env->active_fpu.fcr31 |= (1 <<FCR31_NAN2008 );
linux-user/syscall.c +1 -1
@@ -6513,7 +6513,7 @@ void syscall_init(void)if (arg_type[0 ] !=TYPE_PTR ) {fprintf (stderr,"cannot patch size for ioctl 0x%x\n" , ie->target_cmd); -exit (1 ); +exit (EXIT_FAILURE ); } arg_type++; size =thunk_type_size (arg_type,0 );
Signature · 1 line
2.5.5
Re: [Qemu-devel] [PATCH 09/26] qemu-user: use exit(EXIT_SUCCESS) and exit(EXIT_FAILURE)
Quoted 5 lines · Laurent Vivier
This patch is the result of coccinelle script
scripts/coccinelle/exit.cocciSigned-off-by Laurent Vivier <[email protected]>CC Riku Voipio <[email protected]>
Quoted 138 lines
--- bsd-user/main.c | 20 ++++++++++---------- linux-user/main.c | 4 ++-- linux-user/syscall.c | 2 +- 3 files changed, 13 insertions(+), 13 deletions(-)bsd-user/main.c +10
-10@@ -658,7 +658,7 @@ void cpu_loop(CPUSPARCState *env)#endif printf ("Unhandled trap: 0x%x\n" , trapnr);cpu_dump_state (cs, stderr, fprintf,0 ); -exit (1 ); +exit (EXIT_FAILURE ); }process_pending_signals (env); }@@ -708,7 +708,7 @@ static void usage(void)TARGET_NAME , interp_prefix, x86_stack_size); -exit (1 ); +exit (EXIT_FAILURE ); } THREAD CPUState *thread_cpu;@@ -752,7 +752,7 @@ int main(int argc, char **argv)if ((envlist =envlist_create ()) ==NULL ) { (void )fprintf (stderr,"Unable to allocate envlist\n" ); -exit (1 ); +exit (EXIT_FAILURE ); }/* add current environment into the list */ @@ -793,7 +793,7 @@ int main(int argc, char **argv)envlist_free (envlist);if ((envlist =envlist_create ()) ==NULL ) { (void )fprintf (stderr,"Unable to allocate envlist\n" ); -exit (1 ); +exit (EXIT_FAILURE ); } }else if (!strcmp (r,"U" )) { r = argv[optind++];@@ -815,7 +815,7 @@ int main(int argc, char **argv)if (qemu_host_page_size ==0 || (qemu_host_page_size & (qemu_host_page_size -1 )) !=0 ) {fprintf (stderr,"page size must be a power of two\n" ); -exit (1 ); +exit (EXIT_FAILURE ); } }else if (!strcmp (r,"g" )) { gdbstub_port =atoi (argv[optind++]);@@ -828,7 +828,7 @@ int main(int argc, char **argv)#if defined(cpu_list)cpu_list (stdout, &fprintf);#endif -exit (1 ); +exit (EXIT_FAILURE ); } }else if (!strcmp (r,"B" )) { guest_base =strtol (argv[optind++],NULL ,0 );@@ -867,7 +867,7 @@ int main(int argc, char **argv) mask =qemu_str_to_log_mask (log_mask);if (!mask) {qemu_print_log_usage (stdout); -exit (1 ); +exit (EXIT_FAILURE ); }qemu_set_log (mask); }@@ -878,7 +878,7 @@ int main(int argc, char **argv) filename = argv[optind];if (!trace_init_backends ()) { -exit (1 ); +exit (EXIT_FAILURE ); }trace_init_file (trace_file);@@ -914,7 +914,7 @@ int main(int argc, char **argv) cpu =cpu_init (cpu_model);if (!cpu) {fprintf (stderr,"Unable to find CPU definition\n" ); -exit (1 ); +exit (EXIT_FAILURE ); } env = cpu->env_ptr;#if defined(TARGET_SPARC ) || defined(TARGET_PPC )@@ -1010,7 +1010,7 @@ int main(int argc, char **argv)/* enable 64 bit mode if possible */ if (!(env->features[FEAT_8000_0001_EDX ] &CPUID_EXT2_LM )) {fprintf (stderr,"The selected x86 CPU does not support 64 bit mode\n" ); -exit (1 ); +exit (EXIT_FAILURE ); } env->cr[4 ] |=CR4_PAE_MASK ; env->efer |=MSR_EFER_LMA |MSR_EFER_LME ;linux-user/main.c +2
-2@@ -4243,7 +4243,7 @@ int main(int argc, char **argv, char **envp) optind =parse_args (argc, argv);if (!trace_init_backends ()) { -exit (1 ); +exit (EXIT_FAILURE ); }trace_init_file (trace_file);@@ -4700,7 +4700,7 @@ int main(int argc, char **argv, char **envp)if ((env->active_fpu.fcr31_rw_bitmask & (1 <<FCR31_NAN2008 )) ==0 ) {fprintf (stderr,"ELF binary's NaN mode not supported by CPU\n" ); -exit (1 ); +exit (EXIT_FAILURE ); }if ((info->elf_flags &EF_MIPS_NAN2008 ) !=0 ) { env->active_fpu.fcr31 |= (1 <<FCR31_NAN2008 );linux-user/syscall.c +1
-1@@ -6513,7 +6513,7 @@ void syscall_init(void)if (arg_type[0 ] !=TYPE_PTR ) {fprintf (stderr,"cannot patch size for ioctl 0x%x\n" , ie->target_cmd); -exit (1 ); +exit (EXIT_FAILURE ); } arg_type++; size =thunk_type_size (arg_type,0 );Signature · 1 line
2.5.5
PATCH 10/26 m68k: use exit(EXIT_SUCCESS) and exit(EXIT_FAILURE)
In reply to Laurent VivierThis patch is the result of coccinelle scriptscripts/coccinelle/exit.cocci
--- hw/m68k/an5206.c | 6 +++--- hw/m68k/dummy_m68k.c | 4 ++-- hw/m68k/mcf5208.c | 8 ++++---- 3 files changed, 9 insertions(+), 9 deletions(-)
hw/m68k/an5206.c +3 -3
@@ -45,7 +45,7 @@ static void an5206_init(MachineState *machine) cpu =cpu_m68k_init (cpu_model);if (!cpu) {error_report ("Unable to find m68k CPU definition" ); -exit (1 ); +exit (EXIT_FAILURE ); } env = &cpu->env;
@@ -72,7 +72,7 @@ static void an5206_init(MachineState *machine)return ; }fprintf (stderr,"Kernel image must be specified\n" ); -exit (1 ); +exit (EXIT_FAILURE ); } kernel_size = load_elf(kernel_filename, NULL, NULL, &elf_entry,
@@ -89,7 +89,7 @@ static void an5206_init(MachineState *machine) }if (kernel_size <0 ) {fprintf (stderr,"qemu: could not load kernel '%s'\n" , kernel_filename); -exit (1 ); +exit (EXIT_FAILURE ); } env->pc = entry;
hw/m68k/dummy_m68k.c +2 -2
@@ -37,7 +37,7 @@ static void dummy_m68k_init(MachineState *machine) cpu =cpu_m68k_init (cpu_model);if (!cpu) {fprintf (stderr,"Unable to find m68k CPU definition\n" ); -exit (1 ); +exit (EXIT_FAILURE ); } env = &cpu->env;
@@ -67,7 +67,7 @@ static void dummy_m68k_init(MachineState *machine)if (kernel_size <0 ) {fprintf (stderr,"qemu: could not load kernel '%s'\n" , kernel_filename); -exit (1 ); +exit (EXIT_FAILURE ); } }else { entry =0 ;
hw/m68k/mcf5208.c +4 -4
@@ -213,7 +213,7 @@ static void mcf5208evb_init(MachineState *machine) cpu =cpu_m68k_init (cpu_model);if (!cpu) {fprintf (stderr,"Unable to find m68k CPU definition\n" ); -exit (1 ); +exit (EXIT_FAILURE ); } env = &cpu->env;
@@ -241,7 +241,7 @@ static void mcf5208evb_init(MachineState *machine)if (nb_nics >1 ) {fprintf (stderr,"Too many NICs\n" ); -exit (1 ); +exit (EXIT_FAILURE ); }if (nd_table[0 ].used) mcf_fec_init(address_space_mem, &nd_table[0],
@@ -275,7 +275,7 @@ static void mcf5208evb_init(MachineState *machine)return ; }fprintf (stderr,"Kernel image must be specified\n" ); -exit (1 ); +exit (EXIT_FAILURE ); } kernel_size = load_elf(kernel_filename, NULL, NULL, &elf_entry,
@@ -292,7 +292,7 @@ static void mcf5208evb_init(MachineState *machine) }if (kernel_size <0 ) {fprintf (stderr,"qemu: could not load kernel '%s'\n" , kernel_filename); -exit (1 ); +exit (EXIT_FAILURE ); } env->pc = entry;
Signature · 1 line
2.5.5
PATCH 11/26 pci, virtio: use exit(EXIT_SUCCESS) and exit(EXIT_FAILURE)
In reply to Laurent VivierThis patch is the result of coccinelle scriptscripts/coccinelle/exit.cocci
--- hw/9pfs/9p.c | 2 +- hw/block/virtio-blk.c | 6 +++--- hw/net/virtio-net.c | 10 +++++----- hw/pci/pci.c | 12 ++++++------ hw/scsi/vhost-scsi.c | 4 ++-- hw/scsi/virtio-scsi-dataplane.c | 2 +- hw/scsi/virtio-scsi.c | 6 +++--- hw/virtio/virtio.c | 28 ++++++++++++++-------------- 8 files changed, 35 insertions(+), 35 deletions(-)
hw/9pfs/9p.c +1 -1
@@ -3513,7 +3513,7 @@ static void __attribute__((__constructor__)) v9fs_set_fd_limit(void)struct rlimit rlim;if (getrlimit (RLIMIT_NOFILE , &rlim) <0 ) {error_report ("Failed to get the resource limit" ); -exit (1 ); +exit (EXIT_FAILURE ); } open_fd_hw = rlim.rlim_cur -MIN (400 , rlim.rlim_cur/3 ); open_fd_rc = rlim.rlim_cur/2 ;
hw/block/virtio-blk.c +3 -3
@@ -478,20 +478,20 @@ void virtio_blk_handle_request(VirtIOBlockReq *req, MultiReqBuffer *mrb)if (req->elem.out_num <1 || req->elem.in_num <1 ) {error_report ("virtio-blk missing headers" ); -exit (1 ); +exit (EXIT_FAILURE ); }if (unlikely (iov_to_buf (iov, out_num,0 , &req->out,sizeof (req->out)) !=sizeof (req->out))) {error_report ("virtio-blk request outhdr too short" ); -exit (1 ); +exit (EXIT_FAILURE ); }iov_discard_front (&iov, &out_num,sizeof (req->out));if (in_iov[in_num -1 ].iov_len <sizeof (struct virtio_blk_inhdr )) {error_report ("virtio-blk request inhdr too short" ); -exit (1 ); +exit (EXIT_FAILURE ); }/* We always touch the last byte, so just see how big in_iov is. */
hw/net/virtio-net.c +5 -5
@@ -893,7 +893,7 @@ static void virtio_net_handle_ctrl(VirtIODevice *vdev, VirtQueue *vq)if (iov_size (elem->in_sg, elem->in_num) <sizeof (status) ||iov_size (elem->out_sg, elem->out_num) <sizeof (ctrl)) {error_report ("virtio-net ctrl missing headers" ); -exit (1 ); +exit (EXIT_FAILURE ); } iov_cnt = elem->out_num;
@@ -1131,12 +1131,12 @@ static ssize_t virtio_net_receive(NetClientState *nc, const uint8_t *buf, size_t i, n->mergeable_rx_bufs, offset, size, n->guest_hdr_len, n->host_hdr_len, vdev->guest_features); -exit (1 ); +exit (EXIT_FAILURE ); }if (elem->in_num <1 ) {error_report ("virtio-net receive queue contains no in buffers" ); -exit (1 ); +exit (EXIT_FAILURE ); } sg = elem->in_sg;
@@ -1239,14 +1239,14 @@ static int32_t virtio_net_flush_tx(VirtIONetQueue *q) out_sg = elem->out_sg;if (out_num <1 ) {error_report ("virtio-net header not in first element" ); -exit (1 ); +exit (EXIT_FAILURE ); }if (n->has_vnet_hdr) {if (iov_to_buf (out_sg, out_num,0 , &mhdr, n->guest_hdr_len) < n->guest_hdr_len) {error_report ("virtio-net header incorrect" ); -exit (1 ); +exit (EXIT_FAILURE ); }if (n->needs_vnet_hdr_swap) {virtio_net_hdr_swap (vdev, (void *) &mhdr);
hw/pci/pci.c +6 -6
@@ -884,7 +884,7 @@ static uint16_t pci_req_id_cache_extract(PCIReqIDCache *cache)default :error_printf ("Invalid PCI requester ID cache type: %d\n" , cache->type); -exit (1 ); +exit (EXIT_FAILURE );break ; }
@@ -1085,7 +1085,7 @@ void pci_register_bar(PCIDevice *pci_dev, int region_num,if (size & (size-1 )) {fprintf (stderr,"ERROR: PCI region size must be pow2 " "type=0x%x, size=0x%" FMT_PCIBUS "\n" , type, size); -exit (1 ); +exit (EXIT_FAILURE ); } r = &pci_dev->io_regions[region_num];
@@ -1787,19 +1787,19 @@ PCIDevice *pci_nic_init_nofail(NICInfo *nd, PCIBus *rootbus,int i;if (qemu_show_nic_models (nd->model, pci_nic_models)) { -exit (0 ); +exit (EXIT_SUCCESS ); } i =qemu_find_nic_model (nd, pci_nic_models, default_model);if (i <0 ) { -exit (1 ); +exit (EXIT_FAILURE ); } bus =pci_get_bus_devfn (&devfn, rootbus, devaddr);if (!bus) {error_report ("Invalid PCI device address %s for device %s" , devaddr, pci_nic_names[i]); -exit (1 ); +exit (EXIT_FAILURE ); } pci_dev =pci_create (bus, devfn, pci_nic_names[i]);
@@ -1810,7 +1810,7 @@ PCIDevice *pci_nic_init_nofail(NICInfo *nd, PCIBus *rootbus,if (err) {error_report_err (err);object_unparent (OBJECT (dev)); -exit (1 ); +exit (EXIT_FAILURE ); }return pci_dev;
hw/scsi/vhost-scsi.c +2 -2
@@ -172,7 +172,7 @@ static void vhost_scsi_set_config(VirtIODevice *vdev,if ((uint32_t )virtio_ldl_p (vdev, &scsiconf->sense_size) != vs->sense_size || (uint32_t )virtio_ldl_p (vdev, &scsiconf->cdb_size) != vs->cdb_size) {error_report ("vhost-scsi does not support changing the sense data and CDB sizes" ); -exit (1 ); +exit (EXIT_FAILURE ); } }
@@ -194,7 +194,7 @@ static void vhost_scsi_set_status(VirtIODevice *vdev, uint8_t val) strerror(-ret));/* There is no userspace virtio-scsi fallback so exit */ -exit (1 ); +exit (EXIT_FAILURE ); } }else {vhost_scsi_stop (s);
hw/scsi/virtio-scsi-dataplane.c +1 -1
@@ -34,7 +34,7 @@ void virtio_scsi_set_iothread(VirtIOSCSI *s, IOThread *iothread)if (!k->set_guest_notifiers || !k->ioeventfd_started) {fprintf (stderr,"virtio-scsi: Failed to set iothread " "(transport does not support notifiers)" ); -exit (1 ); +exit (EXIT_FAILURE ); } }
hw/scsi/virtio-scsi.c +3 -3
@@ -84,7 +84,7 @@ static void virtio_scsi_complete_req(VirtIOSCSIReq *req)static void virtio_scsi_bad_req (void ) {error_report ("wrong size for virtio-scsi headers" ); -exit (1 ); +exit (EXIT_FAILURE ); } static size_t qemu_sgl_concat(VirtIOSCSIReq *req, struct iovec *iov,
@@ -208,7 +208,7 @@ static void *virtio_scsi_load_request(QEMUFile *f, SCSIRequest *sreq)if (virtio_scsi_parse_req (req,sizeof (VirtIOSCSICmdReq) + vs->cdb_size,sizeof (VirtIOSCSICmdResp) + vs->sense_size) <0 ) {error_report ("invalid SCSI request migration data" ); -exit (1 ); +exit (EXIT_FAILURE ); }scsi_req_ref (sreq);
@@ -628,7 +628,7 @@ static void virtio_scsi_set_config(VirtIODevice *vdev,if ((uint32_t )virtio_ldl_p (vdev, &scsiconf->sense_size) >=65536 || (uint32_t )virtio_ldl_p (vdev, &scsiconf->cdb_size) >=256 ) {error_report ("bad data written to virtio-scsi configuration space" ); -exit (1 ); +exit (EXIT_FAILURE ); } vs->sense_size =virtio_ldl_p (vdev, &scsiconf->sense_size);
hw/virtio/virtio.c +14 -14
@@ -339,7 +339,7 @@ static int virtqueue_num_heads(VirtQueue *vq, unsigned int idx)if (num_heads > vq->vring.num) {error_report ("Guest moved used index from %u to %u" , idx, vq->shadow_avail_idx); -exit (1 ); +exit (EXIT_FAILURE ); }/* On success, callers read a descriptor at vq->last_avail_idx. * Make sure descriptor read does not bypass avail index read. */
@@ -361,7 +361,7 @@ static unsigned int virtqueue_get_head(VirtQueue *vq, unsigned int idx)/* If their number is silly, that's a fatal mistake. */ if (head >= vq->vring.num) {error_report ("Guest says index %u is available" , head); -exit (1 ); +exit (EXIT_FAILURE ); }return head;
@@ -384,7 +384,7 @@ static unsigned virtqueue_read_next_desc(VirtIODevice *vdev, VRingDesc *desc,if (next >= max) {error_report ("Desc next is %u" , next); -exit (1 ); +exit (EXIT_FAILURE ); }vring_desc_read (vdev, desc, desc_pa, next);
@@ -417,13 +417,13 @@ void virtqueue_get_avail_bytes(VirtQueue *vq, unsigned int *in_bytes,if (desc.flags &VRING_DESC_F_INDIRECT ) {if (desc.len %sizeof (VRingDesc)) {error_report ("Invalid size for indirect buffer table" ); -exit (1 ); +exit (EXIT_FAILURE ); }/* If we've got too many, that implies a descriptor loop. */ if (num_bufs >= max) {error_report ("Looped descriptor" ); -exit (1 ); +exit (EXIT_FAILURE ); }/* loop over the indirect descriptor table */
@@ -438,7 +438,7 @@ void virtqueue_get_avail_bytes(VirtQueue *vq, unsigned int *in_bytes,/* If we've got too many, that implies a descriptor loop. */ if (++num_bufs > max) {error_report ("Looped descriptor" ); -exit (1 ); +exit (EXIT_FAILURE ); }if (desc.flags &VRING_DESC_F_WRITE ) {
@@ -483,7 +483,7 @@ static void virtqueue_map_desc(unsigned int *p_num_sg, hwaddr *addr, struct ioveif (!sz) {error_report ("virtio: zero sized buffers are not allowed" ); -exit (1 ); +exit (EXIT_FAILURE ); }while (sz) {
@@ -491,7 +491,7 @@ static void virtqueue_map_desc(unsigned int *p_num_sg, hwaddr *addr, struct ioveif (num_sg == max_num_sg) {error_report ("virtio: too many write descriptors in indirect table" ); -exit (1 ); +exit (EXIT_FAILURE ); } iov[num_sg].iov_base =cpu_physical_memory_map (pa, &len, is_write);
@@ -529,11 +529,11 @@ static void virtqueue_map_iovec(struct iovec *sg, hwaddr *addr, sg[i].iov_base =cpu_physical_memory_map (addr[i], &len, is_write);if (!sg[i].iov_base) {error_report ("virtio: error trying to map MMIO memory" ); -exit (1 ); +exit (EXIT_FAILURE ); }if (len != sg[i].iov_len) {error_report ("virtio: unexpected memory split" ); -exit (1 ); +exit (EXIT_FAILURE ); } } }
@@ -592,7 +592,7 @@ void *virtqueue_pop(VirtQueue *vq, size_t sz)if (vq->inuse >= vq->vring.num) {error_report ("Virtqueue size exceeded" ); -exit (1 ); +exit (EXIT_FAILURE ); } i = head =virtqueue_get_head (vq, vq->last_avail_idx++);
@@ -604,7 +604,7 @@ void *virtqueue_pop(VirtQueue *vq, size_t sz)if (desc.flags &VRING_DESC_F_INDIRECT ) {if (desc.len %sizeof (VRingDesc)) {error_report ("Invalid size for indirect buffer table" ); -exit (1 ); +exit (EXIT_FAILURE ); }/* loop over the indirect descriptor table */
@@ -622,7 +622,7 @@ void *virtqueue_pop(VirtQueue *vq, size_t sz) }else {if (in_num) {error_report ("Incorrect order for descriptors" ); -exit (1 ); +exit (EXIT_FAILURE ); }virtqueue_map_desc (&out_num, addr, iov,VIRTQUEUE_MAX_SIZE , false, desc.addr, desc.len);
@@ -631,7 +631,7 @@ void *virtqueue_pop(VirtQueue *vq, size_t sz)/* If we've got too many, that implies a descriptor loop. */ if ((in_num + out_num) > max) {error_report ("Looped descriptor" ); -exit (1 ); +exit (EXIT_FAILURE ); } }while ((i =virtqueue_read_next_desc (vdev, &desc, desc_pa, max)) != max);
Signature · 1 line
2.5.5
PATCH 12/26 sparc: use exit(EXIT_SUCCESS) and exit(EXIT_FAILURE)
In reply to Laurent VivierThis patch is the result of coccinelle scriptscripts/coccinelle/exit.cocci
--- hw/sparc/leon3.c | 12 ++++++------ hw/sparc/sun4m.c | 22 +++++++++++----------- hw/sparc64/sun4u.c | 8 ++++---- 3 files changed, 21 insertions(+), 21 deletions(-)
hw/sparc/leon3.c +6 -6
@@ -130,7 +130,7 @@ static void leon3_generic_hw_init(MachineState *machine) cpu =cpu_sparc_init (cpu_model);if (cpu ==NULL ) {fprintf (stderr,"qemu: Unable to find Sparc CPU definition\n" ); -exit (1 ); +exit (EXIT_FAILURE ); } env = &cpu->env;
@@ -152,7 +152,7 @@ static void leon3_generic_hw_init(MachineState *machine)fprintf (stderr,"qemu: Too much memory for this machine: %d, maximum 1G\n" , (unsigned int )(ram_size / (1024 *1024 ))); -exit (1 ); +exit (EXIT_FAILURE ); }memory_region_allocate_system_memory (ram,NULL ,"leon3.ram" , ram_size);
@@ -180,18 +180,18 @@ static void leon3_generic_hw_init(MachineState *machine)if (bios_size > prom_size) {fprintf (stderr,"qemu: could not load prom '%s': file too big\n" , filename); -exit (1 ); +exit (EXIT_FAILURE ); }if (bios_size >0 ) { ret =load_image_targphys (filename,0x00000000 , bios_size);if (ret <0 || ret > prom_size) {fprintf (stderr,"qemu: could not load prom '%s'\n" , filename); -exit (1 ); +exit (EXIT_FAILURE ); } }else if (kernel_filename ==NULL && !qtest_enabled ()) {fprintf (stderr,"Can't read bios image %s\n" , filename); -exit (1 ); +exit (EXIT_FAILURE ); }g_free (filename);
@@ -205,7 +205,7 @@ static void leon3_generic_hw_init(MachineState *machine)if (kernel_size <0 ) {fprintf (stderr,"qemu: could not load kernel '%s'\n" , kernel_filename); -exit (1 ); +exit (EXIT_FAILURE ); }if (bios_size <=0 ) {/* If there is no bios/monitor, start the application. */
hw/sparc/sun4m.c +11 -11
@@ -295,7 +295,7 @@ static unsigned long sun4m_load_kernel(const char *kernel_filename,if (kernel_size <0 ) {fprintf (stderr,"qemu: could not load kernel '%s'\n" , kernel_filename); -exit (1 ); +exit (EXIT_FAILURE ); }/* load initrd */
@@ -307,7 +307,7 @@ static unsigned long sun4m_load_kernel(const char *kernel_filename,if (initrd_size <0 ) {fprintf (stderr,"qemu: could not load initial ram disk '%s'\n" , initrd_filename); -exit (1 ); +exit (EXIT_FAILURE ); } }if (initrd_size >0 ) {
@@ -737,7 +737,7 @@ static void prom_init(hwaddr addr, const char *bios_name) }if (ret <0 || ret >PROM_SIZE_MAX ) {fprintf (stderr,"qemu: could not load prom '%s'\n" , bios_name); -exit (1 ); +exit (EXIT_FAILURE ); } }
@@ -807,7 +807,7 @@ static void ram_init(hwaddr addr, ram_addr_t RAM_size,"qemu: Too much memory for this machine: %d, maximum %d\n" , (unsigned int )(RAM_size / (1024 *1024 )), (unsigned int)(max_mem / (1024 * 1024))); -exit (1 ); +exit (EXIT_FAILURE ); } dev =qdev_create (NULL ,"memory" ); s =SYS_BUS_DEVICE (dev);
@@ -850,7 +850,7 @@ static void cpu_devinit(const char *cpu_model, unsigned int id, cpu =cpu_sparc_init (cpu_model);if (cpu ==NULL ) {fprintf (stderr,"qemu: Unable to find Sparc CPU definition\n" ); -exit (1 ); +exit (EXIT_FAILURE ); } env = &cpu->env;
@@ -944,21 +944,21 @@ static void sun4m_hw_init(const struct sun4m_hwdef *hwdef,if (graphic_depth !=8 && graphic_depth !=24 ) {error_report ("Unsupported depth: %d" , graphic_depth); -exit (1 ); +exit (EXIT_FAILURE ); } num_vsimms =0 ;if (num_vsimms ==0 ) {if (vga_interface_type ==VGA_CG3 ) {if (graphic_depth !=8 ) {error_report ("Unsupported depth: %d" , graphic_depth); -exit (1 ); +exit (EXIT_FAILURE ); }if (!(graphic_width ==1024 && graphic_height ==768 ) && !(graphic_width ==1152 && graphic_height ==900 )) {error_report ("Unsupported resolution: %d x %d" , graphic_width, graphic_height); -exit (1 ); +exit (EXIT_FAILURE ); }/* sbus irq 5 */
@@ -968,13 +968,13 @@ static void sun4m_hw_init(const struct sun4m_hwdef *hwdef,/* If no display specified, default to TCX */ if (graphic_depth !=8 && graphic_depth !=24 ) {error_report ("Unsupported depth: %d" , graphic_depth); -exit (1 ); +exit (EXIT_FAILURE ); }if (!(graphic_width ==1024 && graphic_height ==768 )) {error_report ("Unsupported resolution: %d x %d" , graphic_width, graphic_height); -exit (1 ); +exit (EXIT_FAILURE ); } tcx_init(hwdef->tcx_base, slavio_irq[11], 0x00100000,
@@ -1025,7 +1025,7 @@ static void sun4m_hw_init(const struct sun4m_hwdef *hwdef,if (drive_get_max_bus (IF_SCSI ) >0 ) {fprintf (stderr,"qemu: too many SCSI bus\n" ); -exit (1 ); +exit (EXIT_FAILURE ); } esp_init(hwdef->esp_base, 2,
hw/sparc64/sun4u.c +4 -4
@@ -207,7 +207,7 @@ static uint64_t sun4u_load_kernel(const char *kernel_filename,if (kernel_size <0 ) {fprintf (stderr,"qemu: could not load kernel '%s'\n" , kernel_filename); -exit (1 ); +exit (EXIT_FAILURE ); }/* load initrd above kernel */ *initrd_size =0 ;
@@ -220,7 +220,7 @@ static uint64_t sun4u_load_kernel(const char *kernel_filename,if ((int )*initrd_size <0 ) {fprintf (stderr,"qemu: could not load initial ram disk '%s'\n" , initrd_filename); -exit (1 ); +exit (EXIT_FAILURE ); } }if (*initrd_size >0 ) {
@@ -647,7 +647,7 @@ static void prom_init(hwaddr addr, const char *bios_name) }if (ret <0 || ret >PROM_SIZE_MAX ) {fprintf (stderr,"qemu: could not load prom '%s'\n" , bios_name); -exit (1 ); +exit (EXIT_FAILURE ); } }
@@ -760,7 +760,7 @@ static SPARCCPU *cpu_devinit(const char *cpu_model, const struct hwdef *hwdef) cpu =cpu_sparc_init (cpu_model);if (cpu ==NULL ) {fprintf (stderr,"Unable to find Sparc CPU definition\n" ); -exit (1 ); +exit (EXIT_FAILURE ); } env = &cpu->env;
Signature · 1 line
2.5.5
PATCH 13/26 sh4: use exit(EXIT_SUCCESS) and exit(EXIT_FAILURE)
In reply to Laurent VivierThis patch is the result of coccinelle scriptscripts/coccinelle/exit.cocci
--- hw/sh4/r2d.c | 6 +++--- hw/sh4/shix.c | 4 ++-- 2 files changed, 5 insertions(+), 5 deletions(-)
hw/sh4/r2d.c +3 -3
@@ -249,7 +249,7 @@ static void r2d_init(MachineState *machine) cpu =cpu_sh4_init (cpu_model);if (cpu ==NULL ) {fprintf (stderr,"Unable to find CPU definition\n" ); -exit (1 ); +exit (EXIT_FAILURE ); } env = &cpu->env;
@@ -318,7 +318,7 @@ static void r2d_init(MachineState *machine) INITRD_LOAD_OFFSET - LINUX_LOAD_OFFSET);if (kernel_size <0 ) {fprintf (stderr,"qemu: could not load kernel '%s'\n" , kernel_filename); -exit (1 ); +exit (EXIT_FAILURE ); }/* initialization which should be done by firmware */
@@ -338,7 +338,7 @@ static void r2d_init(MachineState *machine)if (initrd_size <0 ) {fprintf (stderr,"qemu: could not load initrd '%s'\n" , initrd_filename); -exit (1 ); +exit (EXIT_FAILURE ); }/* initialization which should be done by firmware */
hw/sh4/shix.c +2 -2
@@ -59,7 +59,7 @@ static void shix_init(MachineState *machine) cpu =cpu_sh4_init (cpu_model);if (cpu ==NULL ) {fprintf (stderr,"Unable to find CPU definition\n" ); -exit (1 ); +exit (EXIT_FAILURE ); }/* Allocate memory space */
@@ -82,7 +82,7 @@ static void shix_init(MachineState *machine) ret =load_image_targphys (bios_name,0 ,0x4000 );if (ret <0 && !qtest_enabled ()) {error_report ("Could not load SHIX bios '%s'" , bios_name); -exit (1 ); +exit (EXIT_FAILURE ); }/* Register peripherals */
Signature · 1 line
2.5.5
PATCH 14/26 x86: use exit(EXIT_SUCCESS) and exit(EXIT_FAILURE)
In reply to Laurent VivierThis patch is the result of coccinelle scriptscripts/coccinelle/exit.cocci
--- hw/i386/intel_iommu.c | 2 +- hw/i386/multiboot.c | 10 +++++----- hw/i386/pc.c | 24 ++++++++++++------------ hw/i386/pc_piix.c | 2 +- hw/i386/pc_sysfw.c | 6 +++--- hw/i386/x86-iommu.c | 2 +- hw/intc/ioapic.c | 2 +- hw/smbios/smbios.c | 22 +++++++++++----------- hw/xenpv/xen_machine_pv.c | 8 ++++---- target-i386/kvm.c | 8 ++++---- target-i386/machine.c | 2 +- xen-common.c | 4 ++-- xen-hvm.c | 2 +- 13 files changed, 47 insertions(+), 47 deletions(-)
hw/i386/intel_iommu.c +1 -1
@@ -2473,7 +2473,7 @@ static void vtd_realize(DeviceState *dev, Error **errp) !kvm_irqchip_is_split()) {error_report ("Intel Interrupt Remapping cannot work with " "kernel-irqchip=on, please use 'split|off'." ); -exit (1 ); +exit (EXIT_FAILURE ); } }
hw/i386/multiboot.c +5 -5
@@ -194,7 +194,7 @@ int load_multiboot(FWCfgState *fw_cfg,if (((struct elf64_hdr *)header)->e_machine ==EM_X86_64 ) {fprintf (stderr,"Cannot load x86-64 image, give a 32bit one.\n" ); -exit (1 ); +exit (EXIT_FAILURE ); } kernel_size = load_elf(kernel_filename, NULL, NULL, &elf_entry,
@@ -202,7 +202,7 @@ int load_multiboot(FWCfgState *fw_cfg, 0, 0);if (kernel_size <0 ) {fprintf (stderr,"Error while loading elf kernel\n" ); -exit (1 ); +exit (EXIT_FAILURE ); } mh_load_addr = elf_low; mb_kernel_size = elf_high - elf_low;
@@ -211,7 +211,7 @@ int load_multiboot(FWCfgState *fw_cfg, mbs.mb_buf =g_malloc (mb_kernel_size);if (rom_copy (mbs.mb_buf, mh_load_addr, mb_kernel_size) != mb_kernel_size) {fprintf (stderr,"Error while fetching elf kernel from rom\n" ); -exit (1 ); +exit (EXIT_FAILURE ); } mb_debug("qemu: loading multiboot-elf kernel (%#x bytes) with entry %#zx\n",
@@ -251,7 +251,7 @@ int load_multiboot(FWCfgState *fw_cfg,fseek (f, mb_kernel_text_offset,SEEK_SET );if (fread (mbs.mb_buf,1 , mb_load_size, f) != mb_load_size) {fprintf (stderr,"fread() failed\n" ); -exit (1 ); +exit (EXIT_FAILURE ); }memset (mbs.mb_buf + mb_load_size,0 , mb_kernel_size - mb_load_size);fclose (f);
@@ -308,7 +308,7 @@ int load_multiboot(FWCfgState *fw_cfg, mb_mod_length =get_image_size (initrd_filename);if (mb_mod_length <0 ) {fprintf (stderr,"Failed to open file '%s'\n" , initrd_filename); -exit (1 ); +exit (EXIT_FAILURE ); } mbs.mb_buf_size =TARGET_PAGE_ALIGN (mb_mod_length + mbs.mb_buf_size);
hw/i386/pc.c +12 -12
@@ -854,7 +854,7 @@ static void load_linux(PCMachineState *pcms, MIN(ARRAY_SIZE(header), kernel_size)) {fprintf (stderr,"qemu: could not load kernel '%s': %s\n" , kernel_filename,strerror (errno)); -exit (1 ); +exit (EXIT_FAILURE ); }/* kernel protocol version */
@@ -957,14 +957,14 @@ static void load_linux(PCMachineState *pcms,if (initrd_filename) {if (protocol <0x200 ) {fprintf (stderr,"qemu: linux kernel too old to load a ram disk\n" ); -exit (1 ); +exit (EXIT_FAILURE ); } initrd_size =get_image_size (initrd_filename);if (initrd_size <0 ) {fprintf (stderr,"qemu: error reading initrd %s: %s\n" , initrd_filename,strerror (errno)); -exit (1 ); +exit (EXIT_FAILURE ); } initrd_addr = (initrd_max-initrd_size) & ~4095 ;
@@ -988,7 +988,7 @@ static void load_linux(PCMachineState *pcms, setup_size = (setup_size+1 )*512 ;if (setup_size > kernel_size) {fprintf (stderr,"qemu: invalid kernel header\n" ); -exit (1 ); +exit (EXIT_FAILURE ); } kernel_size -= setup_size;
@@ -997,11 +997,11 @@ static void load_linux(PCMachineState *pcms,fseek (f,0 ,SEEK_SET );if (fread (setup,1 , setup_size, f) != setup_size) {fprintf (stderr,"fread() failed\n" ); -exit (1 ); +exit (EXIT_FAILURE ); }if (fread (kernel,1 , kernel_size, f) != kernel_size) {fprintf (stderr,"fread() failed\n" ); -exit (1 ); +exit (EXIT_FAILURE ); }fclose (f);
@@ -1009,14 +1009,14 @@ static void load_linux(PCMachineState *pcms,if (dtb_filename) {if (protocol <0x209 ) {fprintf (stderr,"qemu: Linux kernel too old to load a dtb\n" ); -exit (1 ); +exit (EXIT_FAILURE ); } dtb_size =get_image_size (dtb_filename);if (dtb_size <=0 ) {fprintf (stderr,"qemu: error reading dtb %s: %s\n" , dtb_filename,strerror (errno)); -exit (1 ); +exit (EXIT_FAILURE ); } setup_data_offset =QEMU_ALIGN_UP (kernel_size,16 );
@@ -1171,13 +1171,13 @@ void pc_cpus_init(PCMachineState *pcms) model_pieces =g_strsplit (machine->cpu_model,"," ,2 );if (!model_pieces[0 ]) {error_report ("Invalid/empty CPU model name" ); -exit (1 ); +exit (EXIT_FAILURE ); } oc =cpu_class_by_name (TYPE_X86_CPU , model_pieces[0 ]);if (oc ==NULL ) {error_report ("Unable to find CPU definition: %s" , model_pieces[0 ]); -exit (1 ); +exit (EXIT_FAILURE ); } typename =object_class_get_name (oc); cc =CPU_CLASS (oc);
@@ -1195,7 +1195,7 @@ void pc_cpus_init(PCMachineState *pcms)if (pcms->apic_id_limit >ACPI_CPU_HOTPLUG_ID_LIMIT ) {error_report ("max_cpus is too large. APIC ID of last CPU is %u" , pcms->apic_id_limit -1 ); -exit (1 ); +exit (EXIT_FAILURE ); } pcms->possible_cpus = g_malloc0(sizeof(CPUArchIdList) +
@@ -2096,7 +2096,7 @@ bool pc_machine_is_smm_enabled(PCMachineState *pcms)if (pcms->smm ==ON_OFF_AUTO_ON ) {error_report ("System Management Mode not supported by this hypervisor." ); -exit (1 ); +exit (EXIT_FAILURE ); }return false; }
hw/i386/pc_piix.c +1 -1
@@ -404,7 +404,7 @@ static void pc_xen_hvm_init(MachineState *machine)if (!xen_enabled ()) {error_report ("xenfv machine requires the xen accelerator" ); -exit (1 ); +exit (EXIT_FAILURE ); }pc_xen_hvm_init_pci (machine);
hw/i386/pc_sysfw.c +3 -3
@@ -150,7 +150,7 @@ static void pc_system_flash_init(MemoryRegion *rom_memory)error_report ("%s" , fatal_errmsg);loc_pop (&loc);g_free (fatal_errmsg); -exit (1 ); +exit (EXIT_FAILURE ); } phys_addr -= size;
@@ -204,7 +204,7 @@ static void old_pc_system_rom_init(MemoryRegion *rom_memory, bool isapc_ram_fw)if (ret !=0 ) { bios_error:fprintf (stderr,"qemu: could not load PC BIOS '%s'\n" , bios_name); -exit (1 ); +exit (EXIT_FAILURE ); }g_free (filename);
@@ -246,7 +246,7 @@ void pc_system_firmware_init(MemoryRegion *rom_memory, bool isapc_ram_fw)/* Older KVM cannot execute from device memory. So, flash memory * cannot be used unless the readonly memory kvm capability is present. */ fprintf (stderr,"qemu: pflash with kvm requires KVM readonly memory support\n" ); -exit (1 ); +exit (EXIT_FAILURE ); }pc_system_flash_init (rom_memory);
hw/i386/x86-iommu.c +1 -1
@@ -60,7 +60,7 @@ static void x86_iommu_set_default(X86IOMMUState *x86_iommu)if (x86_iommu_default) {error_report ("QEMU does not support multiple vIOMMUs " "for x86 yet." ); -exit (1 ); +exit (EXIT_FAILURE ); } x86_iommu_default = x86_iommu;
hw/intc/ioapic.c +1 -1
@@ -402,7 +402,7 @@ static void ioapic_realize(DeviceState *dev, Error **errp)if (s->version !=0x11 && s->version !=0x20 ) {error_report ("IOAPIC only supports version 0x11 or 0x20 " "(default: 0x11)." ); -exit (1 ); +exit (EXIT_FAILURE ); } memory_region_init_io(&s->io_memory, OBJECT(s), &ioapic_io_ops, s,
hw/smbios/smbios.c +11 -11
@@ -332,7 +332,7 @@ static void smbios_validate_table(void)if (smbios_type4_count && smbios_type4_count != expect_t4_count) {error_report ("Expected %d SMBIOS Type 4 tables, got %d instead" , expect_t4_count, smbios_type4_count); -exit (1 ); +exit (EXIT_FAILURE ); } }
@@ -733,7 +733,7 @@ void smbios_set_defaults(const char *manufacturer, const char *product, SMBIOS_MAX_TYPE+1, 2) < SMBIOS_MAX_TYPE+1) {error_report ("can't process fields for smbios " "types > 1 on machine versions < 2.1!" ); -exit (1 ); +exit (EXIT_FAILURE ); } }else {g_free (smbios_entries);
@@ -898,7 +898,7 @@ void smbios_entry_add(QemuOpts *opts) size =get_image_size (val);if (size ==-1 || size <sizeof (struct smbios_structure_header )) {error_report ("Cannot read SMBIOS file %s" , val); -exit (1 ); +exit (EXIT_FAILURE ); }/*
@@ -912,13 +912,13 @@ void smbios_entry_add(QemuOpts *opts)if (load_image (val, (uint8_t *)header) != size) {error_report ("Failed to load SMBIOS file %s" , val); -exit (1 ); +exit (EXIT_FAILURE ); }if (test_bit (header->type, have_fields_bitmap)) {error_report ("can't load type %d struct, fields already specified!" , header->type); -exit (1 ); +exit (EXIT_FAILURE ); }set_bit (header->type, have_binfile_bitmap);
@@ -964,12 +964,12 @@ void smbios_entry_add(QemuOpts *opts)if (type >SMBIOS_MAX_TYPE ) {error_report ("out of range!" ); -exit (1 ); +exit (EXIT_FAILURE ); }if (test_bit (type, have_binfile_bitmap)) {error_report ("can't add fields, binary file already loaded!" ); -exit (1 ); +exit (EXIT_FAILURE ); }set_bit (type, have_fields_bitmap);
@@ -985,7 +985,7 @@ void smbios_entry_add(QemuOpts *opts)if (val) {if (sscanf (val,"%hhu.%hhu" , &type0.major, &type0.minor) !=2 ) {error_report ("Invalid release" ); -exit (1 ); +exit (EXIT_FAILURE ); } type0.have_major_minor = true; }
@@ -1003,7 +1003,7 @@ void smbios_entry_add(QemuOpts *opts)if (val) {if (qemu_uuid_parse (val, qemu_uuid) !=0 ) {error_report ("Invalid UUID" ); -exit (1 ); +exit (EXIT_FAILURE ); } qemu_uuid_set = true; }
@@ -1047,10 +1047,10 @@ void smbios_entry_add(QemuOpts *opts)default :error_report ("Don't know how to build fields for SMBIOS type %ld" , type); -exit (1 ); +exit (EXIT_FAILURE ); } }error_report ("Must specify type= or file=" ); -exit (1 ); +exit (EXIT_FAILURE ); }
hw/xenpv/xen_machine_pv.c +4 -4
@@ -37,7 +37,7 @@ static void xen_init_pv(MachineState *machine)/* Initialize backend core & drivers */ if (xen_be_init () !=0 ) {fprintf (stderr,"%s: xen backend core setup failed\n" , __FUNCTION__); -exit (1 ); +exit (EXIT_FAILURE ); }switch (xen_mode) {
@@ -52,18 +52,18 @@ static void xen_init_pv(MachineState *machine)if (xen_domain_build_pv (kernel_filename, initrd_filename, kernel_cmdline) <0 ) {fprintf (stderr,"xen pv domain creation failed\n" ); -exit (1 ); +exit (EXIT_FAILURE ); } break; }#endif case XEN_EMULATE :fprintf (stderr,"xen emulation not implemented (yet)\n" ); -exit (1 ); +exit (EXIT_FAILURE );break ;default :fprintf (stderr,"unhandled xen_mode %d\n" , xen_mode); -exit (1 ); +exit (EXIT_FAILURE );break ; }
target-i386/kvm.c +4 -4
@@ -193,7 +193,7 @@ static struct kvm_cpuid2 *try_get_cpuid(KVMState *s, int max) }else {fprintf (stderr,"KVM_GET_SUPPORTED_CPUID failed: %s\n" ,strerror (-r)); -exit (1 ); +exit (EXIT_FAILURE ); } }return cpuid;
@@ -426,7 +426,7 @@ static void kvm_mce_inject(X86CPU *cpu, hwaddr paddr, int code)static void hardware_memory_error (void ) {fprintf (stderr,"Hardware memory error!\n" ); -exit (1 ); +exit (EXIT_FAILURE ); }int kvm_arch_on_sigbus_vcpu (CPUState *c,int code,void *addr)
@@ -3228,7 +3228,7 @@ void kvm_arch_init_irq_routing(KVMState *s)for (i =0 ; i <IOAPIC_NUM_PINS ; i++) {if (kvm_irqchip_add_msi_route (s,0 ,NULL ) <0 ) {error_report ("Could not enable split IRQ mode." ); -exit (1 ); +exit (EXIT_FAILURE ); } } }
@@ -3242,7 +3242,7 @@ int kvm_arch_irqchip_create(MachineState *ms, KVMState *s)if (ret) {error_report ("Could not enable split irqchip mode: %s" ,strerror (-ret)); -exit (1 ); +exit (EXIT_FAILURE ); }else {DPRINTF ("Enabled KVM_CAP_SPLIT_IRQCHIP\n" ); kvm_split_irqchip = true;
target-i386/machine.c +1 -1
@@ -142,7 +142,7 @@ static const VMStateDescription vmstate_mtrr_var = {static void put_fpreg_error (QEMUFile *f,void *opaque,size_t size) {fprintf (stderr,"call put_fpreg() with invalid arguments\n" ); -exit (0 ); +exit (EXIT_SUCCESS ); }/* XXX: add that in a FPU generic layer */
xen-common.c +2 -2
@@ -92,13 +92,13 @@ static void xenstore_record_dm_state(struct xs_handle *xs, const char *state)if (xs ==NULL ) {fprintf (stderr,"xenstore connection not initialized\n" ); -exit (1 ); +exit (EXIT_FAILURE ); }snprintf (path,sizeof (path),"device-model/%u/state" , xen_domid);if (!xs_write (xs,XBT_NULL , path, state,strlen (state))) {fprintf (stderr,"error recording dm state\n" ); -exit (1 ); +exit (EXIT_FAILURE ); } }
xen-hvm.c +1 -1
@@ -1320,7 +1320,7 @@ void xen_hvm_init(PCMachineState *pcms, MemoryRegion **ram_memory) err:error_report ("xen hardware virtual machine initialisation failed" ); -exit (1 ); +exit (EXIT_FAILURE ); }void destroy_hvm_domain (bool reboot)
Signature · 1 line
2.5.5
PATCH 15/26 mips: use exit(EXIT_SUCCESS) and exit(EXIT_FAILURE)
In reply to Laurent VivierThis patch is the result of coccinelle scriptscripts/coccinelle/exit.cocci
--- hw/mips/mips_fulong2e.c | 12 ++++++------ hw/mips/mips_jazz.c | 10 +++++----- hw/mips/mips_malta.c | 20 ++++++++++---------- hw/mips/mips_mipssim.c | 10 +++++----- hw/mips/mips_r4k.c | 10 +++++----- hw/pci-host/bonito.c | 2 +- 6 files changed, 32 insertions(+), 32 deletions(-)
hw/mips/mips_fulong2e.c +6 -6
@@ -121,7 +121,7 @@ static int64_t load_kernel (CPUMIPSState *env) (uint64_t *)&kernel_high, 0, EM_MIPS, 1, 0) < 0) {fprintf (stderr,"qemu: could not load kernel '%s'\n" , loaderparams.kernel_filename); -exit (1 ); +exit (EXIT_FAILURE ); }/* load initrd */
@@ -135,7 +135,7 @@ static int64_t load_kernel (CPUMIPSState *env)fprintf (stderr,"qemu: memory too small for initial ram disk '%s'\n" , loaderparams.initrd_filename); -exit (1 ); +exit (EXIT_FAILURE ); } initrd_size =load_image_targphys (loaderparams.initrd_filename, initrd_offset, ram_size - initrd_offset);
@@ -143,7 +143,7 @@ static int64_t load_kernel (CPUMIPSState *env)if (initrd_size == (target_ulong) -1 ) {fprintf (stderr,"qemu: could not load initial ram disk '%s'\n" , loaderparams.initrd_filename); -exit (1 ); +exit (EXIT_FAILURE ); } }
@@ -281,7 +281,7 @@ static void mips_fulong2e_init(MachineState *machine) cpu =cpu_mips_init (cpu_model);if (cpu ==NULL ) {fprintf (stderr,"Unable to find CPU definition\n" ); -exit (1 ); +exit (EXIT_FAILURE ); } env = &cpu->env;
@@ -329,7 +329,7 @@ static void mips_fulong2e_init(MachineState *machine)if ((bios_size <0 || bios_size >BIOS_SIZE ) && !kernel_filename && !qtest_enabled ()) {error_report ("Could not load MIPS bios '%s'" , bios_name); -exit (1 ); +exit (EXIT_FAILURE ); } }
@@ -346,7 +346,7 @@ static void mips_fulong2e_init(MachineState *machine) isa_bus =vt82c686b_init (pci_bus,PCI_DEVFN (FULONG2E_VIA_SLOT ,0 ));if (!isa_bus) {fprintf (stderr,"vt82c686b_init error\n" ); -exit (1 ); +exit (EXIT_FAILURE ); }/* Interrupt controller */
hw/mips/mips_jazz.c +5 -5
@@ -154,7 +154,7 @@ static void mips_jazz_init(MachineState *machine, cpu =cpu_mips_init (cpu_model);if (cpu ==NULL ) {fprintf (stderr,"Unable to find CPU definition\n" ); -exit (1 ); +exit (EXIT_FAILURE ); } env = &cpu->env;qemu_register_reset (main_cpu_reset, cpu);
@@ -197,7 +197,7 @@ static void mips_jazz_init(MachineState *machine, }if ((bios_size <0 || bios_size >MAGNUM_BIOS_SIZE ) && !qtest_enabled ()) {error_report ("Could not load MIPS bios '%s'" , bios_name); -exit (1 ); +exit (EXIT_FAILURE ); }/* Init CPU internal devices */
@@ -278,10 +278,10 @@ static void mips_jazz_init(MachineState *machine,break ; }else if (is_help_option (nd->model)) {fprintf (stderr,"qemu: Supported NICs: dp83932\n" ); -exit (1 ); +exit (EXIT_FAILURE ); }else {fprintf (stderr,"qemu: Unsupported NIC: %s\n" , nd->model); -exit (1 ); +exit (EXIT_FAILURE ); } }
@@ -293,7 +293,7 @@ static void mips_jazz_init(MachineState *machine,/* Floppy */ if (drive_get_max_bus (IF_FLOPPY ) >=MAX_FD ) {fprintf (stderr,"qemu: too many floppy drives\n" ); -exit (1 ); +exit (EXIT_FAILURE ); }for (n =0 ; n <MAX_FD ; n++) { fds[n] =drive_get (IF_FLOPPY ,0 , n);
hw/mips/mips_malta.c +10 -10
@@ -803,7 +803,7 @@ static int64_t load_kernel (void) big_endian, EM_MIPS, 1, 0) < 0) {fprintf (stderr,"qemu: could not load kernel '%s'\n" , loaderparams.kernel_filename); -exit (1 ); +exit (EXIT_FAILURE ); }/* Sanity check where the kernel has been linked */
@@ -811,7 +811,7 @@ static int64_t load_kernel (void)if (kernel_entry &0x80000000ll ) {error_report ("KVM guest kernels must be linked in useg. " "Did you forget to enable CONFIG_KVM_GUEST?" ); -exit (1 ); +exit (EXIT_FAILURE ); } xlate_to_kseg0 = cpu_mips_kvm_um_phys_to_kseg0;
@@ -819,7 +819,7 @@ static int64_t load_kernel (void)if (!(kernel_entry &0x80000000ll )) {error_report ("KVM guest kernels aren't supported with TCG. " "Did you unintentionally enable CONFIG_KVM_GUEST?" ); -exit (1 ); +exit (EXIT_FAILURE ); } xlate_to_kseg0 = cpu_mips_phys_to_kseg0;
@@ -836,7 +836,7 @@ static int64_t load_kernel (void)fprintf (stderr,"qemu: memory too small for initial ram disk '%s'\n" , loaderparams.initrd_filename); -exit (1 ); +exit (EXIT_FAILURE ); } initrd_size = load_image_targphys(loaderparams.initrd_filename, initrd_offset,
@@ -845,7 +845,7 @@ static int64_t load_kernel (void)if (initrd_size == (target_ulong) -1 ) {fprintf (stderr,"qemu: could not load initial ram disk '%s'\n" , loaderparams.initrd_filename); -exit (1 ); +exit (EXIT_FAILURE ); } }
@@ -921,7 +921,7 @@ static void create_cpu_without_cps(const char *cpu_model, cpu =cpu_mips_init (cpu_model);if (cpu ==NULL ) {fprintf (stderr,"Unable to find CPU definition\n" ); -exit (1 ); +exit (EXIT_FAILURE ); }/* Init internal devices */
@@ -950,7 +950,7 @@ static void create_cps(MaltaState *s, const char *cpu_model,object_property_set_bool (OBJECT (s->cps), true,"realized" , &err);if (err !=NULL ) {error_report ("%s" ,error_get_pretty (err)); -exit (1 ); +exit (EXIT_FAILURE ); }sysbus_mmio_map_overlap (SYS_BUS_DEVICE (s->cps),0 ,0 ,1 );
@@ -1037,7 +1037,7 @@ void mips_malta_init(MachineState *machine)fprintf (stderr,"qemu: Too much memory for this machine: %d MB, maximum 2048 MB\n" , ((unsigned int )ram_size / (1 <<20 ))); -exit (1 ); +exit (EXIT_FAILURE ); }/* register RAM at high address where it is undisturbed by IO */
@@ -1121,7 +1121,7 @@ void mips_malta_init(MachineState *machine)if (kvm_enabled ()) {error_report ("KVM enabled but no -kernel argument was specified. " "Booting from flash is not supported with KVM." ); -exit (1 ); +exit (EXIT_FAILURE ); }/* Load firmware from flash. */ if (!dinfo) {
@@ -1141,7 +1141,7 @@ void mips_malta_init(MachineState *machine) !kernel_filename && !qtest_enabled()) {error_report ("Could not load MIPS bios '%s', and no " "-kernel argument was specified" , bios_name); -exit (1 ); +exit (EXIT_FAILURE ); } }/* In little endian mode the 32bit words in the bios are swapped,
hw/mips/mips_mipssim.c +5 -5
@@ -80,7 +80,7 @@ static int64_t load_kernel(void) }else {fprintf (stderr,"qemu: could not load kernel '%s'\n" , loaderparams.kernel_filename); -exit (1 ); +exit (EXIT_FAILURE ); }/* load initrd */
@@ -94,7 +94,7 @@ static int64_t load_kernel(void)fprintf (stderr,"qemu: memory too small for initial ram disk '%s'\n" , loaderparams.initrd_filename); -exit (1 ); +exit (EXIT_FAILURE ); } initrd_size =load_image_targphys (loaderparams.initrd_filename, initrd_offset, loaderparams.ram_size - initrd_offset);
@@ -102,7 +102,7 @@ static int64_t load_kernel(void)if (initrd_size == (target_ulong) -1 ) {fprintf (stderr,"qemu: could not load initial ram disk '%s'\n" , loaderparams.initrd_filename); -exit (1 ); +exit (EXIT_FAILURE ); } }return entry;
@@ -165,7 +165,7 @@ mips_mipssim_init(MachineState *machine) cpu =cpu_mips_init (cpu_model);if (cpu ==NULL ) {fprintf (stderr,"Unable to find CPU definition\n" ); -exit (1 ); +exit (EXIT_FAILURE ); } env = &cpu->env;
@@ -201,7 +201,7 @@ mips_mipssim_init(MachineState *machine)/* Bail out if we have neither a kernel image nor boot vector code. */ error_report ("Could not load MIPS bios '%s', and no " "-kernel argument was specified" , bios_name); -exit (1 ); +exit (EXIT_FAILURE ); }else {/* We have a boot vector start address. */ env->active_tc.PC = (target_long )(int32_t )0xbfc00000 ;
hw/mips/mips_r4k.c +5 -5
@@ -98,7 +98,7 @@ static int64_t load_kernel(void) }else {fprintf (stderr,"qemu: could not load kernel '%s'\n" , loaderparams.kernel_filename); -exit (1 ); +exit (EXIT_FAILURE ); }/* load initrd */
@@ -112,7 +112,7 @@ static int64_t load_kernel(void)fprintf (stderr,"qemu: memory too small for initial ram disk '%s'\n" , loaderparams.initrd_filename); -exit (1 ); +exit (EXIT_FAILURE ); } initrd_size = load_image_targphys(loaderparams.initrd_filename, initrd_offset,
@@ -121,7 +121,7 @@ static int64_t load_kernel(void)if (initrd_size == (target_ulong) -1 ) {fprintf (stderr,"qemu: could not load initial ram disk '%s'\n" , loaderparams.initrd_filename); -exit (1 ); +exit (EXIT_FAILURE ); } }
@@ -194,7 +194,7 @@ void mips_r4k_init(MachineState *machine) cpu =cpu_mips_init (cpu_model);if (cpu ==NULL ) {fprintf (stderr,"Unable to find CPU definition\n" ); -exit (1 ); +exit (EXIT_FAILURE ); } env = &cpu->env;
@@ -208,7 +208,7 @@ void mips_r4k_init(MachineState *machine)fprintf (stderr,"qemu: Too much memory for this machine: %d MB, maximum 256 MB\n" , ((unsigned int )ram_size / (1 <<20 ))); -exit (1 ); +exit (EXIT_FAILURE ); }memory_region_allocate_system_memory (ram,NULL ,"mips_r4k.ram" , ram_size);
hw/pci-host/bonito.c +1 -1
@@ -451,7 +451,7 @@ static uint32_t bonito_sbridge_pciaddr(void *opaque, hwaddr addr)if (idsel ==0 ) {fprintf (stderr,"error in bonito pci config address " TARGET_FMT_plx",pcimap_cfg=%x\n" , addr, s->regs[BONITO_PCIMAP_CFG ]); -exit (1 ); +exit (EXIT_FAILURE ); } pciaddr =PCI_ADDR (pci_bus_num (phb->bus), devno, funno, regno); DPRINTF("cfgaddr %x pciaddr %x busno %x devno %d funno %d regno %d\n",
Signature · 1 line
2.5.5
PATCH 16/26 s390: use exit(EXIT_SUCCESS) and exit(EXIT_FAILURE)
In reply to Laurent VivierThis patch is the result of coccinelle scriptscripts/coccinelle/exit.cocci
--- target-s390x/cpu.c | 2 +- target-s390x/kvm.c | 18 +++++++++--------- target-s390x/mmu_helper.c | 2 +- 3 files changed, 11 insertions(+), 11 deletions(-)
target-s390x/cpu.c +1 -1
@@ -385,7 +385,7 @@ unsigned int s390_cpu_set_state(uint8_t cpu_state, S390CPU *cpu)default :error_report ("Requested CPU state is not a valid S390 CPU state: %u" , cpu_state); -exit (1 ); +exit (EXIT_FAILURE ); }if (kvm_enabled () && cpu->env.cpu_state != cpu_state) {kvm_s390_set_cpu_state (cpu, cpu_state);
target-s390x/kvm.c +9 -9
@@ -920,13 +920,13 @@ static void inject_vcpu_irq_legacy(CPUState *cs, struct kvm_s390_irq *irq) r =s390_kvm_irq_to_interrupt (irq, &kvmint);if (r <0 ) {fprintf (stderr,"%s called with bogus interrupt\n" , __func__); -exit (1 ); +exit (EXIT_FAILURE ); } r =kvm_vcpu_ioctl (cs,KVM_S390_INTERRUPT , &kvmint);if (r <0 ) {fprintf (stderr,"KVM failed to inject interrupt\n" ); -exit (1 ); +exit (EXIT_FAILURE ); } }
@@ -941,7 +941,7 @@ void kvm_s390_vcpu_interrupt(S390CPU *cpu, struct kvm_s390_irq *irq)return ; }error_report ("KVM failed to inject interrupt %llx" , irq->type); -exit (1 ); +exit (EXIT_FAILURE ); }inject_vcpu_irq_legacy (cs, irq);
@@ -955,13 +955,13 @@ static void __kvm_s390_floating_interrupt(struct kvm_s390_irq *irq) r =s390_kvm_irq_to_interrupt (irq, &kvmint);if (r <0 ) {fprintf (stderr,"%s called with bogus interrupt\n" , __func__); -exit (1 ); +exit (EXIT_FAILURE ); } r =kvm_vm_ioctl (kvm_state,KVM_S390_INTERRUPT , &kvmint);if (r <0 ) {fprintf (stderr,"KVM failed to inject interrupt\n" ); -exit (1 ); +exit (EXIT_FAILURE ); } }
@@ -1905,15 +1905,15 @@ static int handle_intercept(S390CPU *cpu)break ;case ICPT_SOFT_INTERCEPT :fprintf (stderr,"KVM unimplemented icpt SOFT\n" ); -exit (1 ); +exit (EXIT_FAILURE );break ;case ICPT_IO :fprintf (stderr,"KVM unimplemented icpt IO\n" ); -exit (1 ); +exit (EXIT_FAILURE );break ;default :fprintf (stderr,"Unknown intercept code: %d\n" , icpt_code); -exit (1 ); +exit (EXIT_FAILURE );break ; }
@@ -2222,7 +2222,7 @@ int kvm_s390_set_cpu_state(S390CPU *cpu, uint8_t cpu_state)default :error_report ("Requested CPU state is not a valid S390 CPU state: %u" , cpu_state); -exit (1 ); +exit (EXIT_FAILURE ); } ret =kvm_vcpu_ioctl (CPU (cpu),KVM_SET_MP_STATE , &mp_state);
target-s390x/mmu_helper.c +1 -1
@@ -414,7 +414,7 @@ static bool lowprot_enabled(const CPUS390XState *env)default :/* We don't support access register mode */ error_report ("unsupported addressing mode" ); -exit (1 ); +exit (EXIT_FAILURE ); } }
Signature · 1 line
2.5.5
Re: [Qemu-devel] [PATCH 16/26] s390: use exit(EXIT_SUCCESS) and exit(EXIT_FAILURE)
Quoted 2 lines · On Fri, 16 Sep 2016 15:56:07 +0200 Laurent Vivier <[email protected]> wrote:
This patch is the result of coccinelle script
scripts/coccinelle/exit.cocci
As stated in my other reply, I'm not convinced that this conversion is useful, but I did take a look at the exit()s we have in here:
Quoted 14 lines
Signed-off-by Laurent Vivier <[email protected]>CC Cornelia Huck <[email protected]>--- target-s390x/cpu.c | 2 +- target-s390x/kvm.c | 18 +++++++++--------- target-s390x/mmu_helper.c | 2 +- 3 files changed, 11 insertions(+), 11 deletions(-)target-s390x/cpu.c +0
-0
target-s390x/cpu.c unsigned int s390_cpu_set_state(uint8_t cpu_state, S390CPU *cpu) · line 388
Quoted 4 lines
target-s390x/cpu.c +0
-1@@ -385,7 +385,7 @@ unsigned int s390_cpu_set_state(uint8_t cpu_state, S390CPU *cpu)default :error_report ("Requested CPU state is not a valid S390 CPU state: %u" , cpu_state); -exit (1 );
Can only be hit via programming error in qemu and exiting is the only thing that really makes sense.
target-s390x/kvm.c static void inject_vcpu_irq_legacy(CPUState *cs, struct kvm_s390_irq *irq) · line 923
Quoted 13 lines
target-s390x/cpu.c +1
-0+exit (EXIT_FAILURE ); }if (kvm_enabled () && cpu->env.cpu_state != cpu_state) {kvm_s390_set_cpu_state (cpu, cpu_state);target-s390x/kvm.c +0
-1@@ -920,13 +920,13 @@ static void inject_vcpu_irq_legacy(CPUState *cs, struct kvm_s390_irq *irq) r =s390_kvm_irq_to_interrupt (irq, &kvmint);if (r <0 ) {fprintf (stderr,"%s called with bogus interrupt\n" , __func__); -exit (1 );
Dito, but we probably should convert the fprintf to error_report().
target-s390x/kvm.c static void inject_vcpu_irq_legacy(CPUState *cs, struct kvm_s390_irq *irq) · line 929
Quoted 7 lines
target-s390x/kvm.c +1
-1+exit (EXIT_FAILURE ); } r =kvm_vcpu_ioctl (cs,KVM_S390_INTERRUPT , &kvmint);if (r <0 ) {fprintf (stderr,"KVM failed to inject interrupt\n" ); -exit (1 );
There's several reasons why we could hit this:
- qemu programming error
- the kvm module can't get memory... we're probably already dead
- we've hit some internal limit in the kvm module... should not happen and is probably a follow-on of a programming error in qemu as well
So I think the exit is fine, but we should still convert to error_report().
target-s390x/kvm.c void kvm_s390_vcpu_interrupt(S390CPU *cpu, struct kvm_s390_irq *irq) · line 944
Quoted 9 lines
target-s390x/kvm.c +1
-1+exit (EXIT_FAILURE ); } }@@ -941,7 +941,7 @@ void kvm_s390_vcpu_interrupt(S390CPU *cpu, struct kvm_s390_irq *irq)return ; }error_report ("KVM failed to inject interrupt %llx" , irq->type); -exit (1 );
Dito as for the old injection interface.
target-s390x/kvm.c static void __kvm_s390_floating_interrupt(struct kvm_s390_irq *irq) · line 958
Quoted 9 lines
target-s390x/kvm.c +1
-1+exit (EXIT_FAILURE ); }inject_vcpu_irq_legacy (cs, irq);@@ -955,13 +955,13 @@ static void __kvm_s390_floating_interrupt(struct kvm_s390_irq *irq) r =s390_kvm_irq_to_interrupt (irq, &kvmint);if (r <0 ) {fprintf (stderr,"%s called with bogus interrupt\n" , __func__); -exit (1 );
Same as for vcpu interrupts.
target-s390x/kvm.c static void __kvm_s390_floating_interrupt(struct kvm_s390_irq *irq) · line 964
Quoted 7 lines
target-s390x/kvm.c +1
-1+exit (EXIT_FAILURE ); } r =kvm_vm_ioctl (kvm_state,KVM_S390_INTERRUPT , &kvmint);if (r <0 ) {fprintf (stderr,"KVM failed to inject interrupt\n" ); -exit (1 );
And here as well.
Quoted 10 lines
target-s390x/kvm.c +2
-1+exit (EXIT_FAILURE ); } }@@ -1905,15 +1905,15 @@ static int handle_intercept(S390CPU *cpu)break ;case ICPT_SOFT_INTERCEPT :fprintf (stderr,"KVM unimplemented icpt SOFT\n" ); -exit (1 ); +exit (EXIT_FAILURE );
target-s390x/kvm.c static int handle_intercept(S390CPU *cpu) · line 1916
Quoted 10 lines
target-s390x/kvm.c +2
-2break ;case ICPT_IO :fprintf (stderr,"KVM unimplemented icpt IO\n" ); -exit (1 ); +exit (EXIT_FAILURE );break ;default :fprintf (stderr,"Unknown intercept code: %d\n" , icpt_code); -exit (1 ); +exit (EXIT_FAILURE );
What happened here is that we intercepted with an intercept that we either don't expect to get or we don't know about. In either case, this is something the kvm module should have avoided/handled and exit()ing is probably the best thing to do here as well (or implement support for an intercept). But this should probably use error_report() as well.
target-s390x/kvm.c int kvm_s390_set_cpu_state(S390CPU *cpu, uint8_t cpu_state) · line 2225
Quoted 8 lines
target-s390x/kvm.c +0
-1break ; }@@ -2222,7 +2222,7 @@ int kvm_s390_set_cpu_state(S390CPU *cpu, uint8_t cpu_state)default :error_report ("Requested CPU state is not a valid S390 CPU state: %u" , cpu_state); -exit (1 );
qemu programming error
target-s390x/mmu_helper.c static bool lowprot_enabled(const CPUS390XState *env) · line 417
Quoted 13 lines
target-s390x/kvm.c +1
-0+exit (EXIT_FAILURE ); } ret =kvm_vcpu_ioctl (CPU (cpu),KVM_SET_MP_STATE , &mp_state);target-s390x/mmu_helper.c +0
-1@@ -414,7 +414,7 @@ static bool lowprot_enabled(const CPUS390XState *env)default :/* We don't support access register mode */ error_report ("unsupported addressing mode" ); -exit (1 );
Not implemented - until someone does implement it, exit() looks like the best way out.
target-s390x/mmu_helper.c static bool lowprot_enabled(const CPUS390XState *env) · line 420
Quoted 4 lines
target-s390x/mmu_helper.c +1
-0+exit (EXIT_FAILURE ); } }
All in all, I think our usage of exit() is fine, but some more error_report() conversions should be done. On the todo list.
PATCH 17/26 tcg: use exit(EXIT_SUCCESS) and exit(EXIT_FAILURE)
In reply to Laurent VivierThis patch is the result of coccinelle scriptscripts/coccinelle/exit.cocci
--- cpus.c | 16 ++++++++-------- cputlb.c | 2 +- exec.c | 2 +- tcg/tcg.c | 2 +- translate-all.c | 2 +- 5 files changed, 12 insertions(+), 12 deletions(-)
cpus.c +8 -8
@@ -159,7 +159,7 @@ int64_t cpu_get_icount_raw(void)if (cpu) {if (!cpu->can_do_io) {fprintf (stderr,"Bad icount read\n" ); -exit (1 ); +exit (EXIT_FAILURE ); } icount -= (cpu->icount_decr.u16.low + cpu->icount_extra); }
@@ -829,7 +829,7 @@ static void qemu_kvm_eat_signals(CPUState *cpu) r =sigtimedwait (&waitset, &siginfo, &ts);if (r ==-1 && !(errno ==EAGAIN || errno ==EINTR )) {perror ("sigtimedwait" ); -exit (1 ); +exit (EXIT_FAILURE ); }switch (r) {
@@ -845,7 +845,7 @@ static void qemu_kvm_eat_signals(CPUState *cpu) r =sigpending (&chkset);if (r ==-1 ) {perror ("sigpending" ); -exit (1 ); +exit (EXIT_FAILURE ); } }while (sigismember (&chkset,SIG_IPI ) ||sigismember (&chkset,SIGBUS )); }
@@ -882,7 +882,7 @@ static void qemu_kvm_init_cpu_signals(CPUState *cpu) r =kvm_set_signal_mask (cpu, &set);if (r) {fprintf (stderr,"kvm_set_signal_mask: %s\n" ,strerror (-r)); -exit (1 ); +exit (EXIT_FAILURE ); } }
@@ -1070,7 +1070,7 @@ static void *qemu_kvm_cpu_thread_fn(void *arg) r =kvm_init_vcpu (cpu);if (r <0 ) {fprintf (stderr,"kvm_init_vcpu failed: %s\n" ,strerror (-r)); -exit (1 ); +exit (EXIT_FAILURE ); }qemu_kvm_init_cpu_signals (cpu);
@@ -1100,7 +1100,7 @@ static void *qemu_dummy_cpu_thread_fn(void *arg) {#ifdef _WIN32fprintf (stderr,"qtest is not supported under Windows\n" ); -exit (1 ); +exit (EXIT_FAILURE );#else CPUState *cpu = arg;sigset_t waitset;
@@ -1130,7 +1130,7 @@ static void *qemu_dummy_cpu_thread_fn(void *arg) }while (r ==-1 && (errno ==EAGAIN || errno ==EINTR ));if (r ==-1 ) {perror ("sigwait" ); -exit (1 ); +exit (EXIT_FAILURE ); }qemu_mutex_lock_iothread (); current_cpu = cpu;
@@ -1213,7 +1213,7 @@ static void qemu_cpu_kick_thread(CPUState *cpu) err =pthread_kill (cpu->thread->thread,SIG_IPI );if (err) {fprintf (stderr,"qemu:%s: %s" , __func__,strerror (err)); -exit (1 ); +exit (EXIT_FAILURE ); }#else /* _WIN32 */ abort ();
cputlb.c +1 -1
@@ -491,7 +491,7 @@ tb_page_addr_t get_page_addr_code(CPUArchState *env1, target_ulong addr) cc->do_unassigned_access (cpu, addr, false, true,0 ,4 ); }else {report_bad_exec (cpu, addr); -exit (1 ); +exit (EXIT_FAILURE ); } } p = (void *)((uintptr_t )addr + env1->tlb_table[mmu_idx][page_index].addend);
exec.c +1 -1
@@ -1801,7 +1801,7 @@ void qemu_ram_remap(ram_addr_t addr, ram_addr_t length)fprintf (stderr,"Could not remap addr: " RAM_ADDR_FMT "@" RAM_ADDR_FMT "\n" , length, addr); -exit (1 ); +exit (EXIT_FAILURE ); }memory_try_enable_merging (vaddr, length);qemu_ram_setup_dump (vaddr, length);
tcg/tcg.c +1 -1
@@ -1269,7 +1269,7 @@ void tcg_add_target_add_op_defs(const TCGTargetOpDef *tdefs)if (target_parse_constraint (&def->args_ct[i], &ct_str) <0 ) {fprintf (stderr,"Invalid constraint '%s' for arg %d of operation '%s'\n" , ct_str, i, def->name); -exit (1 ); +exit (EXIT_FAILURE ); } } }
translate-all.c +1 -1
@@ -720,7 +720,7 @@ static inline void code_gen_alloc(size_t tb_size) tcg_ctx.code_gen_buffer =alloc_code_gen_buffer ();if (tcg_ctx.code_gen_buffer ==NULL ) {fprintf (stderr,"Could not allocate dynamic translator buffer\n" ); -exit (1 ); +exit (EXIT_FAILURE ); }/* Estimate a good size for the number of TBs we can support. We
Signature · 1 line
2.5.5
PATCH 18/26 posix: use exit(EXIT_SUCCESS) and exit(EXIT_FAILURE)
In reply to Laurent VivierThis patch is the result of coccinelle scriptscripts/coccinelle/exit.cocci
--- os-posix.c | 34 +++++++++++++++++----------------- util/oslib-posix.c | 2 +- 2 files changed, 18 insertions(+), 18 deletions(-)
os-posix.c +17 -17
@@ -121,11 +121,11 @@ void os_set_proc_name(const char *s)This simple way is enough for `top'. */ if (prctl (PR_SET_NAME , name)) {perror ("unable to change process name" ); -exit (1 ); +exit (EXIT_FAILURE ); }#else fprintf (stderr,"Change of process name not supported by your OS\n" ); -exit (1 ); +exit (EXIT_FAILURE );#endif }
@@ -141,14 +141,14 @@ void os_parse_cmd_args(int index, const char *optarg)error_report ("The -smb option is deprecated. " "Please use '-netdev user,smb=...' instead." );if (net_slirp_smb (optarg) <0 ) -exit (1 ); +exit (EXIT_FAILURE );break ;#endif case QEMU_OPTION_runas: user_pwd =getpwnam (optarg);if (!user_pwd) {fprintf (stderr,"User \"%s\" doesn't exist\n" , optarg); -exit (1 ); +exit (EXIT_FAILURE ); }break ;case QEMU_OPTION_chroot:
@@ -170,20 +170,20 @@ static void change_process_uid(void)if (user_pwd) {if (setgid (user_pwd->pw_gid) <0 ) {fprintf (stderr,"Failed to setgid(%d)\n" , user_pwd->pw_gid); -exit (1 ); +exit (EXIT_FAILURE ); }if (initgroups (user_pwd->pw_name, user_pwd->pw_gid) <0 ) {fprintf (stderr,"Failed to initgroups(\"%s\", %d)\n" , user_pwd->pw_name, user_pwd->pw_gid); -exit (1 ); +exit (EXIT_FAILURE ); }if (setuid (user_pwd->pw_uid) <0 ) {fprintf (stderr,"Failed to setuid(%d)\n" , user_pwd->pw_uid); -exit (1 ); +exit (EXIT_FAILURE ); }if (setuid (0 ) !=-1 ) {fprintf (stderr,"Dropping privileges failed\n" ); -exit (1 ); +exit (EXIT_FAILURE ); } } }
@@ -193,11 +193,11 @@ static void change_root(void)if (chroot_dir) {if (chroot (chroot_dir) <0 ) {fprintf (stderr,"chroot failed\n" ); -exit (1 ); +exit (EXIT_FAILURE ); }if (chdir ("/" )) {perror ("not able to chdir to /" ); -exit (1 ); +exit (EXIT_FAILURE ); } }
@@ -210,7 +210,7 @@ void os_daemonize(void)int fds[2 ];if (pipe (fds) ==-1 ) { -exit (1 ); +exit (EXIT_FAILURE ); } pid =fork ();
@@ -229,7 +229,7 @@ void os_daemonize(void)exit (len ==1 && status ==0 ?0 :1 ); }else if (pid <0 ) { -exit (1 ); +exit (EXIT_FAILURE ); }close (fds[0 ]);
@@ -240,9 +240,9 @@ void os_daemonize(void) pid =fork ();if (pid >0 ) { -exit (0 ); +exit (EXIT_SUCCESS ); }else if (pid <0 ) { -exit (1 ); +exit (EXIT_FAILURE ); }umask (027 );
@@ -260,11 +260,11 @@ void os_setup_post(void)if (daemonize) {if (chdir ("/" )) {perror ("not able to chdir to /" ); -exit (1 ); +exit (EXIT_FAILURE ); }TFR (fd =qemu_open ("/dev/null" ,O_RDWR ));if (fd ==-1 ) { -exit (1 ); +exit (EXIT_FAILURE ); } }
@@ -288,7 +288,7 @@ void os_setup_post(void) len =write (daemon_pipe, &status,1 ); }while (len <0 && errno ==EINTR );if (len !=1 ) { -exit (1 ); +exit (EXIT_FAILURE ); } } }
util/oslib-posix.c +1 -1
@@ -358,7 +358,7 @@ void os_mem_prealloc(int fd, char *area, size_t memory, Error **errp)if (ret) {/* Terminate QEMU since it can't recover from error */ perror ("os_mem_prealloc: failed to reinstall signal handler" ); -exit (1 ); +exit (EXIT_FAILURE ); }pthread_sigmask (SIG_SETMASK , &oldset,NULL ); }
Signature · 1 line
2.5.5
PATCH 19/26 alpha: use exit(EXIT_SUCCESS) and exit(EXIT_FAILURE)
In reply to Laurent VivierThis patch is the result of coccinelle scriptscripts/coccinelle/exit.cocci
--- hw/alpha/dp264.c | 8 ++++---- 1 file changed, 4 insertions(+), 4 deletions(-)
hw/alpha/dp264.c +4 -4
@@ -110,14 +110,14 @@ static void clipper_init(MachineState *machine) bios_name ? bios_name : "palcode-clipper");if (palcode_filename ==NULL ) {error_report ("no palcode provided" ); -exit (1 ); +exit (EXIT_FAILURE ); } size =load_elf (palcode_filename, cpu_alpha_superpage_to_phys,NULL , &palcode_entry, &palcode_low, &palcode_high,0 ,EM_ALPHA ,0 ,0 );if (size <0 ) {error_report ("could not load palcode '%s'" , palcode_filename); -exit (1 ); +exit (EXIT_FAILURE ); }g_free (palcode_filename);
@@ -137,7 +137,7 @@ static void clipper_init(MachineState *machine) 0, EM_ALPHA, 0, 0);if (size <0 ) {error_report ("could not load kernel '%s'" , kernel_filename); -exit (1 ); +exit (EXIT_FAILURE ); } cpus[0 ]->env.trap_arg1 = kernel_entry;
@@ -155,7 +155,7 @@ static void clipper_init(MachineState *machine)if (initrd_size <0 ) {error_report ("could not load initial ram disk '%s'" , initrd_filename); -exit (1 ); +exit (EXIT_FAILURE ); }/* Put the initrd image as high in memory as possible. */
Signature · 1 line
2.5.5
PATCH 20/26 common: use exit(EXIT_SUCCESS) and exit(EXIT_FAILURE)
In reply to Laurent VivierThis patch is the result of coccinelle scriptscripts/coccinelle/exit.cocci
--- accel.c | 2 +- arch_init.c | 6 +- bootdevice.c | 2 +- contrib/ivshmem-server/main.c | 12 +- gdbstub.c | 2 +- hw/watchdog/watchdog.c | 2 +- kvm-all.c | 8 +- qemu-char.c | 6 +- qemu-nbd.c | 6 +- util/qemu-timer-common.c | 2 +- vl.c | 270 +++++++++++++++++++++--------------------- 11 files changed, 159 insertions(+), 159 deletions(-)
accel.c +1 -1
@@ -122,7 +122,7 @@ void configure_accelerator(MachineState *ms)if (!init_failed) {fprintf (stderr,"No accelerator found!\n" ); } -exit (1 ); +exit (EXIT_FAILURE ); }if (init_failed) {
arch_init.c +3 -3
@@ -221,13 +221,13 @@ void audio_init(void)if (c->isa) {if (!isa_bus) {error_report ("ISA bus not available for %s" , c->name); -exit (1 ); +exit (EXIT_FAILURE ); } c->init.init_isa (isa_bus); }else {if (!pci_bus) {error_report ("PCI bus not available for %s" , c->name); -exit (1 ); +exit (EXIT_FAILURE ); } c->init.init_pci (pci_bus); }
@@ -262,7 +262,7 @@ void do_acpitable_option(const QemuOpts *opts)acpi_table_add (opts, &err);if (err) {error_reportf_err (err,"Wrong acpi table provided: " ); -exit (1 ); +exit (EXIT_FAILURE ); }#endif }
bootdevice.c +1 -1
@@ -173,7 +173,7 @@ void add_boot_device_path(int32_t bootindex, DeviceState *dev, QTAILQ_FOREACH(i, &fw_boot_order, link) {if (i->bootindex == bootindex) {error_report ("Two devices with same boot index %d" , bootindex); -exit (1 ); +exit (EXIT_FAILURE ); }else if (i->bootindex < bootindex) {continue ; }
contrib/ivshmem-server/main.c +6 -6
@@ -77,7 +77,7 @@ ivshmem_server_parse_args(IvshmemServerArgs *args, int argc, char *argv[])switch (c) {case 'h' :/* help */ ivshmem_server_usage (argv[0 ]); -exit (0 ); +exit (EXIT_SUCCESS );break ;case 'v' :/* verbose */
@@ -107,7 +107,7 @@ ivshmem_server_parse_args(IvshmemServerArgs *args, int argc, char *argv[])if (err) {error_report_err (err);ivshmem_server_help (argv[0 ]); -exit (1 ); +exit (EXIT_FAILURE ); }break ;
@@ -115,14 +115,14 @@ ivshmem_server_parse_args(IvshmemServerArgs *args, int argc, char *argv[])if (parse_uint_full (optarg, &v,0 ) <0 ) {fprintf (stderr,"cannot parse n_vectors\n" );ivshmem_server_help (argv[0 ]); -exit (1 ); +exit (EXIT_FAILURE ); } args->n_vectors = v;break ;default :ivshmem_server_usage (argv[0 ]); -exit (1 ); +exit (EXIT_FAILURE );break ; } }
@@ -131,13 +131,13 @@ ivshmem_server_parse_args(IvshmemServerArgs *args, int argc, char *argv[])fprintf (stderr,"too many requested vectors (max is %d)\n" ,IVSHMEM_SERVER_MAX_VECTORS );ivshmem_server_help (argv[0 ]); -exit (1 ); +exit (EXIT_FAILURE ); }if (args->verbose ==1 && args->foreground ==0 ) {fprintf (stderr,"cannot use verbose in daemon mode\n" );ivshmem_server_help (argv[0 ]); -exit (1 ); +exit (EXIT_FAILURE ); } }
gdbstub.c +1 -1
@@ -891,7 +891,7 @@ static int gdb_handle_packet(GDBState *s, const char *line_buf)case 'k' :/* Kill the target */ fprintf (stderr,"\nQEMU: Terminated via GDBstub\n" ); -exit (0 ); +exit (EXIT_SUCCESS );case 'D' :/* Detach packet */ gdb_breakpoint_remove_all ();
hw/watchdog/watchdog.c +1 -1
@@ -120,7 +120,7 @@ void watchdog_perform_action(void)case WDT_POWEROFF :/* same as 'quit' command in monitor */ qapi_event_send_watchdog (WATCHDOG_EXPIRATION_ACTION_POWEROFF , &error_abort); -exit (0 ); +exit (EXIT_SUCCESS );case WDT_PAUSE :/* same as 'stop' command in monitor */ /* In a timer callback, when vm_stop calls qemu_clock_enable
kvm-all.c +4 -4
@@ -1488,7 +1488,7 @@ static void kvm_irqchip_create(MachineState *machine, KVMState *s) ret =kvm_vm_enable_cap (s,KVM_CAP_S390_IRQCHIP ,0 );if (ret <0 ) {fprintf (stderr,"Enable kernel irqchip failed: %s\n" ,strerror (-ret)); -exit (1 ); +exit (EXIT_FAILURE ); } }else {return ;
@@ -1500,14 +1500,14 @@ static void kvm_irqchip_create(MachineState *machine, KVMState *s)if (ret ==0 ) {if (machine_kernel_irqchip_split (machine)) {perror ("Split IRQ chip mode not supported." ); -exit (1 ); +exit (EXIT_FAILURE ); }else { ret =kvm_vm_ioctl (s,KVM_CREATE_IRQCHIP ); } }if (ret <0 ) {fprintf (stderr,"Create kernel irqchip failed: %s\n" ,strerror (-ret)); -exit (1 ); +exit (EXIT_FAILURE ); } kvm_kernel_irqchip = true;
@@ -1632,7 +1632,7 @@ static int kvm_init(MachineState *ms)fprintf (stderr,"Number of %s cpus requested (%d) exceeds " "the maximum cpus supported by KVM (%d)\n" , nc->name, nc->num, hard_vcpus_limit); -exit (1 ); +exit (EXIT_FAILURE ); } } nc++;
qemu-char.c +3 -3
@@ -408,7 +408,7 @@ int qemu_chr_fe_get_msgfd(CharDriverState *s)if (s->replay) {fprintf (stderr,"Replay: get msgfd is not supported for serial devices yet\n" ); -exit (1 ); +exit (EXIT_FAILURE ); }return res; }
@@ -633,7 +633,7 @@ static int mux_proc_byte(CharDriverState *chr, MuxDriver *d, int ch) {const char *term ="QEMU: Terminated\n\r" ;qemu_chr_fe_write_all (chr, (uint8_t *)term,strlen (term)); -exit (0 ); +exit (EXIT_SUCCESS );break ; }case 's' :
@@ -4083,7 +4083,7 @@ void qemu_chr_fe_claim_no_fail(CharDriverState *s)if (qemu_chr_fe_claim (s) !=0 ) {fprintf (stderr,"%s: error chardev \"%s\" already used\n" , __func__, s->label); -exit (1 ); +exit (EXIT_FAILURE ); } }
qemu-nbd.c +3 -3
@@ -687,11 +687,11 @@ int main(int argc, char **argv)break ;case 'V' :version (argv[0 ]); -exit (0 ); +exit (EXIT_SUCCESS );break ;case 'h' :usage (argv[0 ]); -exit (0 ); +exit (EXIT_SUCCESS );break ;case '?' :error_report ("Try `%s --help' for more information." , argv[0 ]);
@@ -730,7 +730,7 @@ int main(int argc, char **argv) }if (!trace_init_backends ()) { -exit (1 ); +exit (EXIT_FAILURE ); }trace_init_file (trace_file);qemu_set_log (LOG_TRACE );
util/qemu-timer-common.c +1 -1
@@ -38,7 +38,7 @@ static void __attribute__((constructor)) init_get_clock(void) ret =QueryPerformanceFrequency (&freq);if (ret ==0 ) {fprintf (stderr,"Could not calibrate ticks\n" ); -exit (1 ); +exit (EXIT_FAILURE ); } clock_freq = freq.QuadPart; }
vl.c +135 -135
999 lines not on this page · raw message
Signature · 1 line
2.5.5
PATCH 21/26 misc machine: use exit(EXIT_SUCCESS) and exit(EXIT_FAILURE)
In reply to Laurent VivierThis patch is the result of coccinelle scriptscripts/coccinelle/exit.cocci
--- hw/cris/axis_dev88.c | 2 +- hw/lm32/lm32_boards.c | 8 ++++---- hw/lm32/milkymist.c | 6 +++--- hw/openrisc/openrisc_sim.c | 4 ++-- hw/tricore/tricore_testboard.c | 4 ++-- hw/unicore32/puv3.c | 6 +++--- 6 files changed, 15 insertions(+), 15 deletions(-)
hw/cris/axis_dev88.c +1 -1
@@ -351,7 +351,7 @@ void axisdev88_init(MachineState *machine)cris_load_image (cpu, &li); }else if (!qtest_enabled ()) {fprintf (stderr,"Kernel image must be specified\n" ); -exit (1 ); +exit (EXIT_FAILURE ); } }
hw/lm32/lm32_boards.c +4 -4
@@ -107,7 +107,7 @@ static void lm32_evr_init(MachineState *machine) cpu =cpu_lm32_init (cpu_model);if (cpu ==NULL ) {fprintf (stderr,"qemu: unable to find CPU '%s'\n" , cpu_model); -exit (1 ); +exit (EXIT_FAILURE ); } env = &cpu->env;
@@ -158,7 +158,7 @@ static void lm32_evr_init(MachineState *machine)if (kernel_size <0 ) {fprintf (stderr,"qemu: could not load kernel '%s'\n" , kernel_filename); -exit (1 ); +exit (EXIT_FAILURE ); } }
@@ -208,7 +208,7 @@ static void lm32_uclinux_init(MachineState *machine) cpu =cpu_lm32_init (cpu_model);if (cpu ==NULL ) {fprintf (stderr,"qemu: unable to find CPU '%s'\n" , cpu_model); -exit (1 ); +exit (EXIT_FAILURE ); } env = &cpu->env;
@@ -260,7 +260,7 @@ static void lm32_uclinux_init(MachineState *machine)if (kernel_size <0 ) {fprintf (stderr,"qemu: could not load kernel '%s'\n" , kernel_filename); -exit (1 ); +exit (EXIT_FAILURE ); } }
hw/lm32/milkymist.c +3 -3
@@ -114,7 +114,7 @@ milkymist_init(MachineState *machine) cpu =cpu_lm32_init (cpu_model);if (cpu ==NULL ) {fprintf (stderr,"qemu: unable to find CPU '%s'\n" , cpu_model); -exit (1 ); +exit (EXIT_FAILURE ); } env = &cpu->env;
@@ -155,7 +155,7 @@ milkymist_init(MachineState *machine)if (!kernel_filename && !dinfo && !bios_filename && !qtest_enabled ()) {fprintf (stderr,"qemu: could not load Milkymist One bios '%s'\n" , bios_name); -exit (1 ); +exit (EXIT_FAILURE ); }g_free (bios_filename);
@@ -194,7 +194,7 @@ milkymist_init(MachineState *machine)if (kernel_size <0 ) {fprintf (stderr,"qemu: could not load kernel '%s'\n" , kernel_filename); -exit (1 ); +exit (EXIT_FAILURE ); } }
hw/openrisc/openrisc_sim.c +2 -2
@@ -89,7 +89,7 @@ static void cpu_openrisc_load_kernel(ram_addr_t ram_size,if (kernel_size <0 ) {fprintf (stderr,"QEMU: couldn't load the kernel '%s'\n" , kernel_filename); -exit (1 ); +exit (EXIT_FAILURE ); } cpu->env.pc = entry; }
@@ -112,7 +112,7 @@ static void openrisc_sim_init(MachineState *machine) cpu =cpu_openrisc_init (cpu_model);if (cpu ==NULL ) {fprintf (stderr,"Unable to find CPU definition!\n" ); -exit (1 ); +exit (EXIT_FAILURE ); }qemu_register_reset (main_cpu_reset, cpu);main_cpu_reset (cpu);
hw/tricore/tricore_testboard.c +2 -2
@@ -52,7 +52,7 @@ static void tricore_load_kernel(CPUTriCoreState *env)if (kernel_size <=0 ) {error_report ("qemu: no kernel file '%s'" , tricoretb_binfo.kernel_filename); -exit (1 ); +exit (EXIT_FAILURE ); } env->PC = entry;
@@ -77,7 +77,7 @@ static void tricore_testboard_init(MachineState *machine, int board_id) cpu =cpu_tricore_init (machine->cpu_model);if (!cpu) {error_report ("Unable to find CPU definition" ); -exit (1 ); +exit (EXIT_FAILURE ); } env = &cpu->env; memory_region_init_ram(ext_cram, NULL, "powerlink_ext_c.ram", 2*1024*1024,
hw/unicore32/puv3.c +3 -3
@@ -101,7 +101,7 @@ static void puv3_load_kernel(const char *kernel_filename) KERNEL_MAX_SIZE);if (size <0 ) {error_report ("Load kernel error: '%s'" , kernel_filename); -exit (1 ); +exit (EXIT_FAILURE ); }/* cheat curses that we have a graphic console, only under ocd console */
@@ -119,7 +119,7 @@ static void puv3_init(MachineState *machine)if (initrd_filename) {error_report ("Please use kernel built-in initramdisk" ); -exit (1 ); +exit (EXIT_FAILURE ); }if (!cpu_model) {
@@ -129,7 +129,7 @@ static void puv3_init(MachineState *machine) cpu =uc32_cpu_init (cpu_model);if (!cpu) {error_report ("Unable to find CPU definition" ); -exit (1 ); +exit (EXIT_FAILURE ); } env = &cpu->env;
Signature · 1 line
2.5.5
PATCH 22/26 blockdev: use exit(EXIT_SUCCESS) and exit(EXIT_FAILURE)
In reply to Laurent VivierThis patch is the result of coccinelle scriptscripts/coccinelle/exit.cocci
--- hw/ide/core.c | 2 +- hw/scsi/lsi53c895a.c | 7 ++++--- hw/sd/ssi-sd.c | 3 ++- 3 files changed, 7 insertions(+), 5 deletions(-)
hw/ide/core.c +1 -1
@@ -2855,7 +2855,7 @@ void ide_drive_get(DriveInfo **hd, int n)if (highest_bus > n_buses) {error_report ("Too many IDE buses defined (%d > %d)" , highest_bus, n_buses); -exit (1 ); +exit (EXIT_FAILURE ); }for (i =0 ; i < n; i++) {
hw/scsi/lsi53c895a.c +4 -3
@@ -28,7 +28,8 @@#define DPRINTF (fmt, ...) \ do { printf("lsi_scsi: " fmt , ## __VA_ARGS__); } while (0)#define BADF (fmt, ...) \ -do { fprintf(stderr, "lsi_scsi: error: " fmt , ## __VA_ARGS__); exit(1);} while (0) +do { fprintf(stderr, "lsi_scsi: error: " fmt , ## __VA_ARGS__); \ + exit(EXIT_FAILURE); } while (0)#else #define DPRINTF (fmt, ...) do {} while(0)#define BADF (fmt, ...) \
@@ -1205,7 +1206,7 @@ again:break ;default :BADF ("Unimplemented phase %d\n" , s->sstat1 &PHASE_MASK ); -exit (1 ); +exit (EXIT_FAILURE ); } s->dfifo = s->dbc &0xff ; s->ctest5 = (s->ctest5 &0xfc ) | ((s->dbc >>8 ) &3 );
@@ -1276,7 +1277,7 @@ again: }if (insn & (1 <<9 )) {BADF ("Target mode not implemented\n" ); -exit (1 ); +exit (EXIT_FAILURE ); }if (insn & (1 <<10 )) s->carry =1 ;
hw/sd/ssi-sd.c +2 -1
@@ -23,7 +23,8 @@#define DPRINTF (fmt, ...) \ do { printf("ssi_sd: " fmt , ## __VA_ARGS__); } while (0)#define BADF (fmt, ...) \ -do { fprintf(stderr, "ssi_sd: error: " fmt , ## __VA_ARGS__); exit(1);} while (0) +do { fprintf(stderr, "ssi_sd: error: " fmt , ## __VA_ARGS__); \ + exit(EXIT_FAILURE); } while (0)#else #define DPRINTF (fmt, ...) do {} while(0)#define BADF (fmt, ...) \
Signature · 1 line
2.5.5
PATCH 23/26 core: use exit(EXIT_SUCCESS) and exit(EXIT_FAILURE)
In reply to Laurent VivierThis patch is the result of coccinelle scriptscripts/coccinelle/exit.cocci
--- hw/core/machine.c | 2 +- hw/core/platform-bus.c | 4 ++-- hw/core/qdev.c | 2 +- numa.c | 12 ++++++------ 4 files changed, 10 insertions(+), 10 deletions(-)
hw/core/machine.c +1 -1
@@ -336,7 +336,7 @@ static int error_on_sysbus_device(SysBusDevice *sbdev, void *opaque) {error_report ("Option '-device %s' cannot be handled by this machine" ,object_class_get_name (object_get_class (OBJECT (sbdev)))); -exit (1 ); +exit (EXIT_FAILURE ); }static void machine_init_notify (Notifier *notifier,void *data)
hw/core/platform-bus.c +2 -2
@@ -122,7 +122,7 @@ static void platform_bus_map_irq(PlatformBusDevice *pbus, SysBusDevice *sbdev, irqn =find_first_zero_bit (pbus->used_irqs, max_irqs);if (irqn >= max_irqs) {error_report ("Platform Bus: Can not fit IRQ line" ); -exit (1 ); +exit (EXIT_FAILURE ); }set_bit (irqn, pbus->used_irqs);
@@ -157,7 +157,7 @@ static void platform_bus_map_mmio(PlatformBusDevice *pbus, SysBusDevice *sbdev,if (!found_region) {error_report ("Platform Bus: Can not fit MMIO region of size %" PRIx64, size); -exit (1 ); +exit (EXIT_FAILURE ); }/* Map the device's region into our Platform Bus MMIO space */
hw/core/qdev.c +1 -1
@@ -359,7 +359,7 @@ void qdev_init_nofail(DeviceState *dev)if (err) {error_reportf_err (err,"Initialization of device %s failed: " ,object_get_typename (OBJECT (dev))); -exit (1 ); +exit (EXIT_FAILURE ); }object_unref (OBJECT (dev)); }
numa.c +6 -6
@@ -298,7 +298,7 @@ void parse_numa_opts(MachineClass *mc)int i;if (qemu_opts_foreach (qemu_find_opts ("numa" ), parse_numa,NULL ,NULL )) { -exit (1 ); +exit (EXIT_FAILURE ); }assert (max_numa_nodeid <=MAX_NODES );
@@ -308,7 +308,7 @@ void parse_numa_opts(MachineClass *mc)/* Report large node IDs first, to make mistakes easier to spot */ if (!numa_info[i].present) {error_report ("numa: Node ID missing: %d" , i); -exit (1 ); +exit (EXIT_FAILURE ); } }
@@ -352,7 +352,7 @@ void parse_numa_opts(MachineClass *mc)error_report ("total memory for NUMA nodes (0x%" PRIx64")" " should equal RAM size (0x" RAM_ADDR_FMT ")" , numa_total, ram_size); -exit (1 ); +exit (EXIT_FAILURE ); }for (i =0 ; i < nb_numa_nodes; i++) {
@@ -416,7 +416,7 @@ static void allocate_system_memory_nonnuma(MemoryRegion *mr, Object *owner,if (err) {error_report_err (err);if (mem_prealloc) { -exit (1 ); +exit (EXIT_FAILURE ); }/* Legacy behavior: if allocation failed, fall back to
@@ -426,7 +426,7 @@ static void allocate_system_memory_nonnuma(MemoryRegion *mr, Object *owner, }#else fprintf (stderr,"-mem-path not supported on this host\n" ); -exit (1 ); +exit (EXIT_FAILURE );#endif }else {memory_region_init_ram (mr, owner, name, ram_size, &error_fatal);
@@ -461,7 +461,7 @@ void memory_region_allocate_system_memory(MemoryRegion *mr, Object *owner,error_report ("memory backend %s is used multiple times. Each " "-numa option must use a different memdev value." , path); -exit (1 ); +exit (EXIT_FAILURE ); }host_memory_backend_set_mapped (backend, true);
Signature · 1 line
2.5.5
PATCH 24/26 error, trace: use exit(EXIT_SUCCESS) and exit(EXIT_FAILURE)
In reply to Laurent VivierThis patch is the result of coccinelle scriptscripts/coccinelle/exit.cocci
--- trace/control.c | 10 +++++----- util/error.c | 2 +- 2 files changed, 6 insertions(+), 6 deletions(-)
trace/control.c +5 -5
@@ -165,7 +165,7 @@ void trace_enable_events(const char *line_buf)if (is_help_option (line_buf)) {trace_list_events ();if (cur_mon ==NULL ) { -exit (0 ); +exit (EXIT_SUCCESS ); } }else {do_trace_enable_events (line_buf);
@@ -188,7 +188,7 @@ static void trace_init_events(const char *fname) fp =fopen (fname,"r" );if (!fp) {error_report ("%s" ,strerror (errno)); -exit (1 ); +exit (EXIT_FAILURE ); }while (fgets (line_buf,sizeof (line_buf), fp)) {loc_set_file (fname, ++line_idx);
@@ -204,7 +204,7 @@ static void trace_init_events(const char *fname)if (fclose (fp) !=0 ) {loc_set_file (fname,0 );error_report ("%s" ,strerror (errno)); -exit (1 ); +exit (EXIT_FAILURE ); }loc_pop (&loc); }
@@ -224,7 +224,7 @@ void trace_init_file(const char *file)if (file) {fprintf (stderr,"error: -trace file=...: " "option not supported by the selected tracing backends\n" ); -exit (1 ); +exit (EXIT_FAILURE ); }#endif }
@@ -258,7 +258,7 @@ char *trace_opt_parse(const char *optarg)QemuOpts *opts =qemu_opts_parse_noisily (qemu_find_opts ("trace" ), optarg, true);if (!opts) { -exit (1 ); +exit (EXIT_FAILURE ); }if (qemu_opt_get (opts,"enable" )) {trace_enable_events (qemu_opt_get (opts,"enable" ));
util/error.c +1 -1
@@ -39,7 +39,7 @@ static void error_handle_fatal(Error **errp, Error *err) }if (errp == &error_fatal) {error_report_err (err); -exit (1 ); +exit (EXIT_FAILURE ); } }
Signature · 1 line
2.5.5
Re: [Qemu-devel] [PATCH 24/26] error, trace: use exit(EXIT_SUCCESS) and exit(EXIT_FAILURE)
Quoted 9 lines · Laurent Vivier
This patch is the result of coccinelle script
scripts/coccinelle/exit.cocciSigned-off-by Laurent Vivier <[email protected]>CC Markus Armbruster <[email protected]>--- trace/control.c | 10 +++++----- util/error.c | 2 +- 2 files changed, 6 insertions(+), 6 deletions(-)
Matching comments in error.h should be changed by this patch.
Signature · 2 lines
Eric Blake eblake redhat com +1-919-301-3266 Libvirt virtualization library http://libvirt.org
PATCH 25/26 hw: use exit(EXIT_SUCCESS) and exit(EXIT_FAILURE)
In reply to Laurent VivierThis patch is the result of coccinelle scriptscripts/coccinelle/exit.cocci
--- hw/display/ssd0303.c | 3 ++- hw/i2c/smbus.c | 3 ++- hw/moxie/moxiesim.c | 8 ++++---- hw/nvram/eeprom93xx.c | 2 +- hw/nvram/fw_cfg.c | 2 +- 5 files changed, 10 insertions(+), 8 deletions(-)
hw/display/ssd0303.c +2 -1
@@ -20,7 +20,8 @@#define DPRINTF (fmt, ...) \ do { printf("ssd0303: " fmt , ## __VA_ARGS__); } while (0)#define BADF (fmt, ...) \ -do { fprintf(stderr, "ssd0303: error: " fmt , ## __VA_ARGS__); exit(1);} while (0) +do { fprintf(stderr, "ssd0303: error: " fmt , ## __VA_ARGS__); \ + exit(EXIT_FAILURE); } while (0)#else #define DPRINTF (fmt, ...) do {} while(0)#define BADF (fmt, ...) \
hw/i2c/smbus.c +2 -1
@@ -20,7 +20,8 @@#define DPRINTF (fmt, ...) \ do { printf("smbus(%02x): " fmt , dev->i2c.address, ## __VA_ARGS__); } while (0)#define BADF (fmt, ...) \ -do { fprintf(stderr, "smbus: error: " fmt , ## __VA_ARGS__); exit(1);} while (0) +do { fprintf(stderr, "smbus: error: " fmt , ## __VA_ARGS__); \ + exit(EXIT_FAILURE); } while (0)#else #define DPRINTF (fmt, ...) do {} while(0)#define BADF (fmt, ...) \
hw/moxie/moxiesim.c +4 -4
@@ -63,7 +63,7 @@ static void load_kernel(MoxieCPU *cpu, LoaderParams *loader_params)if (kernel_size <=0 ) {fprintf (stderr,"qemu: could not load kernel '%s'\n" , loader_params->kernel_filename); -exit (1 ); +exit (EXIT_FAILURE ); }/* load initrd */
@@ -78,7 +78,7 @@ static void load_kernel(MoxieCPU *cpu, LoaderParams *loader_params)fprintf (stderr,"qemu: memory too small for initial ram disk '%s'\n" , loader_params->initrd_filename); -exit (1 ); +exit (EXIT_FAILURE ); } initrd_size = load_image_targphys(loader_params->initrd_filename, initrd_offset,
@@ -87,7 +87,7 @@ static void load_kernel(MoxieCPU *cpu, LoaderParams *loader_params)if (initrd_size == (target_ulong)-1 ) {fprintf (stderr,"qemu: could not load initial ram disk '%s'\n" , loader_params->initrd_filename); -exit (1 ); +exit (EXIT_FAILURE ); } } }
@@ -121,7 +121,7 @@ static void moxiesim_init(MachineState *machine) cpu =cpu_moxie_init (cpu_model);if (!cpu) {fprintf (stderr,"Unable to find CPU definition\n" ); -exit (1 ); +exit (EXIT_FAILURE ); } env = &cpu->env;
hw/nvram/eeprom93xx.c +1 -1
@@ -105,7 +105,7 @@ static void put_unused(QEMUFile *f, void *pv, size_t size) {fprintf (stderr,"uint16_from_uint8 is used only for backwards compatibility.\n" );fprintf (stderr,"Never should be used to write a new state.\n" ); -exit (0 ); +exit (EXIT_SUCCESS ); }static const VMStateInfo vmstate_hack_uint16_from_uint8 = {
hw/nvram/fw_cfg.c +1 -1
@@ -807,7 +807,7 @@ void fw_cfg_add_file_callback(FWCfgState *s, const char *filename, strcmp(s->files->f[index].name, s->files->f[i].name) == 0) {error_report ("duplicate fw_cfg file name: %s" , s->files->f[index].name); -exit (1 ); +exit (EXIT_FAILURE ); } }
Signature · 1 line
2.5.5
PATCH 26/26 net: use exit(EXIT_SUCCESS) and exit(EXIT_FAILURE)
In reply to Laurent VivierThis patch is the result of coccinelle scriptscripts/coccinelle/exit.cocci
--- net/net.c | 4 ++-- slirp/misc.c | 2 +- 2 files changed, 3 insertions(+), 3 deletions(-)
net/net.c +2 -2
@@ -840,9 +840,9 @@ void qemu_check_nic_model(NICInfo *nd, const char *model) models[1 ] =NULL ;if (qemu_show_nic_models (nd->model, models)) -exit (0 ); +exit (EXIT_SUCCESS );if (qemu_find_nic_model (nd, models, model) <0 ) -exit (1 ); +exit (EXIT_FAILURE ); } int qemu_find_nic_model(NICInfo *nd, const char * const *models,
slirp/misc.c +1 -1
@@ -172,7 +172,7 @@ fork_exec(struct socket *so, const char *ex, int do_pty)fprintf (stderr,"Error: execvp of %s failed: %s\n" , argv[0 ],strerror (errno));close (0 );close (1 );close (2 );/* XXX */ -exit (1 ); +exit (EXIT_FAILURE );default :qemu_add_child_watch (pid);
Signature · 1 line
2.5.5
Your series seems to have some coding style problems. See output below for more information:
Hi,
Your series seems to have some coding style problems. See output below for more information:
Type: series
Message-id: [email protected]
Subject: [Qemu-devel] [PATCH 00/26] trivial: use exit(EXIT_SUCCESS) and exit(EXIT_FAILURE)
=== TEST SCRIPT BEGIN ===
#!/bin/bash
BASE=base
n=1
total=$(git log --oneline $BASE.. | wc -l)
failed=0
# Useful git options
git config --local diff.renamelimit 0
git config --local diff.renames True
commits="$(git log --format=%H --reverse $BASE..)" for c in $commits; do
echo "Checking PATCH $n/$total: $(git show --no-patch --format=%s $c)..."
if ! git show $c --format=email | ./scripts/checkpatch.pl --mailback -; then
failed=1
echo
fi
n=$((n+1))done
exit $failed
=== TEST SCRIPT END ===
Updating 3c8cf5a9c21ff8782164d1def7f44bd888713384
From https://github.com/patchew-project/qemu
* [new tag] patchew/[email protected] -> patchew/[email protected]
Switched to a new branch 'test'
3235810 net: use exit(EXIT_SUCCESS) and exit(EXIT_FAILURE) 135fd75 hw: use exit(EXIT_SUCCESS) and exit(EXIT_FAILURE) e7b6224 error, trace: use exit(EXIT_SUCCESS) and exit(EXIT_FAILURE) c137ac2 core: use exit(EXIT_SUCCESS) and exit(EXIT_FAILURE) 07288c1 blockdev: use exit(EXIT_SUCCESS) and exit(EXIT_FAILURE) 7b628d1 misc machine: use exit(EXIT_SUCCESS) and exit(EXIT_FAILURE) 6c4967c common: use exit(EXIT_SUCCESS) and exit(EXIT_FAILURE) 7b8ef6f alpha: use exit(EXIT_SUCCESS) and exit(EXIT_FAILURE) 84c70f3 posix: use exit(EXIT_SUCCESS) and exit(EXIT_FAILURE) c550aba tcg: use exit(EXIT_SUCCESS) and exit(EXIT_FAILURE) d2b8848 s390: use exit(EXIT_SUCCESS) and exit(EXIT_FAILURE) f98628c mips: use exit(EXIT_SUCCESS) and exit(EXIT_FAILURE) 2128499 x86: use exit(EXIT_SUCCESS) and exit(EXIT_FAILURE) ff054fd sh4: use exit(EXIT_SUCCESS) and exit(EXIT_FAILURE) 865df75 sparc: use exit(EXIT_SUCCESS) and exit(EXIT_FAILURE) c443546 pci, virtio: use exit(EXIT_SUCCESS) and exit(EXIT_FAILURE) 624a839 m68k: use exit(EXIT_SUCCESS) and exit(EXIT_FAILURE) d8e62e0 qemu-user: use exit(EXIT_SUCCESS) and exit(EXIT_FAILURE) a95c986 replay: use exit(EXIT_SUCCESS) and exit(EXIT_FAILURE) bc2fa7d tests: use exit(EXIT_SUCCESS) and exit(EXIT_FAILURE) 8ad5b66 graphics: use exit(EXIT_SUCCESS) and exit(EXIT_FAILURE) 086d557 ppc: use exit(EXIT_SUCCESS) and exit(EXIT_FAILURE) f456e5f block: use exit(EXIT_SUCCESS) and exit(EXIT_FAILURE) 2bc700c cris: use exit(EXIT_SUCCESS) and exit(EXIT_FAILURE) 5cacfb6 arm: use exit(EXIT_SUCCESS) and exit(EXIT_FAILURE) 566755c coccinelle: use exit(EXIT_SUCCESS) and exit(EXIT_FAILURE)
=== OUTPUT BEGIN ===
Checking PATCH 1/26: coccinelle: use exit(EXIT_SUCCESS) and exit(EXIT_FAILURE)... Checking PATCH 2/26: arm: use exit(EXIT_SUCCESS) and exit(EXIT_FAILURE)... Checking PATCH 3/26: cris: use exit(EXIT_SUCCESS) and exit(EXIT_FAILURE)...
ERROR: code indent should never use tabs
#64: FILE: tests/tcg/cris/check_glibc_kernelversion.c:115:
+^Iexit(EXIT_SUCCESS);$
ERROR: code indent should never use tabs
#86: FILE: tests/tcg/cris/check_lz.c:48:
+^Iexit(EXIT_SUCCESS);$
ERROR: code indent should never use tabs
#233: FILE: tests/tcg/cris/sys.c:15:
+^Iexit(EXIT_SUCCESS);$
total: 3 errors, 0 warnings, 133 lines checked
Your patch has style problems, please review. If any of these errors are false positives report them to the maintainer, see CHECKPATCH in MAINTAINERS.
Checking PATCH 4/26: block: use exit(EXIT_SUCCESS) and exit(EXIT_FAILURE)... Checking PATCH 5/26: ppc: use exit(EXIT_SUCCESS) and exit(EXIT_FAILURE)... Checking PATCH 6/26: graphics: use exit(EXIT_SUCCESS) and exit(EXIT_FAILURE)... Checking PATCH 7/26: tests: use exit(EXIT_SUCCESS) and exit(EXIT_FAILURE)... Checking PATCH 8/26: replay: use exit(EXIT_SUCCESS) and exit(EXIT_FAILURE)... Checking PATCH 9/26: qemu-user: use exit(EXIT_SUCCESS) and exit(EXIT_FAILURE)... Checking PATCH 10/26: m68k: use exit(EXIT_SUCCESS) and exit(EXIT_FAILURE)... Checking PATCH 11/26: pci, virtio: use exit(EXIT_SUCCESS) and exit(EXIT_FAILURE)... Checking PATCH 12/26: sparc: use exit(EXIT_SUCCESS) and exit(EXIT_FAILURE)... Checking PATCH 13/26: sh4: use exit(EXIT_SUCCESS) and exit(EXIT_FAILURE)... Checking PATCH 14/26: x86: use exit(EXIT_SUCCESS) and exit(EXIT_FAILURE)... Checking PATCH 15/26: mips: use exit(EXIT_SUCCESS) and exit(EXIT_FAILURE)... Checking PATCH 16/26: s390: use exit(EXIT_SUCCESS) and exit(EXIT_FAILURE)... Checking PATCH 17/26: tcg: use exit(EXIT_SUCCESS) and exit(EXIT_FAILURE)... Checking PATCH 18/26: posix: use exit(EXIT_SUCCESS) and exit(EXIT_FAILURE)... Checking PATCH 19/26: alpha: use exit(EXIT_SUCCESS) and exit(EXIT_FAILURE)... Checking PATCH 20/26: common: use exit(EXIT_SUCCESS) and exit(EXIT_FAILURE)... Checking PATCH 21/26: misc machine: use exit(EXIT_SUCCESS) and exit(EXIT_FAILURE)... Checking PATCH 22/26: blockdev: use exit(EXIT_SUCCESS) and exit(EXIT_FAILURE)... Checking PATCH 23/26: core: use exit(EXIT_SUCCESS) and exit(EXIT_FAILURE)... Checking PATCH 24/26: error, trace: use exit(EXIT_SUCCESS) and exit(EXIT_FAILURE)... Checking PATCH 25/26: hw: use exit(EXIT_SUCCESS) and exit(EXIT_FAILURE)... Checking PATCH 26/26: net: use exit(EXIT_SUCCESS) and exit(EXIT_FAILURE)... === OUTPUT END ===
Test command exited with code: 1
---
Email generated automatically by Patchew [http://patchew.org/].
Please send your feedback to [email protected]
Quoted 7 lines · Laurent Vivier
This series is the result of coccinelle patch
scripts/coccinelle/exit.cocci
provided by the first patch of the series.It replaces exit(0) by
exit(EXIT_SUCCESS)
and exit(1) byexit(EXIT_FAILURE).
Quoted 7 lines
All other
exit()are not modified as we don't want to change the behavior.In some cases, I've added manually a line break to comply with the maximum line length.
182 files changed, 734 insertions(+), 715 deletions(-)
You don't say why this is a useful change to make, and it's an awful lot of churn for a stylistic issue...
thanks
-- PMM
Quoted 11 lines · Peter Maydell
Quoted 10 lines · Laurent Vivier
This series is the result of coccinelle patch
scripts/coccinelle/exit.cocci
provided by the first patch of the series.It replaces exit(0) by
exit(EXIT_SUCCESS)
and exit(1) byexit(EXIT_FAILURE).All other
exit()are not modified as we don't want to change the behavior.
Quoted 7 lines
Quoted 4 lines
In some cases, I've added manually a line break to comply with the maximum line length.
182 files changed, 734 insertions(+), 715 deletions(-)You don't say why this is a useful change to make, and it's an awful lot of churn for a stylistic issue...
Currently QEMU uses a mix of at least
exit(EXIT_SUCCESS) exit(EXIT_FAILURE) exit(1) exit(-1) _exit(1) _exit(0);
so this series has the potential giving us more consistency style and behaviour, across our code. By not fixing the up the usage of -1, or fixing the _exit() usage, the series feels incomplete to me though.
Regards,
Daniel
Signature · 4 lines
|: http://berrange.com -o- http://www.flickr.com/photos/dberrange/ :| |: http://libvirt.org -o- http://virt-manager.org :| |: http://autobuild.org -o- http://search.cpan.org/~danberr/ :| |: http://entangle-photo.org -o- http://live.gnome.org/gtk-vnc :|
Quoted 29 lines · Daniel P. Berrange
Quoted 11 lines · Peter Maydell
Quoted 10 lines · Laurent Vivier
This series is the result of coccinelle patch
scripts/coccinelle/exit.cocci
provided by the first patch of the series.It replaces exit(0) by
exit(EXIT_SUCCESS)
and exit(1) byexit(EXIT_FAILURE).All other
exit()are not modified as we don't want to change the behavior.Quoted 7 lines
Quoted 4 lines
In some cases, I've added manually a line break to comply with the maximum line length.
182 files changed, 734 insertions(+), 715 deletions(-)You don't say why this is a useful change to make, and it's an awful lot of churn for a stylistic issue...
Currently QEMU uses a mix of at least
exit(EXIT_SUCCESS) exit(EXIT_FAILURE) exit(1) exit(-1) _exit(1) _exit(0);
Quoted 3 lines
so this series has the potential giving us more consistency style and behaviour, across our code. By not fixing the up the usage of -1, or fixing the
_exit()usage, the series feels incomplete to me though.
-1 is just a bug which we should fix (as Eric says). I don't see the point in converting all our 0s and 1s to EXIT_SUCCESS and EXIT_FAILURE though. (It would be less churn to convert the uses of EXIT_* to 0 and 1...)
thanks
-- PMM
Quoted 30 lines · Peter Maydell
Quoted 29 lines · Daniel P. Berrange
Quoted 11 lines · Peter Maydell
Quoted 10 lines · Laurent Vivier
This series is the result of coccinelle patch
scripts/coccinelle/exit.cocci
provided by the first patch of the series.It replaces exit(0) by
exit(EXIT_SUCCESS)
and exit(1) byexit(EXIT_FAILURE).All other
exit()are not modified as we don't want to change the behavior.Quoted 7 lines
Quoted 4 lines
In some cases, I've added manually a line break to comply with the maximum line length.
182 files changed, 734 insertions(+), 715 deletions(-)You don't say why this is a useful change to make, and it's an awful lot of churn for a stylistic issue...
Currently QEMU uses a mix of at least
exit(EXIT_SUCCESS) exit(EXIT_FAILURE) exit(1) exit(-1) _exit(1) _exit(0);
Quoted 8 lines
Quoted 3 lines
so this series has the potential giving us more consistency style and behaviour, across our code. By not fixing the up the usage of -1, or fixing the
_exit()usage, the series feels incomplete to me though.-1 is just a bug which we should fix (as Eric says). I don't see the point in converting all our 0s and 1s to
EXIT_SUCCESSandEXIT_FAILUREthough. (It would be less churn to convert the uses of EXIT_* to 0 and 1...)
Seconded.
Quoted 30 lines · Peter Maydell
Quoted 29 lines · Daniel P. Berrange
Quoted 11 lines · Peter Maydell
Quoted 10 lines · Laurent Vivier
This series is the result of coccinelle patch
scripts/coccinelle/exit.cocci
provided by the first patch of the series.It replaces exit(0) by
exit(EXIT_SUCCESS)
and exit(1) byexit(EXIT_FAILURE).All other
exit()are not modified as we don't want to change the behavior.Quoted 7 lines
Quoted 4 lines
In some cases, I've added manually a line break to comply with the maximum line length.
182 files changed, 734 insertions(+), 715 deletions(-)You don't say why this is a useful change to make, and it's an awful lot of churn for a stylistic issue...
Currently QEMU uses a mix of at least
exit(EXIT_SUCCESS) exit(EXIT_FAILURE) exit(1) exit(-1) _exit(1) _exit(0);
Quoted 8 lines
Quoted 3 lines
so this series has the potential giving us more consistency style and behaviour, across our code. By not fixing the up the usage of -1, or fixing the
_exit()usage, the series feels incomplete to me though.-1 is just a bug which we should fix (as Eric says). I don't see the point in converting all our 0s and 1s to
EXIT_SUCCESSandEXIT_FAILUREthough. (It would be less churn to convert the uses of EXIT_* to 0 and 1...)
Portability?
https://www.gnu.org/software/libc/manual/html_node/Exit-Status.html
-----------------------------------------------------------------------
Portability note: Some non-POSIX systems use different conventions for exit status values. For greater portability, you can use the macros EXIT_SUCCESS and EXIT_FAILURE for the conventional status value for success and failure, respectively. They are declared in the file stdlib.h.
Macro: int EXIT_SUCCESS
This macro can be used with the exit function to indicate successful program completion.
On POSIX systems, the value of this macro is 0. On other systems, the value might be some other (possibly non-constant) integer expression.
Macro: int EXIT_FAILURE
This macro can be used with the exit function to indicate unsuccessful program completion in a general sense.
On POSIX systems, the value of this macro is 1. On other systems, the value might be some other (possibly non-constant) integer expression. Other nonzero status values also indicate failures. Certain programs use different nonzero status values to indicate particular kinds of "non-success". For example, diff uses status value 1 to mean that the files are different, and 2 or more to mean that there was difficulty in opening the files.
-----------------------------------------------------------------------
What bothers me is some exit() use 0s and 1s, and some others EXIT_ macros. If you want to use 0s and 1s I have no problem with that, I have just to update the coccinelle script.
Laurent
Quoted 5 lines · Laurent Vivier
-----------------------------------------------------------------------
Portability note: Some non-POSIX systems use different conventions for exit status values. For greater portability, you can use the macrosEXIT_SUCCESSandEXIT_FAILUREfor the conventional status value for success and failure, respectively. They are declared in the filestdlib.h.
The only non-POSIX system we support is mingw32, which also uses 0/1 for its exit codes.
The POSIX rationale for exit() also notes that EXIT_SUCCESS is required to be 0.
Personally I think we should:
* definitely fix the "exit(-1)" and other exit-with-negative-number bugs in the codebase
* possibly add a checkpatch check for exit-with-negative-constant-arg
If we're going to do anything else then maybe we could change the EXIT_SUCCESS/EXIT_FAILURE instances in the codebase, but really I think there are more important inconsistencies to address (like all the unconverted non-QOM devices).
thanks
-- PMM
Quoted 30 lines · On Fri, 16 Sep 2016 16:45:06 +0100 Peter Maydell <[email protected]>…
Quoted 29 lines · Daniel P. Berrange
Quoted 11 lines · Peter Maydell
Quoted 10 lines · Laurent Vivier
This series is the result of coccinelle patch
scripts/coccinelle/exit.cocci
provided by the first patch of the series.It replaces exit(0) by
exit(EXIT_SUCCESS)
and exit(1) byexit(EXIT_FAILURE).All other
exit()are not modified as we don't want to change the behavior.Quoted 7 lines
Quoted 4 lines
In some cases, I've added manually a line break to comply with the maximum line length.
182 files changed, 734 insertions(+), 715 deletions(-)You don't say why this is a useful change to make, and it's an awful lot of churn for a stylistic issue...
Currently QEMU uses a mix of at least
exit(EXIT_SUCCESS) exit(EXIT_FAILURE) exit(1) exit(-1) _exit(1) _exit(0);
Quoted 8 lines
Quoted 3 lines
so this series has the potential giving us more consistency style and behaviour, across our code. By not fixing the up the usage of -1, or fixing the
_exit()usage, the series feels incomplete to me though.-1 is just a bug which we should fix (as Eric says). I don't see the point in converting all our 0s and 1s to
EXIT_SUCCESSandEXIT_FAILUREthough. (It would be less churn to convert the uses of EXIT_* to 0 and 1...)
Agreed.
If we want to make our exit handling more consistent, the first step would be to examine whether doing an exit() is the right thing to do in that code path at all. I'm currently aware at least of some exit()s in the virtio code that need to be converted to real error handling, and I'd not be surprised if similar things were true for other parts of the code.
Quoted 6 lines · Laurent Vivier
This series is the result of coccinelle patch
scripts/coccinelle/exit.cocci
provided by the first patch of the series.It replaces exit(0) by
exit(EXIT_SUCCESS)
and exit(1) byexit(EXIT_FAILURE).
Some places use '_exit' and should have had the same change applied AFAICT.
Quoted 2 lines
All other
exit()are not modified as we don't want to change the behavior.
IMHO, modifying the other exit() calls is precisely what would make this series useful.
eg there's a bunch of places which arbitrarily use '-1' instead of '1' as the value for no good reason.
Consolidating the inconsistent use of -1 and 1 would have functional benefit.
Regards,
Daniel
Signature · 4 lines
|: http://berrange.com -o- http://www.flickr.com/photos/dberrange/ :| |: http://libvirt.org -o- http://virt-manager.org :| |: http://autobuild.org -o- http://search.cpan.org/~danberr/ :| |: http://entangle-photo.org -o- http://live.gnome.org/gtk-vnc :|
Quoted 10 lines · Daniel P. Berrange
Quoted 6 lines · Laurent Vivier
This series is the result of coccinelle patch
scripts/coccinelle/exit.cocci
provided by the first patch of the series.It replaces exit(0) by
exit(EXIT_SUCCESS)
and exit(1) byexit(EXIT_FAILURE).Some places use '
_exit' and should have had the same change applied AFAICT.
And _Exit(), if we use it.
Quoted 9 lines
Quoted 3 lines
All other
exit()are not modified as we don't want to change the behavior.IMHO, modifying the other
exit()calls is precisely what would make this series useful.eg there's a bunch of places which arbitrarily use '-1' instead of '1' as the value for no good reason.
What's more, exit(-1) is awful to use; it results in an exit status of 255 due to truncation on Linux; and further has weird effects on xargs(1) (which special-cases a status of 255, differently than a status of 1).
Signature · 2 lines
Eric Blake eblake redhat com +1-919-301-3266 Libvirt virtualization library http://libvirt.org