various: Fix error-propagation with Coccinelle scripts
Subsystems (13)
v2 cover various: Fix error-propagation with Coccinelle scripts
This series is inspired of Peter Maydell fix [1]:
"hw/arm/xlnx-zynqmp.c: fix some error-handling code", but grew after v1 [2] review :/
Markus wanted the reviewed patches in 5.0 [3] but it is too late (and too big :p). Ideally I would have split it in 4 sub-series (roughly one with each cocci script) but since I won't have time to continue this (soon), I'm sending it altogether so interested can take/follow it.
If a particular patch is worth for 5.0, it can now be cherry-picked alone, with its cocci script for reference.
Markus: I added the cocci patches to your Error section, I hope that's fine :)
Regards,
Phil.
[1] https://www.mail-archive.com/[email protected]/msg691636.html
[2] https://www.mail-archive.com/[email protected]/msg692155.html
[3] https://www.mail-archive.com/[email protected]/msg694413.html
Supersedes: <[email protected]>
Philippe Mathieu-Daudé (54):
various: Remove suspicious '\' character outside of #define in C code scripts/coccinelle: Script to simplify DeviceClass error propagation hw/arm/allwinner-a10: Move some code from realize() to init() hw/arm/aspeed_ast2600: Simplify use of Error* hw/arm/aspeed_ast2600: Move some code from realize() to init() hw/arm/aspeed_soc: Move some code from realize() to init() hw/arm/aspeed_soc: Simplify use of Error*
hw/arm/fsl-imx6: Simplify checks on 'smp_cpus' count hw/arm/fsl-imx6: Move some code from realize() to init() hw/arm/fsl-imx31: Move some code from realize() to init() hw/arm/msf2-soc: Store MemoryRegion in MSF2State hw/arm/stm32f205_soc: Store MemoryRegion in STM32F205State hw/arm/stm32f205_soc: Move some code from realize() to init() hw/arm/xlnx-zynqmp: Use single propagate_error() call hw/arm/xlnx-zynqmp: Split xlnx_zynqmp_create_rpu() as init + realize hw/arm/xlnx-zynqmp: Move some code from realize() to init() hw/microblaze/xlnx-zynqmp-pmu: Move some code from realize() to init() hw/pci-host/pnv_phb3: Move some code from realize() to init() hw/riscv/sifive_e: Move some code from realize() to init() hw/riscv/sifive_u: Use single type_init() hw/riscv/sifive_u: Move some code from realize() to init() hw/riscv/sifive_u: Store MemoryRegion in SiFiveUSoCState hw/riscv/sifive_u: Move some code from realize() to init() hw/riscv/sifive_u: Rename MachineClass::init() scripts/coccinelle: Catch missing error_propagate() calls in realize() hw/arm/fsl-imx: Add missing error-propagation code hw/arm/stm32f*05_soc: Add missing error-propagation code hw/arm/aspeed: Add missing error-propagation code hw/arm/allwinner-a10: Add missing error-propagation code hw/arm/msf2-soc: Add missing error-propagation code hw/riscv/sifive: Add missing error-propagation code hw/arm/armv7m: Add missing error-propagation code hw/intc/arm_gicv3_its_kvm: Add missing error-propagation code hw/microblaze/xlnx-zynqmp-pmu: Add missing error-propagation code hw/pci-host/pnv_phb3: Add missing error-propagation code hw/block/onenand: Add missing error-propagation code scripts/coccinelle: Add script to catch missing error_propagate()
calls
hw/arm/bcm2835_peripherals: Add missing error-propagation code hw/arm/fsl-imx: Add missing error-propagation code hw/arm/stm32fx05_soc: Add missing error-propagation code hw/dma/xilinx_axidma: Add missing error-propagation code hw/i386/x86: Add missing error-propagation code hw/mips/cps: Add missing error-propagation code hw/misc/macio/macio: Add missing error-propagation code hw/net/xilinx_axienet: Add missing error-propagation code hw/riscv/sifive_u: Add missing error-propagation code hw/sd/milkymist-memcard: Add missing error-propagation code scripts/coccinelle: Use &error_abort in TypeInfo::instance_init()
various: Use &error_abort in instance_init() scripts/coccinelle: Find eventually missing error_propagate() calls migration/colo: Add missing error-propagation code hw/mips/boston: Add missing error-propagation code hw/mips/mips_malta: Add missing error-propagation code qga/commands-win32: Add missing error-propagation code
.../add-missing-error_propagate.cocci | 30 +++++ .../find-missing-error_propagate.cocci | 53 ++++++++ ...implify-init-realize-error_propagate.cocci | 69 ++++++++++ .../use-error_abort-in-instance_init.cocci | 52 ++++++++ .../use-error_propagate-in-realize.cocci | 54 ++++++++ include/hw/arm/msf2-soc.h | 4 + include/hw/arm/stm32f205_soc.h | 4 + include/hw/riscv/sifive_u.h | 2 + backends/cryptodev-vhost-user.c | 2 +- backends/rng-egd.c | 2 +- backends/rng-random.c | 2 +- backends/vhost-user.c | 3 +- block/replication.c | 4 +- block/vhdx.c | 8 +- dump/dump.c | 2 +- hw/arm/allwinner-a10.c | 44 +++--- hw/arm/armv7m.c | 12 +- hw/arm/aspeed_ast2600.c | 93 ++++++++----- hw/arm/aspeed_soc.c | 27 ++-- hw/arm/bcm2835_peripherals.c | 14 +- hw/arm/fsl-imx25.c | 14 +- hw/arm/fsl-imx31.c | 4 +- hw/arm/fsl-imx6.c | 81 ++++++----- hw/arm/msf2-soc.c | 42 +++--- hw/arm/stm32f205_soc.c | 38 +++--- hw/arm/stm32f405_soc.c | 10 +- hw/arm/vexpress.c | 8 +- hw/arm/xlnx-zcu102.c | 8 +- hw/arm/xlnx-zynqmp.c | 126 +++++++++--------- hw/block/fdc.c | 4 +- hw/block/onenand.c | 6 +- hw/block/vhost-user-blk.c | 2 +- hw/block/virtio-blk.c | 2 +- hw/core/machine.c | 6 +- hw/cpu/core.c | 4 +- hw/display/vga-pci.c | 7 +- hw/display/xlnx_dp.c | 4 +- hw/dma/sparc32_dma.c | 2 +- hw/dma/xilinx_axidma.c | 6 + hw/gpio/aspeed_gpio.c | 2 +- hw/i386/x86.c | 4 + hw/ide/macio.c | 4 +- hw/ide/qdev.c | 4 +- hw/intc/apic_common.c | 2 +- hw/intc/arm_gicv3_its_kvm.c | 6 +- hw/mem/nvdimm.c | 4 +- hw/microblaze/xlnx-zynqmp-pmu.c | 52 ++++---- hw/mips/boston.c | 17 +-- hw/mips/cps.c | 48 +++++++ hw/mips/mips_malta.c | 19 ++- hw/misc/aspeed_sdmc.c | 2 +- hw/misc/edu.c | 3 +- hw/misc/macio/macio.c | 8 +- hw/misc/macio/pmu.c | 3 +- hw/misc/pca9552.c | 2 +- hw/misc/tmp105.c | 2 +- hw/misc/tmp421.c | 8 +- hw/net/e1000.c | 3 +- hw/net/lance.c | 3 +- hw/net/lasi_i82596.c | 3 +- hw/net/ne2000-isa.c | 4 +- hw/net/spapr_llan.c | 2 +- hw/net/virtio-net.c | 4 +- hw/net/xilinx_axienet.c | 6 + hw/pci-host/grackle.c | 2 +- hw/pci-host/i440fx.c | 8 +- hw/pci-host/pnv_phb3.c | 32 +++-- hw/pci-host/prep.c | 2 +- hw/pci-host/q35.c | 23 ++-- hw/pci-host/sabre.c | 3 +- hw/pci-host/uninorth.c | 9 +- hw/pcmcia/pxa2xx.c | 3 +- hw/ppc/spapr_drc.c | 6 +- hw/ppc/spapr_rng.c | 2 +- hw/riscv/sifive_e.c | 32 +++-- hw/riscv/sifive_u.c | 102 ++++++++------ hw/s390x/event-facility.c | 6 +- hw/s390x/s390-ccw.c | 2 +- hw/s390x/s390-skeys.c | 4 +- hw/s390x/s390-stattrib.c | 4 +- hw/s390x/sclp.c | 2 +- hw/scsi/scsi-bus.c | 2 +- hw/scsi/scsi-disk.c | 2 +- hw/sd/milkymist-memcard.c | 4 + hw/sd/sdhci.c | 2 +- hw/ssi/xilinx_spips.c | 2 +- hw/usb/bus.c | 4 +- hw/usb/dev-network.c | 2 +- hw/usb/dev-storage.c | 4 +- hw/usb/host-libusb.c | 2 +- hw/usb/redirect.c | 2 +- hw/virtio/virtio-balloon.c | 4 +- migration/colo.c | 3 + net/dump.c | 4 +- net/filter-buffer.c | 2 +- net/filter-mirror.c | 10 +- net/filter-rewriter.c | 3 +- qga/commands-win32.c | 26 ++-- target/arm/cpu64.c | 4 +- target/i386/cpu.c | 41 +++--- target/microblaze/cpu.c | 14 +- target/ppc/translate_init.inc.c | 4 +- target/s390x/cpu.c | 3 +- tests/check-qom-proplist.c | 7 +- tests/test-qdev-global-props.c | 4 +- MAINTAINERS | 5 + 106 files changed, 1014 insertions(+), 458 deletions(-) create mode 100644 scripts/coccinelle/add-missing-error_propagate.cocci create mode 100644 scripts/coccinelle/find-missing-error_propagate.cocci create mode 100644 scripts/coccinelle/simplify-init-realize-error_propagate.= cocci create mode 100644 scripts/coccinelle/use-error_abort-in-instance_init.cocci create mode 100644 scripts/coccinelle/use-error_propagate-in-realize.cocci
--=20
2.21.1
PATCH v2 1/54 various: Remove suspicious '\' character outside of #define in C code
Fixes the following coccinelle warnings:
$ spatch --sp-file --verbose-parsing ... \
scripts/coccinelle/remove_local_err.cocci
...
SUSPICIOUS: a \ character appears outside of a #define at ./target/ppc/translate_init.inc.c:5213
SUSPICIOUS: a \ character appears outside of a #define at ./target/ppc/translate_init.inc.c:5261
SUSPICIOUS: a \ character appears outside of a #define at ./target/microblaze/cpu.c:166
SUSPICIOUS: a \ character appears outside of a #define at ./target/microblaze/cpu.c:167
SUSPICIOUS: a \ character appears outside of a #define at ./target/microblaze/cpu.c:169
SUSPICIOUS: a \ character appears outside of a #define at ./target/microblaze/cpu.c:170
SUSPICIOUS: a \ character appears outside of a #define at ./target/microblaze/cpu.c:171
SUSPICIOUS: a \ character appears outside of a #define at ./target/microblaze/cpu.c:172
SUSPICIOUS: a \ character appears outside of a #define at ./target/microblaze/cpu.c:173
SUSPICIOUS: a \ character appears outside of a #define at ./target/i386/cpu.c:5787
SUSPICIOUS: a \ character appears outside of a #define at ./target/i386/cpu.c:5789
SUSPICIOUS: a \ character appears outside of a #define at ./target/i386/cpu.c:5800
SUSPICIOUS: a \ character appears outside of a #define at ./target/i386/cpu.c:5801
SUSPICIOUS: a \ character appears outside of a #define at ./target/i386/cpu.c:5802
SUSPICIOUS: a \ character appears outside of a #define at ./target/i386/cpu.c:5804
SUSPICIOUS: a \ character appears outside of a #define at ./target/i386/cpu.c:5805
SUSPICIOUS: a \ character appears outside of a #define at ./target/i386/cpu.c:5806
SUSPICIOUS: a \ character appears outside of a #define at ./target/i386/cpu.c:6329
SUSPICIOUS: a \ character appears outside of a #define at ./hw/sd/sdhci.c:1133
SUSPICIOUS: a \ character appears outside of a #define at ./hw/scsi/scsi-disk.c:3081
SUSPICIOUS: a \ character appears outside of a #define at ./hw/net/virtio-net.c:1529
SUSPICIOUS: a \ character appears outside of a #define at ./hw/riscv/sifive_u.c:468
SUSPICIOUS: a \ character appears outside of a #define at ./dump/dump.c:1895
SUSPICIOUS: a \ character appears outside of a #define at ./block/vhdx.c:2209
SUSPICIOUS: a \ character appears outside of a #define at ./block/vhdx.c:2215
SUSPICIOUS: a \ character appears outside of a #define at ./block/vhdx.c:2221
SUSPICIOUS: a \ character appears outside of a #define at ./block/vhdx.c:2222
SUSPICIOUS: a \ character appears outside of a #define at ./block/replication.c:172
SUSPICIOUS: a \ character appears outside of a #define at ./block/replication.c:173--- block/replication.c | 4 ++-- block/vhdx.c | 8 ++++---- dump/dump.c | 2 +- hw/net/virtio-net.c | 2 +- hw/riscv/sifive_u.c | 2 +- hw/scsi/scsi-disk.c | 2 +- hw/sd/sdhci.c | 2 +- target/i386/cpu.c | 18 +++++++++--------- target/microblaze/cpu.c | 14 +++++++------- target/ppc/translate_init.inc.c | 4 ++-- 10 files changed, 29 insertions(+), 29 deletions(-)
block/replication.c +2 -2
@@ -169,8 +169,8 @@ static void replication_child_perm(BlockDriverState *bs, BdrvChild *c,if ((bs->open_flags & (BDRV_O_INACTIVE |BDRV_O_RDWR )) ==BDRV_O_RDWR ) { *nperm |=BLK_PERM_WRITE ; } - *nshared =BLK_PERM_CONSISTENT_READ \ - |BLK_PERM_WRITE \ + *nshared =BLK_PERM_CONSISTENT_READ + |BLK_PERM_WRITE |BLK_PERM_WRITE_UNCHANGED ;return ; }
block/vhdx.c +4 -4
@@ -2206,20 +2206,20 @@ static QemuOptsList vhdx_create_opts = { .name = VHDX_BLOCK_OPT_BLOCK_SIZE, .type = QEMU_OPT_SIZE, .def_value_str = stringify(0), - .help ="Block Size; min 1MB, max 256MB. " \ + .help ="Block Size; min 1MB, max 256MB. " "0 means auto-calculate based on image size." }, { .name = BLOCK_OPT_SUBFMT, .type = QEMU_OPT_STRING, - .help ="VHDX format type, can be either 'dynamic' or 'fixed'. " \ + .help ="VHDX format type, can be either 'dynamic' or 'fixed'. " "Default is 'dynamic'." }, { .name = VHDX_BLOCK_OPT_ZERO, .type = QEMU_OPT_BOOL, - .help ="Force use of payload blocks of type 'ZERO'. " \ -"Non-standard, but default. Do not set to 'off' when " \ + .help ="Force use of payload blocks of type 'ZERO'. " +"Non-standard, but default. Do not set to 'off' when " "using 'qemu-img convert' with subformat=dynamic." }, { NULL }
dump/dump.c +1 -1
@@ -1892,7 +1892,7 @@ static void dump_process(DumpState *s, Error **errp) result =qmp_query_dump (NULL );/* should never fail */ assert (result); -qapi_event_send_dump_completed (result, !!local_err, (local_err ? \ +qapi_event_send_dump_completed (result, !!local_err, (local_err ?error_get_pretty (local_err) :NULL ));qapi_free_DumpQueryResult (result);
hw/net/virtio-net.c +1 -1
@@ -1526,7 +1526,7 @@ static void virtio_net_rsc_extract_unit6(VirtioNetRscChain *chain, + sizeof(struct eth_header)); unit->ip = ip6; unit->ip_plen = &(ip6->ip6_ctlun.ip6_un1.ip6_un1_plen); - unit->tcp = (struct tcp_header *)(((uint8_t *)unit->ip)\ + unit->tcp = (struct tcp_header *)(((uint8_t *)unit->ip) +sizeof (struct ip6_header )); unit->tcp_hdrlen = (htons (unit->tcp->th_offset_flags) &0xF000 ) >>10 ;
hw/riscv/sifive_u.c +1 -1
@@ -465,7 +465,7 @@ static void riscv_sifive_u_machine_instance_init(Object *obj)object_property_add_bool (obj,"start-in-flash" , sifive_u_get_start_in_flash, sifive_u_set_start_in_flash,NULL );object_property_set_description (obj,"start-in-flash" , -"Set on to tell QEMU's ROM to jump to " \ +"Set on to tell QEMU's ROM to jump to " "flash. Otherwise QEMU will jump to DRAM" ,NULL ); }
hw/scsi/scsi-disk.c +1 -1
@@ -3078,7 +3078,7 @@ static const TypeInfo scsi_cd_info = {#ifdef __linux__static Property scsi_block_properties[] = { -DEFINE_BLOCK_ERROR_PROPERTIES (SCSIDiskState, qdev.conf), \ +DEFINE_BLOCK_ERROR_PROPERTIES (SCSIDiskState, qdev.conf),DEFINE_PROP_DRIVE ("drive" , SCSIDiskState, qdev.conf.blk),DEFINE_PROP_BOOL ("share-rw" , SCSIDiskState, qdev.conf.share_rw, false), DEFINE_PROP_UINT16("rotation_rate", SCSIDiskState, rotation_rate, 0),
hw/sd/sdhci.c +1 -1
@@ -1130,7 +1130,7 @@ sdhci_write(void *opaque, hwaddr offset, uint64_t val, unsigned size)/* Limit block size to the maximum buffer size */ if (extract32 (s->blksize,0 ,12 ) > s->buf_maxsz) { -qemu_log_mask (LOG_GUEST_ERROR ,"%s: Size 0x%x is larger than " \ +qemu_log_mask (LOG_GUEST_ERROR ,"%s: Size 0x%x is larger than " "the maximum buffer 0x%x" , __func__, s->blksize, s->buf_maxsz);
target/i386/cpu.c +9 -9
@@ -5784,9 +5784,9 @@ void cpu_x86_cpuid(CPUX86State *env, uint32_t index, uint32_t count,host_cpuid (index,0 , eax, ebx, ecx, edx);break ; } - *eax = (L1_DTLB_2M_ASSOC <<24 ) | (L1_DTLB_2M_ENTRIES <<16 ) | \ + *eax = (L1_DTLB_2M_ASSOC <<24 ) | (L1_DTLB_2M_ENTRIES <<16 ) | (L1_ITLB_2M_ASSOC <<8 ) | (L1_ITLB_2M_ENTRIES ); - *ebx = (L1_DTLB_4K_ASSOC <<24 ) | (L1_DTLB_4K_ENTRIES <<16 ) | \ + *ebx = (L1_DTLB_4K_ASSOC <<24 ) | (L1_DTLB_4K_ENTRIES <<16 ) | (L1_ITLB_4K_ASSOC <<8 ) | (L1_ITLB_4K_ENTRIES ); *ecx =encode_cache_cpuid80000005 (env->cache_info_amd.l1d_cache); *edx =encode_cache_cpuid80000005 (env->cache_info_amd.l1i_cache);
@@ -5797,13 +5797,13 @@ void cpu_x86_cpuid(CPUX86State *env, uint32_t index, uint32_t count,host_cpuid (index,0 , eax, ebx, ecx, edx);break ; } - *eax = (AMD_ENC_ASSOC (L2_DTLB_2M_ASSOC ) <<28 ) | \ - (L2_DTLB_2M_ENTRIES <<16 ) | \ - (AMD_ENC_ASSOC (L2_ITLB_2M_ASSOC ) <<12 ) | \ + *eax = (AMD_ENC_ASSOC (L2_DTLB_2M_ASSOC ) <<28 ) | + (L2_DTLB_2M_ENTRIES <<16 ) | + (AMD_ENC_ASSOC (L2_ITLB_2M_ASSOC ) <<12 ) | (L2_ITLB_2M_ENTRIES ); - *ebx = (AMD_ENC_ASSOC (L2_DTLB_4K_ASSOC ) <<28 ) | \ - (L2_DTLB_4K_ENTRIES <<16 ) | \ - (AMD_ENC_ASSOC (L2_ITLB_4K_ASSOC ) <<12 ) | \ + *ebx = (AMD_ENC_ASSOC (L2_DTLB_4K_ASSOC ) <<28 ) | + (L2_DTLB_4K_ENTRIES <<16 ) | + (AMD_ENC_ASSOC (L2_ITLB_4K_ASSOC ) <<12 ) | (L2_ITLB_4K_ENTRIES ); encode_cache_cpuid80000006(env->cache_info_amd.l2_cache, cpu->enable_l3_cache ?
@@ -6326,7 +6326,7 @@ static void x86_cpu_expand_features(X86CPU *cpu, Error **errp)*/ env->features[w] |=x86_cpu_get_supported_feature_word (w, cpu->migratable) & - ~env->user_features[w] & \ + ~env->user_features[w] & ~feature_word_info[w].no_autoenable_flags; } }
target/microblaze/cpu.c +7 -7
@@ -163,14 +163,14 @@ static void mb_cpu_realizefn(DeviceState *dev, Error **errp)qemu_init_vcpu (cs); - env->pvr.regs[0 ] =PVR0_USE_EXC_MASK \ - |PVR0_USE_ICACHE_MASK \ + env->pvr.regs[0 ] =PVR0_USE_EXC_MASK + |PVR0_USE_ICACHE_MASK |PVR0_USE_DCACHE_MASK ; - env->pvr.regs[2 ] =PVR2_D_OPB_MASK \ - |PVR2_D_LMB_MASK \ - |PVR2_I_OPB_MASK \ - |PVR2_I_LMB_MASK \ - |PVR2_FPU_EXC_MASK \ + env->pvr.regs[2 ] =PVR2_D_OPB_MASK + |PVR2_D_LMB_MASK + |PVR2_I_OPB_MASK + |PVR2_I_LMB_MASK + |PVR2_FPU_EXC_MASK |0 ; version = cpu->cfg.version ? cpu->cfg.version :DEFAULT_CPU_VERSION ;
target/ppc/translate_init.inc.c +2 -2
@@ -5210,7 +5210,7 @@ POWERPC_FAMILY(e5500)(ObjectClass *oc, void *data)PPC_FLOAT_STFIWX |PPC_WAIT |PPC_MEM_TLBSYNC |PPC_TLBIVAX |PPC_MEM_SYNC |PPC_64B |PPC_POPCNTB |PPC_POPCNTWD ; - pcc->insns_flags2 =PPC2_BOOKE206 |PPC2_PRCNTL |PPC2_PERM_ISA206 | \ + pcc->insns_flags2 =PPC2_BOOKE206 |PPC2_PRCNTL |PPC2_PERM_ISA206 |PPC2_FP_CVT_S64 ; pcc->msr_mask = (1ull <<MSR_CM ) | (1ull << MSR_GS) |
@@ -5258,7 +5258,7 @@ POWERPC_FAMILY(e6500)(ObjectClass *oc, void *data)PPC_FLOAT_STFIWX |PPC_WAIT |PPC_MEM_TLBSYNC |PPC_TLBIVAX |PPC_MEM_SYNC |PPC_64B |PPC_POPCNTB |PPC_POPCNTWD |PPC_ALTIVEC ; - pcc->insns_flags2 =PPC2_BOOKE206 |PPC2_PRCNTL |PPC2_PERM_ISA206 | \ + pcc->insns_flags2 =PPC2_BOOKE206 |PPC2_PRCNTL |PPC2_PERM_ISA206 |PPC2_FP_CVT_S64 |PPC2_ATOMIC_ISA206 ; pcc->msr_mask = (1ull <<MSR_CM ) | (1ull << MSR_GS) |
Signature · 1 line
2.21.1
Re: [PATCH-for-5.1 v2 01/54] various: Remove suspicious '\' character outside of #define in C code
Hi
Quoted 253 lines · Philippe Mathieu-Daudé
Fixes the following coccinelle warnings:
$ spatch --sp-file --verbose-parsing ... \ scripts/coccinelle/remove_local_err.cocci ... SUSPICIOUS: a \ character appears outside of a #define at ./target/ppc/translate_init.inc.c:5213 SUSPICIOUS: a \ character appears outside of a #define at ./target/ppc/translate_init.inc.c:5261 SUSPICIOUS: a \ character appears outside of a #define at ./target/microblaze/cpu.c:166 SUSPICIOUS: a \ character appears outside of a #define at ./target/microblaze/cpu.c:167 SUSPICIOUS: a \ character appears outside of a #define at ./target/microblaze/cpu.c:169 SUSPICIOUS: a \ character appears outside of a #define at ./target/microblaze/cpu.c:170 SUSPICIOUS: a \ character appears outside of a #define at ./target/microblaze/cpu.c:171 SUSPICIOUS: a \ character appears outside of a #define at ./target/microblaze/cpu.c:172 SUSPICIOUS: a \ character appears outside of a #define at ./target/microblaze/cpu.c:173 SUSPICIOUS: a \ character appears outside of a #define at ./target/i386/cpu.c:5787 SUSPICIOUS: a \ character appears outside of a #define at ./target/i386/cpu.c:5789 SUSPICIOUS: a \ character appears outside of a #define at ./target/i386/cpu.c:5800 SUSPICIOUS: a \ character appears outside of a #define at ./target/i386/cpu.c:5801 SUSPICIOUS: a \ character appears outside of a #define at ./target/i386/cpu.c:5802 SUSPICIOUS: a \ character appears outside of a #define at ./target/i386/cpu.c:5804 SUSPICIOUS: a \ character appears outside of a #define at ./target/i386/cpu.c:5805 SUSPICIOUS: a \ character appears outside of a #define at ./target/i386/cpu.c:5806 SUSPICIOUS: a \ character appears outside of a #define at ./target/i386/cpu.c:6329 SUSPICIOUS: a \ character appears outside of a #define at ./hw/sd/sdhci.c:1133 SUSPICIOUS: a \ character appears outside of a #define at ./hw/scsi/scsi-disk.c:3081 SUSPICIOUS: a \ character appears outside of a #define at ./hw/net/virtio-net.c:1529 SUSPICIOUS: a \ character appears outside of a #define at ./hw/riscv/sifive_u.c:468 SUSPICIOUS: a \ character appears outside of a #define at ./dump/dump.c:1895 SUSPICIOUS: a \ character appears outside of a #define at ./block/vhdx.c:2209 SUSPICIOUS: a \ character appears outside of a #define at ./block/vhdx.c:2215 SUSPICIOUS: a \ character appears outside of a #define at ./block/vhdx.c:2221 SUSPICIOUS: a \ character appears outside of a #define at ./block/vhdx.c:2222 SUSPICIOUS: a \ character appears outside of a #define at ./block/replication.c:172 SUSPICIOUS: a \ character appears outside of a #define at ./block/replication.c:173Signed-off-by Philippe Mathieu-Daudé <[email protected]>--- block/replication.c | 4 ++-- block/vhdx.c | 8 ++++---- dump/dump.c | 2 +- hw/net/virtio-net.c | 2 +- hw/riscv/sifive_u.c | 2 +- hw/scsi/scsi-disk.c | 2 +- hw/sd/sdhci.c | 2 +- target/i386/cpu.c | 18 +++++++++--------- target/microblaze/cpu.c | 14 +++++++------- target/ppc/translate_init.inc.c | 4 ++-- 10 files changed, 29 insertions(+), 29 deletions(-)block/replication.c +2
-2@@ -169,8 +169,8 @@ static void replication_child_perm(BlockDriverState *bs, BdrvChild *c,if ((bs->open_flags & (BDRV_O_INACTIVE |BDRV_O_RDWR )) ==BDRV_O_RDWR ) { *nperm |=BLK_PERM_WRITE ; } - *nshared =BLK_PERM_CONSISTENT_READ \ - |BLK_PERM_WRITE \ + *nshared =BLK_PERM_CONSISTENT_READ + |BLK_PERM_WRITE |BLK_PERM_WRITE_UNCHANGED ;return ; }block/vhdx.c +4
-4@@ -2206,20 +2206,20 @@ static QemuOptsList vhdx_create_opts = { .name = VHDX_BLOCK_OPT_BLOCK_SIZE, .type = QEMU_OPT_SIZE, .def_value_str = stringify(0), - .help ="Block Size; min 1MB, max 256MB. " \ + .help ="Block Size; min 1MB, max 256MB. " "0 means auto-calculate based on image size." }, { .name = BLOCK_OPT_SUBFMT, .type = QEMU_OPT_STRING, - .help ="VHDX format type, can be either 'dynamic' or 'fixed'. " \ + .help ="VHDX format type, can be either 'dynamic' or 'fixed'. " "Default is 'dynamic'." }, { .name = VHDX_BLOCK_OPT_ZERO, .type = QEMU_OPT_BOOL, - .help ="Force use of payload blocks of type 'ZERO'. " \ -"Non-standard, but default. Do not set to 'off' when " \ + .help ="Force use of payload blocks of type 'ZERO'. " +"Non-standard, but default. Do not set to 'off' when " "using 'qemu-img convert' with subformat=dynamic." }, { NULL }dump/dump.c +1
-1@@ -1892,7 +1892,7 @@ static void dump_process(DumpState *s, Error **errp) result =qmp_query_dump (NULL );/* should never fail */ assert (result); -qapi_event_send_dump_completed (result, !!local_err, (local_err ? \ +qapi_event_send_dump_completed (result, !!local_err, (local_err ?error_get_pretty (local_err) :NULL ));qapi_free_DumpQueryResult (result);hw/net/virtio-net.c +1
-1@@ -1526,7 +1526,7 @@ static void virtio_net_rsc_extract_unit6(VirtioNetRscChain *chain, + sizeof(struct eth_header)); unit->ip = ip6; unit->ip_plen = &(ip6->ip6_ctlun.ip6_un1.ip6_un1_plen); - unit->tcp = (struct tcp_header *)(((uint8_t *)unit->ip)\ + unit->tcp = (struct tcp_header *)(((uint8_t *)unit->ip) +sizeof (struct ip6_header )); unit->tcp_hdrlen = (htons (unit->tcp->th_offset_flags) &0xF000 ) >>10 ;hw/riscv/sifive_u.c +1
-1@@ -465,7 +465,7 @@ static void riscv_sifive_u_machine_instance_init(Object *obj)object_property_add_bool (obj,"start-in-flash" , sifive_u_get_start_in_flash, sifive_u_set_start_in_flash,NULL );object_property_set_description (obj,"start-in-flash" , -"Set on to tell QEMU's ROM to jump to " \ +"Set on to tell QEMU's ROM to jump to " "flash. Otherwise QEMU will jump to DRAM" ,NULL ); }hw/scsi/scsi-disk.c +1
-1@@ -3078,7 +3078,7 @@ static const TypeInfo scsi_cd_info = {#ifdef __linux__static Property scsi_block_properties[] = { -DEFINE_BLOCK_ERROR_PROPERTIES (SCSIDiskState, qdev.conf), \ +DEFINE_BLOCK_ERROR_PROPERTIES (SCSIDiskState, qdev.conf),DEFINE_PROP_DRIVE ("drive" , SCSIDiskState, qdev.conf.blk),DEFINE_PROP_BOOL ("share-rw" , SCSIDiskState, qdev.conf.share_rw, false), DEFINE_PROP_UINT16("rotation_rate", SCSIDiskState, rotation_rate, 0),hw/sd/sdhci.c +1
-1@@ -1130,7 +1130,7 @@ sdhci_write(void *opaque, hwaddr offset, uint64_t val, unsigned size)/* Limit block size to the maximum buffer size */ if (extract32 (s->blksize,0 ,12 ) > s->buf_maxsz) { -qemu_log_mask (LOG_GUEST_ERROR ,"%s: Size 0x%x is larger than " \ +qemu_log_mask (LOG_GUEST_ERROR ,"%s: Size 0x%x is larger than " "the maximum buffer 0x%x" , __func__, s->blksize, s->buf_maxsz);target/i386/cpu.c +9
-9@@ -5784,9 +5784,9 @@ void cpu_x86_cpuid(CPUX86State *env, uint32_t index, uint32_t count,host_cpuid (index,0 , eax, ebx, ecx, edx);break ; } - *eax = (L1_DTLB_2M_ASSOC <<24 ) | (L1_DTLB_2M_ENTRIES <<16 ) | \ + *eax = (L1_DTLB_2M_ASSOC <<24 ) | (L1_DTLB_2M_ENTRIES <<16 ) | (L1_ITLB_2M_ASSOC <<8 ) | (L1_ITLB_2M_ENTRIES ); - *ebx = (L1_DTLB_4K_ASSOC <<24 ) | (L1_DTLB_4K_ENTRIES <<16 ) | \ + *ebx = (L1_DTLB_4K_ASSOC <<24 ) | (L1_DTLB_4K_ENTRIES <<16 ) | (L1_ITLB_4K_ASSOC <<8 ) | (L1_ITLB_4K_ENTRIES ); *ecx =encode_cache_cpuid80000005 (env->cache_info_amd.l1d_cache); *edx =encode_cache_cpuid80000005 (env->cache_info_amd.l1i_cache);@@ -5797,13 +5797,13 @@ void cpu_x86_cpuid(CPUX86State *env, uint32_t index, uint32_t count,host_cpuid (index,0 , eax, ebx, ecx, edx);break ; } - *eax = (AMD_ENC_ASSOC (L2_DTLB_2M_ASSOC ) <<28 ) | \ - (L2_DTLB_2M_ENTRIES <<16 ) | \ - (AMD_ENC_ASSOC (L2_ITLB_2M_ASSOC ) <<12 ) | \ + *eax = (AMD_ENC_ASSOC (L2_DTLB_2M_ASSOC ) <<28 ) | + (L2_DTLB_2M_ENTRIES <<16 ) | + (AMD_ENC_ASSOC (L2_ITLB_2M_ASSOC ) <<12 ) | (L2_ITLB_2M_ENTRIES ); - *ebx = (AMD_ENC_ASSOC (L2_DTLB_4K_ASSOC ) <<28 ) | \ - (L2_DTLB_4K_ENTRIES <<16 ) | \ - (AMD_ENC_ASSOC (L2_ITLB_4K_ASSOC ) <<12 ) | \ + *ebx = (AMD_ENC_ASSOC (L2_DTLB_4K_ASSOC ) <<28 ) | + (L2_DTLB_4K_ENTRIES <<16 ) | + (AMD_ENC_ASSOC (L2_ITLB_4K_ASSOC ) <<12 ) | (L2_ITLB_4K_ENTRIES ); encode_cache_cpuid80000006(env->cache_info_amd.l2_cache, cpu->enable_l3_cache ?@@ -6326,7 +6326,7 @@ static void x86_cpu_expand_features(X86CPU *cpu, Error **errp)*/ env->features[w] |=x86_cpu_get_supported_feature_word (w, cpu->migratable) & - ~env->user_features[w] & \ + ~env->user_features[w] & ~feature_word_info[w].no_autoenable_flags; } }target/microblaze/cpu.c +7
-7@@ -163,14 +163,14 @@ static void mb_cpu_realizefn(DeviceState *dev, Error **errp)qemu_init_vcpu (cs); - env->pvr.regs[0 ] =PVR0_USE_EXC_MASK \ - |PVR0_USE_ICACHE_MASK \ + env->pvr.regs[0 ] =PVR0_USE_EXC_MASK + |PVR0_USE_ICACHE_MASK |PVR0_USE_DCACHE_MASK ; - env->pvr.regs[2 ] =PVR2_D_OPB_MASK \ - |PVR2_D_LMB_MASK \ - |PVR2_I_OPB_MASK \ - |PVR2_I_LMB_MASK \ - |PVR2_FPU_EXC_MASK \ + env->pvr.regs[2 ] =PVR2_D_OPB_MASK + |PVR2_D_LMB_MASK + |PVR2_I_OPB_MASK + |PVR2_I_LMB_MASK + |PVR2_FPU_EXC_MASK |0 ; version = cpu->cfg.version ? cpu->cfg.version :DEFAULT_CPU_VERSION ;target/ppc/translate_init.inc.c +2
-3@@ -5210,7 +5210,7 @@ POWERPC_FAMILY(e5500)(ObjectClass *oc, void *data)PPC_FLOAT_STFIWX |PPC_WAIT |PPC_MEM_TLBSYNC |PPC_TLBIVAX |PPC_MEM_SYNC |PPC_64B |PPC_POPCNTB |PPC_POPCNTWD ; - pcc->insns_flags2 =PPC2_BOOKE206 |PPC2_PRCNTL |PPC2_PERM_ISA206 | \ + pcc->insns_flags2 =PPC2_BOOKE206 |PPC2_PRCNTL |PPC2_PERM_ISA206 |PPC2_FP_CVT_S64 ; pcc->msr_mask = (1ull <<MSR_CM ) | (1ull << MSR_GS) |@@ -5258,7 +5258,7 @@ POWERPC_FAMILY(e6500)(ObjectClass *oc, void *data)PPC_FLOAT_STFIWX |PPC_WAIT |PPC_MEM_TLBSYNC |PPC_TLBIVAX |PPC_MEM_SYNC |PPC_64B |PPC_POPCNTB |PPC_POPCNTWD |PPC_ALTIVEC ; - pcc->insns_flags2 =PPC2_BOOKE206 |PPC2_PRCNTL |PPC2_PERM_ISA206 | \ + pcc->insns_flags2 =PPC2_BOOKE206 |PPC2_PRCNTL |PPC2_PERM_ISA206 |PPC2_FP_CVT_S64 |PPC2_ATOMIC_ISA206 ; pcc->msr_mask = (1ull <<MSR_CM ) | (1ull << MSR_GS) | --
Quoted 2 lines
2.21.1
PATCH v2 2/54 scripts/coccinelle: Script to simplify DeviceClass error propagation
In reply to Philippe Mathieu-DaudéWhen a device uses an Error* with data not modified before realize(), this call can be moved to init(). Add a Coccinelle patch to find such uses.
--- ...implify-init-realize-error_propagate.cocci | 69 +++++++++++++++++++ MAINTAINERS | 1 + 2 files changed, 70 insertions(+) create mode 100644 scripts/coccinelle/simplify-init-realize-error_propagate.cocci
scripts/coccinelle/simplify-init-realize-error_propagate.cocci new file +69 -0
@@ -0,0 +1,69 @@ +// Find error-propagation calls that don't need to be in DeviceClass::realize() +// because they don't use information user can change before calling realize(), +// so they can be moved to DeviceClass:initfn() where error propagation is not +// needed. +// +// Copyright: (C) 2020 Philippe Mathieu-Daudé +// This work is licensed under the terms of the GNU GPLv2 or later. +// +// spatch \ +// --macro-file scripts/cocci-macro-file.h \ +// --sp-file \ +// scripts/coccinelle/simplify-init-realize-error_propagate.cocci \ +// --timeout 60 +// +// Inspired by https://www.mail-archive.com/[email protected]/msg692500.html + + +@ match_class_init @ +TypeInfo info; +identifier class_initfn; +@@ + info.class_init = class_initfn; + + +@ match_instance_init @ +TypeInfo info; +identifier instance_initfn; +@@ + info.instance_init = instance_initfn; + + +@ match_realize @ +identifier match_class_init.class_initfn; +DeviceClass *dc; +identifier realizefn; +@@ +void class_initfn(...) +{ + ... + dc->realize = realizefn; + ... +} + + +@ propagate_in_realize @ +identifier match_realize.realizefn; +identifier err; +identifier errp; +identifier func_with_errp =~ "(?!object_property_set_link)"; +symbol error_abort, error_fatal; +position pos; +@@ +void realizefn@pos(..., Error **errp) +{ + ... + Error *err = NULL; + <+... + func_with_errp(..., \(&error_abort\|&error_fatal\)); + ...+> +} + + +@ script:python @ +initfn << match_instance_init.instance_initfn; +realizefn << match_realize.realizefn; +p << propagate_in_realize.pos; +@@ +print('>>> possible moves from {}() to {}() in {}:{}' + .format(initfn, realizefn, p[0].file, p[0].line))
MAINTAINERS +1 -0
@@ -2057,6 +2057,7 @@ F: scripts/coccinelle/err-bad-newline.cocci F: scripts/coccinelle/error-use-after-free.cocci F: scripts/coccinelle/error_propagate_null.cocci F: scripts/coccinelle/remove_local_err.cocci +F: scripts/coccinelle/simplify-init-realize-error_propagate.cocci F: scripts/coccinelle/use-error_fatal.cocci GDB stub
Signature · 1 line
2.21.1
PATCH v2 3/54 hw/arm/allwinner-a10: Move some code from realize() to init()
In reply to Philippe Mathieu-DaudéCoccinelle reported:
$ spatch ... --timeout 60 --sp-file \
scripts/coccinelle/simplify-init-realize-error_propagate.cocci
HANDLING: ./hw/arm/allwinner-a10.cQuoted 1 line
Quoted 1 line
Quoted 1 line
possible moves from
aw_a10_init()toaw_a10_realize()in./hw/arm/allwinner-a10.c:77
Move the calls using &error_fatal which don't depend of input updated before realize() to init().
--- hw/arm/allwinner-a10.c | 26 +++++++++++++------------- 1 file changed, 13 insertions(+), 13 deletions(-)
hw/arm/allwinner-a10.c +13 -13
@@ -60,10 +60,18 @@ static void aw_a10_init(Object *obj)int i;for (i =0 ; i <AW_A10_NUM_USB ; i++) { +char bus[16 ]; +sysbus_init_child_obj (obj,"ehci[*]" ,OBJECT (&s->ehci[i]),sizeof (s->ehci[i]),TYPE_PLATFORM_EHCI );sysbus_init_child_obj (obj,"ohci[*]" ,OBJECT (&s->ohci[i]),sizeof (s->ohci[i]),TYPE_SYSBUS_OHCI ); +object_property_set_bool (OBJECT (&s->ehci[i]), true, +"companion-enable" , &error_fatal); + +sprintf (bus,"usb-bus.%d" , i); +object_property_set_str (OBJECT (&s->ohci[i]), bus,"masterbus" , + &error_fatal); } }
@@ -72,6 +80,11 @@ static void aw_a10_init(Object *obj)sysbus_init_child_obj (obj,"rtc" , &s->rtc,sizeof (s->rtc),TYPE_AW_RTC_SUN4I ); + +memory_region_init_ram (&s->sram_a, obj,"sram A" ,48 * KiB, + &error_fatal); +memory_region_add_subregion (get_system_memory (),0x00000000 , &s->sram_a); +create_unimplemented_device ("a10-sram-ctrl" ,0x01c00000 ,4 * KiB); }static void aw_a10_realize (DeviceState *dev,Error **errp)
@@ -113,11 +126,6 @@ static void aw_a10_realize(DeviceState *dev, Error **errp)sysbus_connect_irq (sysbusdev,4 ,qdev_get_gpio_in (dev,67 ));sysbus_connect_irq (sysbusdev,5 ,qdev_get_gpio_in (dev,68 )); -memory_region_init_ram (&s->sram_a,OBJECT (dev),"sram A" ,48 * KiB, - &error_fatal); -memory_region_add_subregion (get_system_memory (),0x00000000 , &s->sram_a); -create_unimplemented_device ("a10-sram-ctrl" ,0x01c00000 ,4 * KiB); -/* FIXME use qdev NIC properties instead of nd_table[] */ if (nd_table[0 ].used) {qemu_check_nic_model (&nd_table[0 ],TYPE_AW_EMAC );
@@ -149,12 +157,6 @@ static void aw_a10_realize(DeviceState *dev, Error **errp)int i;for (i =0 ; i <AW_A10_NUM_USB ; i++) { -char bus[16 ]; - -sprintf (bus,"usb-bus.%d" , i); - -object_property_set_bool (OBJECT (&s->ehci[i]), true, -"companion-enable" , &error_fatal);object_property_set_bool (OBJECT (&s->ehci[i]), true,"realized" , &error_fatal); sysbus_mmio_map(SYS_BUS_DEVICE(&s->ehci[i]), 0,
@@ -162,8 +164,6 @@ static void aw_a10_realize(DeviceState *dev, Error **errp)sysbus_connect_irq (SYS_BUS_DEVICE (&s->ehci[i]),0 ,qdev_get_gpio_in (dev,39 + i)); -object_property_set_str (OBJECT (&s->ohci[i]), bus,"masterbus" , - &error_fatal);object_property_set_bool (OBJECT (&s->ohci[i]), true,"realized" , &error_fatal); sysbus_mmio_map(SYS_BUS_DEVICE(&s->ohci[i]), 0,
Signature · 1 line
2.21.1
Re: [PATCH-for-5.1 v2 03/54] hw/arm/allwinner-a10: Move some code from realize() to init()
Quoted 8 lines · Philippe Mathieu-Daudé
Coccinelle reported:
$ spatch ... --timeout 60 --sp-file \ scripts/coccinelle/simplify-init-realize-error_propagate.cocci HANDLING: ./hw/arm/allwinner-a10.cQuoted 1 line
Quoted 1 line
Quoted 1 line
possible moves from
aw_a10_init()toaw_a10_realize()in./hw/arm/allwinner-a10.c:77Move the calls using
&error_fatalwhich don't depend of input
s/of/on/ (here, and in many subsequent messages in the series)
Quoted 7 lines
updated before
realize()toinit().Signed-off-by Philippe Mathieu-Daudé <[email protected]>--- hw/arm/allwinner-a10.c | 26 +++++++++++++------------- 1 file changed, 13 insertions(+), 13 deletions(-)
Signature · 3 lines
Eric Blake, Principal Software Engineer Red Hat, Inc. +1-919-301-3226 Virtualization: qemu.org | libvirt.org
Re: [PATCH-for-5.1 v2 03/54] hw/arm/allwinner-a10: Move some code from realize() to init()
Quoted 9 lines · Eric Blake
Quoted 8 lines · Philippe Mathieu-Daudé
Coccinelle reported:
$ spatch ... --timeout 60 --sp-file \ scripts/coccinelle/simplify-init-realize-error_propagate.cocci HANDLING: ./hw/arm/allwinner-a10.c >>> possible moves from aw_a10_init() to aw_a10_realize() in ./hw/arm/allwinner-a10.c:77
Quoted 3 lines
Quoted 1 line
Move the calls using
&error_fatalwhich don't depend of inputs/of/on/ (here, and in many subsequent messages in the series)
Thanks!
Quoted 9 lines
Quoted 8 lines
updated before
realize()toinit().Signed-off-by Philippe Mathieu-Daudé <[email protected]>---
hw/arm/allwinner-a10.c| 26 +++++++++++++-------------1 file changed, 13 insertions(+), 13 deletions(-)
PATCH v2 4/54 hw/arm/aspeed_ast2600: Simplify use of Error*
In reply to Philippe Mathieu-DaudéCoccinelle reported:
$ spatch ... --timeout 60 --sp-file \
scripts/coccinelle/simplify-init-realize-error_propagate.cocci
HANDLING: ./hw/arm/aspeed_ast2600.cQuoted 1 line
Quoted 1 line
Quoted 1 line
possible moves from
aspeed_soc_ast2600_init()toaspeed_soc_ast2600_realize()in./hw/arm/aspeed_ast2600.c:243
While reviewing we notice we don't need two different Error*, drop the one less used.
--- hw/arm/aspeed_ast2600.c | 16 +++++++++++----- 1 file changed, 11 insertions(+), 5 deletions(-)
hw/arm/aspeed_ast2600.c +11 -5
@@ -245,7 +245,7 @@ static void aspeed_soc_ast2600_realize(DeviceState *dev, Error **errp)int i;AspeedSoCState *s =ASPEED_SOC (dev);AspeedSoCClass *sc =ASPEED_SOC_GET_CLASS (s); -Error *err =NULL , *local_err =NULL ; +Error *err =NULL ;qemu_irq irq;/* IO space */
@@ -418,9 +418,12 @@ static void aspeed_soc_ast2600_realize(DeviceState *dev, Error **errp)return ; }object_property_set_int (OBJECT (&s->spi[i]),1 ,"num-cs" , &err); +if (err) { +error_propagate (errp, err); +return ; + }object_property_set_bool (OBJECT (&s->spi[i]), true,"realized" , - &local_err); -error_propagate (&err, local_err); + &err);if (err) {error_propagate (errp, err);return ;
@@ -472,9 +475,12 @@ static void aspeed_soc_ast2600_realize(DeviceState *dev, Error **errp)qdev_set_nic_properties (DEVICE (&s->ftgmac100[i]), &nd_table[i]);object_property_set_bool (OBJECT (&s->ftgmac100[i]), true,"aspeed" , &err); +if (err) { +error_propagate (errp, err); +return ; + }object_property_set_bool (OBJECT (&s->ftgmac100[i]), true,"realized" , - &local_err); -error_propagate (&err, local_err); + &err);if (err) {error_propagate (errp, err);return ;
Signature · 1 line
2.21.1
Re: [PATCH-for-5.1 v2 04/54] hw/arm/aspeed_ast2600: Simplify use of Error*
Quoted 9 lines · Philippe Mathieu-Daudé
Coccinelle reported:
$ spatch ... --timeout 60 --sp-file \ scripts/coccinelle/simplify-init-realize-error_propagate.cocci HANDLING: ./hw/arm/aspeed_ast2600.cQuoted 1 line
Quoted 1 line
Quoted 1 line
possible moves from
aspeed_soc_ast2600_init()toaspeed_soc_ast2600_realize()in./hw/arm/aspeed_ast2600.c:243While reviewing we notice we don't need two different Error*, drop the one less used.
I think that comes from another pattern we were using at some time which was propagating the second error in the first. Anyhow, this is better.
It seems that the 'return' are badly aligned ?
Thanks,
C.
Quoted 50 lines
Signed-off-by Philippe Mathieu-Daudé <[email protected]>--- hw/arm/aspeed_ast2600.c | 16 +++++++++++----- 1 file changed, 11 insertions(+), 5 deletions(-)hw/arm/aspeed_ast2600.c +11
-5@@ -245,7 +245,7 @@ static void aspeed_soc_ast2600_realize(DeviceState *dev, Error **errp)int i;AspeedSoCState *s =ASPEED_SOC (dev);AspeedSoCClass *sc =ASPEED_SOC_GET_CLASS (s); -Error *err =NULL , *local_err =NULL ; +Error *err =NULL ;qemu_irq irq;/* IO space */ @@ -418,9 +418,12 @@ static void aspeed_soc_ast2600_realize(DeviceState *dev, Error **errp)return ; }object_property_set_int (OBJECT (&s->spi[i]),1 ,"num-cs" , &err); +if (err) { +error_propagate (errp, err); +return ; + }object_property_set_bool (OBJECT (&s->spi[i]), true,"realized" , - &local_err); -error_propagate (&err, local_err); + &err);if (err) {error_propagate (errp, err);return ;@@ -472,9 +475,12 @@ static void aspeed_soc_ast2600_realize(DeviceState *dev, Error **errp)qdev_set_nic_properties (DEVICE (&s->ftgmac100[i]), &nd_table[i]);object_property_set_bool (OBJECT (&s->ftgmac100[i]), true,"aspeed" , &err); +if (err) { +error_propagate (errp, err); +return ; + }object_property_set_bool (OBJECT (&s->ftgmac100[i]), true,"realized" , - &local_err); -error_propagate (&err, local_err); + &err);if (err) {error_propagate (errp, err);return ;
PATCH v2 5/54 hw/arm/aspeed_ast2600: Move some code from realize() to init()
In reply to Philippe Mathieu-DaudéCoccinelle reported:
$ spatch ... --timeout 60 --sp-file \
scripts/coccinelle/simplify-init-realize-error_propagate.cocci
HANDLING: ./hw/arm/aspeed_ast2600.cQuoted 1 line
Quoted 1 line
Quoted 1 line
possible moves from
aspeed_soc_ast2600_init()toaspeed_soc_ast2600_realize()in./hw/arm/aspeed_ast2600.c:243
Move the calls using &error_fatal which don't depend of input updated before realize() to init().
--- hw/arm/aspeed_ast2600.c | 41 ++++++++++++++++++++--------------------- 1 file changed, 20 insertions(+), 21 deletions(-)
hw/arm/aspeed_ast2600.c +20 -21
@@ -114,6 +114,16 @@ static qemu_irq aspeed_soc_get_irq(AspeedSoCState *s, int ctrl)return qdev_get_gpio_in (DEVICE (&s->a7mpcore), sc->irqmap[ctrl]); } +/* +* ASPEED ast2600 has 0xf as cluster ID +* +* http://infocenter.arm.com/help/index.jsp?topic=/com.arm.doc.ddi0388e/CIHEBGFG.html +*/ +static uint64_t aspeed_calc_affinity (int cpu) +{ +return (0xf <<ARM_AFF1_SHIFT ) | cpu; +} +static void aspeed_soc_ast2600_init (Object *obj) {AspeedSoCState *s =ASPEED_SOC (obj);
@@ -130,6 +140,13 @@ static void aspeed_soc_ast2600_init(Object *obj)object_initialize_child (obj,"cpu[*]" ,OBJECT (&s->cpu[i]),sizeof (s->cpu[i]), sc->cpu_type, &error_abort,NULL ); +object_property_set_int (OBJECT (&s->cpu[i]),QEMU_PSCI_CONDUIT_SMC , +"psci-conduit" , &error_abort); +object_property_set_int (OBJECT (&s->cpu[i]),aspeed_calc_affinity (i), +"mp-affinity" , &error_abort); + +object_property_set_int (OBJECT (&s->cpu[i]),1125000000 ,"cntfrq" , + &error_abort); }snprintf (typename,sizeof (typename),"aspeed.scu-%s" , socname);
@@ -146,6 +163,9 @@ static void aspeed_soc_ast2600_init(Object *obj)sysbus_init_child_obj (obj,"a7mpcore" , &s->a7mpcore,sizeof (s->a7mpcore),TYPE_A15MPCORE_PRIV ); +object_property_set_int (OBJECT (&s->a7mpcore), +ASPEED_SOC_AST2600_MAX_IRQ +GIC_INTERNAL , +"num-irq" , &error_abort);sysbus_init_child_obj (obj,"rtc" ,OBJECT (&s->rtc),sizeof (s->rtc),TYPE_ASPEED_RTC );
@@ -230,16 +250,6 @@ static void aspeed_soc_ast2600_init(Object *obj) TYPE_SYSBUS_SDHCI); } -/* -* ASPEED ast2600 has 0xf as cluster ID -* -* http://infocenter.arm.com/help/index.jsp?topic=/com.arm.doc.ddi0388e/CIHEBGFG.html -*/ -static uint64_t aspeed_calc_affinity (int cpu) -{ -return (0xf <<ARM_AFF1_SHIFT ) | cpu; -} -static void aspeed_soc_ast2600_realize (DeviceState *dev,Error **errp) {int i;
@@ -264,19 +274,11 @@ static void aspeed_soc_ast2600_realize(DeviceState *dev, Error **errp)/* CPU */ for (i =0 ; i < s->num_cpus; i++) { -object_property_set_int (OBJECT (&s->cpu[i]),QEMU_PSCI_CONDUIT_SMC , -"psci-conduit" , &error_abort);if (s->num_cpus >1 ) {object_property_set_int (OBJECT (&s->cpu[i]),ASPEED_A7MPCORE_ADDR ,"reset-cbar" , &error_abort); } -object_property_set_int (OBJECT (&s->cpu[i]),aspeed_calc_affinity (i), -"mp-affinity" , &error_abort); - -object_property_set_int (OBJECT (&s->cpu[i]),1125000000 ,"cntfrq" , - &error_abort); -/* * TODO: the secondary CPUs are started and a boot helper * is needed when using -kernel
@@ -292,9 +294,6 @@ static void aspeed_soc_ast2600_realize(DeviceState *dev, Error **errp)/* A7MPCORE */ object_property_set_int (OBJECT (&s->a7mpcore), s->num_cpus,"num-cpu" , &error_abort); -object_property_set_int (OBJECT (&s->a7mpcore), -ASPEED_SOC_AST2600_MAX_IRQ +GIC_INTERNAL , -"num-irq" , &error_abort);object_property_set_bool (OBJECT (&s->a7mpcore), true,"realized" , &error_abort);
Signature · 1 line
2.21.1
PATCH v2 6/54 hw/arm/aspeed_soc: Move some code from realize() to init()
In reply to Philippe Mathieu-DaudéCoccinelle reported:
$ spatch ... --timeout 60 --sp-file \
scripts/coccinelle/simplify-init-realize-error_propagate.cocci
HANDLING: ./hw/arm/aspeed_soc.cQuoted 1 line
Quoted 1 line
Quoted 1 line
possible moves from
aspeed_soc_init()toaspeed_soc_realize()in./hw/arm/aspeed_soc.c:231
Move the calls using &error_fatal which don't depend of input updated before realize() to init().
--- hw/arm/aspeed_soc.c | 6 ++---- 1 file changed, 2 insertions(+), 4 deletions(-)
hw/arm/aspeed_soc.c +2 -4
@@ -183,6 +183,7 @@ static void aspeed_soc_init(Object *obj)snprintf (typename,sizeof (typename),"aspeed.spi%d-%s" , i +1 , socname);sysbus_init_child_obj (obj,"spi[*]" ,OBJECT (&s->spi[i]),sizeof (s->spi[i]), typename); +object_property_set_int (OBJECT (&s->spi[i]),1 ,"num-cs" , &error_abort); }for (i =0 ; i < sc->ehcis_num; i++) {
@@ -360,10 +361,7 @@ static void aspeed_soc_realize(DeviceState *dev, Error **errp)/* SPI */ for (i =0 ; i < sc->spis_num; i++) { -object_property_set_int (OBJECT (&s->spi[i]),1 ,"num-cs" , &err); -object_property_set_bool (OBJECT (&s->spi[i]), true,"realized" , - &local_err); -error_propagate (&err, local_err); +object_property_set_bool (OBJECT (&s->spi[i]), true,"realized" , &err);if (err) {error_propagate (errp, err);return ;
Signature · 1 line
2.21.1
Re: [PATCH-for-5.1 v2 06/54] hw/arm/aspeed_soc: Move some code from realize() to init()
Quoted 11 lines · Philippe Mathieu-Daudé
Coccinelle reported:
$ spatch ... --timeout 60 --sp-file \ scripts/coccinelle/simplify-init-realize-error_propagate.cocci HANDLING: ./hw/arm/aspeed_soc.cQuoted 1 line
Quoted 1 line
Quoted 1 line
possible moves from
aspeed_soc_init()toaspeed_soc_realize()in./hw/arm/aspeed_soc.c:231Move the calls using
&error_fatalwhich don't depend of input updated beforerealize()toinit().Signed-off-by Philippe Mathieu-Daudé <[email protected]>
Thanks,
C.
Quoted 29 lines
--- hw/arm/aspeed_soc.c | 6 ++---- 1 file changed, 2 insertions(+), 4 deletions(-)hw/arm/aspeed_soc.c +2
-4@@ -183,6 +183,7 @@ static void aspeed_soc_init(Object *obj)snprintf (typename,sizeof (typename),"aspeed.spi%d-%s" , i +1 , socname);sysbus_init_child_obj (obj,"spi[*]" ,OBJECT (&s->spi[i]),sizeof (s->spi[i]), typename); +object_property_set_int (OBJECT (&s->spi[i]),1 ,"num-cs" , &error_abort); }for (i =0 ; i < sc->ehcis_num; i++) {@@ -360,10 +361,7 @@ static void aspeed_soc_realize(DeviceState *dev, Error **errp)/* SPI */ for (i =0 ; i < sc->spis_num; i++) { -object_property_set_int (OBJECT (&s->spi[i]),1 ,"num-cs" , &err); -object_property_set_bool (OBJECT (&s->spi[i]), true,"realized" , - &local_err); -error_propagate (&err, local_err); +object_property_set_bool (OBJECT (&s->spi[i]), true,"realized" , &err);if (err) {error_propagate (errp, err);return ;
PATCH v2 7/54 hw/arm/aspeed_soc: Simplify use of Error*
In reply to Philippe Mathieu-DaudéIn the previous commit we noticed we don't need two different Error*, drop the one less used.
--- hw/arm/aspeed_soc.c | 9 ++++++--- 1 file changed, 6 insertions(+), 3 deletions(-)
hw/arm/aspeed_soc.c +6 -3
@@ -234,7 +234,7 @@ static void aspeed_soc_realize(DeviceState *dev, Error **errp)int i;AspeedSoCState *s =ASPEED_SOC (dev);AspeedSoCClass *sc =ASPEED_SOC_GET_CLASS (s); -Error *err =NULL , *local_err =NULL ; +Error *err =NULL ;/* IO space */ create_unimplemented_device("aspeed_soc.io", sc->memmap[ASPEED_IOMEM],
@@ -413,9 +413,12 @@ static void aspeed_soc_realize(DeviceState *dev, Error **errp)qdev_set_nic_properties (DEVICE (&s->ftgmac100[i]), &nd_table[i]);object_property_set_bool (OBJECT (&s->ftgmac100[i]), true,"aspeed" , &err); +if (err) { +error_propagate (errp, err); +return ; + }object_property_set_bool (OBJECT (&s->ftgmac100[i]), true,"realized" , - &local_err); -error_propagate (&err, local_err); + &err);if (err) {error_propagate (errp, err);return ;
Signature · 1 line
2.21.1
Re: [PATCH-for-5.1 v2 07/54] hw/arm/aspeed_soc: Simplify use of Error*
Quoted 4 lines · Philippe Mathieu-Daudé
In the previous commit we noticed we don't need two different Error*, drop the one less used.
Signed-off-by Philippe Mathieu-Daudé <[email protected]>
It seems that the 'return' are badly aligned ?
Thanks,
C.
Quoted 33 lines
--- hw/arm/aspeed_soc.c | 9 ++++++--- 1 file changed, 6 insertions(+), 3 deletions(-)hw/arm/aspeed_soc.c +6
-3@@ -234,7 +234,7 @@ static void aspeed_soc_realize(DeviceState *dev, Error **errp)int i;AspeedSoCState *s =ASPEED_SOC (dev);AspeedSoCClass *sc =ASPEED_SOC_GET_CLASS (s); -Error *err =NULL , *local_err =NULL ; +Error *err =NULL ;/* IO space */ create_unimplemented_device("aspeed_soc.io", sc->memmap[ASPEED_IOMEM],@@ -413,9 +413,12 @@ static void aspeed_soc_realize(DeviceState *dev, Error **errp)qdev_set_nic_properties (DEVICE (&s->ftgmac100[i]), &nd_table[i]);object_property_set_bool (OBJECT (&s->ftgmac100[i]), true,"aspeed" , &err); +if (err) { +error_propagate (errp, err); +return ; + }object_property_set_bool (OBJECT (&s->ftgmac100[i]), true,"realized" , - &local_err); -error_propagate (&err, local_err); + &err);if (err) {error_propagate (errp, err);return ;
PATCH v2 8/54 hw/arm/fsl-imx6: Simplify checks on 'smp_cpus' count
In reply to Philippe Mathieu-DaudéCoccinelle failed at processing this file:
$ spatch ... --timeout 60 --sp-file \
scripts/coccinelle/simplify-init-realize-error_propagate.cocci
HANDLING: ./hw/arm/fsl-imx6.c
Fatal error: exception Coccinelle_modules.Common.TimeoutWhile reviewing we notice the smp_cpus count is already limited by MachineClass::max_cpus:
static void sabrelite_machine_init(MachineClass *mc)
{
mc->max_cpus = FSL_IMX6_NUM_CPUS;
...
}So remove the check in realize(), but still assert in init().
--- hw/arm/fsl-imx6.c | 8 ++------ 1 file changed, 2 insertions(+), 6 deletions(-)
hw/arm/fsl-imx6.c +2 -6
@@ -37,10 +37,12 @@static void fsl_imx6_init (Object *obj) {MachineState *ms =MACHINE (qdev_get_machine ()); +unsigned int smp_cpus = ms->smp.cpus;FslIMX6State *s =FSL_IMX6 (obj);char name[NAME_SIZE ];int i; +assert (smp_cpus <=FSL_IMX6_NUM_CPUS );for (i =0 ; i <MIN (ms->smp.cpus,FSL_IMX6_NUM_CPUS ); i++) {snprintf (name,NAME_SIZE ,"cpu%d" , i); object_initialize_child(obj, name, &s->cpu[i], sizeof(s->cpu[i]),
@@ -121,12 +123,6 @@ static void fsl_imx6_realize(DeviceState *dev, Error **errp)Error *err =NULL ;unsigned int smp_cpus = ms->smp.cpus; -if (smp_cpus >FSL_IMX6_NUM_CPUS ) { -error_setg (errp,"%s: Only %d CPUs are supported (%d requested)" , -TYPE_FSL_IMX6 ,FSL_IMX6_NUM_CPUS , smp_cpus); -return ; - } -for (i =0 ; i < smp_cpus; i++) {/* On uniprocessor, the CBAR is set to 0 */
Signature · 1 line
2.21.1
PATCH v2 9/54 hw/arm/fsl-imx6: Move some code from realize() to init()
In reply to Philippe Mathieu-DaudéCoccinelle failed at processing this file:
$ spatch ... --timeout 60 --sp-file \
scripts/coccinelle/simplify-init-realize-error_propagate.cocci
HANDLING: ./hw/arm/fsl-imx6.c
Fatal error: exception Coccinelle_modules.Common.TimeoutWhile reviewing we noticed some functions can be called at init() time, reducing the need to add extra Error checks at realize() time. Move them. The coccinelle script succeeds after this.
--- hw/arm/fsl-imx6.c | 47 +++++++++++++++++++++++------------------------ 1 file changed, 23 insertions(+), 24 deletions(-)
hw/arm/fsl-imx6.c +23 -24
@@ -48,11 +48,30 @@ static void fsl_imx6_init(Object *obj)object_initialize_child (obj, name, &s->cpu[i],sizeof (s->cpu[i]),ARM_CPU_TYPE_NAME ("cortex-a9" ), &error_abort,NULL ); + +/* On uniprocessor, the CBAR is set to 0 */ +if (smp_cpus >1 ) { +object_property_set_int (OBJECT (&s->cpu[i]),FSL_IMX6_A9MPCORE_ADDR , +"reset-cbar" , &error_abort); + } + +/* All CPU but CPU 0 start in power off mode */ +if (i) { +object_property_set_bool (OBJECT (&s->cpu[i]), true, +"start-powered-off" , &error_abort); + } }sysbus_init_child_obj (obj,"a9mpcore" , &s->a9mpcore,sizeof (s->a9mpcore),TYPE_A9MPCORE_PRIV ); +object_property_set_int (OBJECT (&s->a9mpcore), smp_cpus,"num-cpu" , + &error_abort); + +object_property_set_int (OBJECT (&s->a9mpcore), +FSL_IMX6_MAX_IRQ +GIC_INTERNAL ,"num-irq" , + &error_abort); +sysbus_init_child_obj (obj,"ccm" , &s->ccm,sizeof (s->ccm),TYPE_IMX6_CCM );sysbus_init_child_obj (obj,"src" , &s->src,sizeof (s->src),TYPE_IMX6_SRC );
@@ -81,6 +100,10 @@ static void fsl_imx6_init(Object *obj)snprintf (name,NAME_SIZE ,"gpio%d" , i +1 );sysbus_init_child_obj (obj, name, &s->gpio[i],sizeof (s->gpio[i]),TYPE_IMX_GPIO ); +object_property_set_bool (OBJECT (&s->gpio[i]), true,"has-edge-sel" , + &error_abort); +object_property_set_bool (OBJECT (&s->gpio[i]), true,"has-upper-pin-irq" , + &error_abort); }for (i =0 ; i <FSL_IMX6_NUM_ESDHCS ; i++) {
@@ -124,19 +147,6 @@ static void fsl_imx6_realize(DeviceState *dev, Error **errp)unsigned int smp_cpus = ms->smp.cpus;for (i =0 ; i < smp_cpus; i++) { - -/* On uniprocessor, the CBAR is set to 0 */ -if (smp_cpus >1 ) { -object_property_set_int (OBJECT (&s->cpu[i]),FSL_IMX6_A9MPCORE_ADDR , -"reset-cbar" , &error_abort); - } - -/* All CPU but CPU 0 start in power off mode */ -if (i) { -object_property_set_bool (OBJECT (&s->cpu[i]), true, -"start-powered-off" , &error_abort); - } -object_property_set_bool (OBJECT (&s->cpu[i]), true,"realized" , &err);if (err) {error_propagate (errp, err);
@@ -144,13 +154,6 @@ static void fsl_imx6_realize(DeviceState *dev, Error **errp) } } -object_property_set_int (OBJECT (&s->a9mpcore), smp_cpus,"num-cpu" , - &error_abort); - -object_property_set_int (OBJECT (&s->a9mpcore), -FSL_IMX6_MAX_IRQ +GIC_INTERNAL ,"num-irq" , - &error_abort); -object_property_set_bool (OBJECT (&s->a9mpcore), true,"realized" , &err);if (err) {error_propagate (errp, err);
@@ -310,10 +313,6 @@ static void fsl_imx6_realize(DeviceState *dev, Error **errp) }, }; -object_property_set_bool (OBJECT (&s->gpio[i]), true,"has-edge-sel" , - &error_abort); -object_property_set_bool (OBJECT (&s->gpio[i]), true,"has-upper-pin-irq" , - &error_abort);object_property_set_bool (OBJECT (&s->gpio[i]), true,"realized" , &err);if (err) {error_propagate (errp, err);
Signature · 1 line
2.21.1
PATCH v2 10/54 hw/arm/fsl-imx31: Move some code from realize() to init()
In reply to Philippe Mathieu-DaudéCoccinelle reported:
$ spatch ... --timeout 60 --sp-file \
scripts/coccinelle/simplify-init-realize-error_propagate.cocci
HANDLING: hw/arm/fsl-imx31.cQuoted 1 line
Quoted 1 line
Quoted 1 line
possible moves from
fsl_imx31_init()tofsl_imx31_realize()inhw/arm/fsl-imx31.c:68
Move the calls using &error_abort which don't depend of input updated before realize() to init().
--- hw/arm/fsl-imx31.c | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-)
hw/arm/fsl-imx31.c +2 -2
@@ -62,6 +62,8 @@ static void fsl_imx31_init(Object *obj)for (i =0 ; i <FSL_IMX31_NUM_GPIOS ; i++) {sysbus_init_child_obj (obj,"gpio[*]" , &s->gpio[i],sizeof (s->gpio[i]),TYPE_IMX_GPIO ); +object_property_set_bool (OBJECT (&s->gpio[i]), false,"has-edge-sel" , + &error_abort); } }
@@ -191,8 +193,6 @@ static void fsl_imx31_realize(DeviceState *dev, Error **errp) { FSL_IMX31_GPIO3_ADDR, FSL_IMX31_GPIO3_IRQ } }; -object_property_set_bool (OBJECT (&s->gpio[i]), false,"has-edge-sel" , - &error_abort);object_property_set_bool (OBJECT (&s->gpio[i]), true,"realized" , &err);if (err) {error_propagate (errp, err);
Signature · 1 line
2.21.1
PATCH v2 11/54 hw/arm/msf2-soc: Store MemoryRegion in MSF2State
In reply to Philippe Mathieu-DaudéCoccinelle reported:
$ spatch ... --timeout 60 --sp-file \
scripts/coccinelle/simplify-init-realize-error_propagate.cocci
HANDLING: ./hw/arm/msf2-soc.cQuoted 1 line
Quoted 1 line
Quoted 1 line
possible moves from
m2sxxx_soc_initfn()tom2sxxx_soc_realize()in./hw/arm/msf2-soc.c:86
While reviewing we notice storing the MemoryRegion in the device state, we'll be able to later automatically simplify the error propagation calls.
--- include/hw/arm/msf2-soc.h | 4 ++++ hw/arm/msf2-soc.c | 18 +++++++----------- 2 files changed, 11 insertions(+), 11 deletions(-)
include/hw/arm/msf2-soc.h +4 -0
@@ -50,6 +50,10 @@ typedef struct MSF2State {ARMv7MState armv7m; +MemoryRegion sram; +MemoryRegion nvm; +MemoryRegion nvm_alias; +char *cpu_type;char *part_name;uint64_t envm_size;
hw/arm/msf2-soc.c +7 -11
@@ -90,13 +90,9 @@ static void m2sxxx_soc_realize(DeviceState *dev_soc, Error **errp)SysBusDevice *busdev;Error *err =NULL ;int i; -MemoryRegion *system_memory =get_system_memory (); -MemoryRegion *nvm =g_new (MemoryRegion,1 ); -MemoryRegion *nvm_alias =g_new (MemoryRegion,1 ); -MemoryRegion *sram =g_new (MemoryRegion,1 ); -memory_region_init_rom (nvm,OBJECT (dev_soc),"MSF2.eNVM" , s->envm_size, +memory_region_init_rom (&s->nvm,OBJECT (dev_soc),"MSF2.eNVM" , s->envm_size, &error_fatal);/* * On power-on, the eNVM region 0x60000000 is automatically
@@ -104,15 +100,15 @@ static void m2sxxx_soc_realize(DeviceState *dev_soc, Error **errp)* start address (0x0). We do not support remapping other eNVM, * eSRAM and DDR regions by guest(via Sysreg) currently. */ -memory_region_init_alias (nvm_alias,OBJECT (dev_soc),"MSF2.eNVM" , nvm,0 , - s->envm_size); +memory_region_init_alias (&s->nvm_alias,OBJECT (dev_soc),"MSF2.eNVM" , + &s->nvm,0 , s->envm_size); -memory_region_add_subregion (system_memory,ENVM_BASE_ADDRESS , nvm); -memory_region_add_subregion (system_memory,0 , nvm_alias); +memory_region_add_subregion (system_memory,ENVM_BASE_ADDRESS , &s->nvm); +memory_region_add_subregion (system_memory,0 , &s->nvm_alias); -memory_region_init_ram (sram,NULL ,"MSF2.eSRAM" , s->esram_size, +memory_region_init_ram (&s->sram,NULL ,"MSF2.eSRAM" , s->esram_size, &error_fatal); -memory_region_add_subregion (system_memory,SRAM_BASE_ADDRESS , sram); +memory_region_add_subregion (system_memory,SRAM_BASE_ADDRESS , &s->sram); armv7m =DEVICE (&s->armv7m);qdev_prop_set_uint32 (armv7m,"num-irq" ,81 );
Signature · 1 line
2.21.1
PATCH v2 12/54 hw/arm/stm32f205_soc: Store MemoryRegion in STM32F205State
In reply to Philippe Mathieu-DaudéCoccinelle reported:
$ spatch ... --timeout 60 --sp-file \
scripts/coccinelle/simplify-init-realize-error_propagate.cocci
HANDLING: ./hw/arm/stm32f205_soc.cQuoted 1 line
Quoted 1 line
Quoted 1 line
possible moves from
stm32f205_soc_initfn()tostm32f205_soc_realize()in./hw/arm/stm32f205_soc.c:83
While reviewing we notice storing the MemoryRegion in the device state, we'll be able to later automatically simplify the error propagation calls.
--- include/hw/arm/stm32f205_soc.h | 4 ++++ hw/arm/stm32f205_soc.c | 18 +++++++----------- 2 files changed, 11 insertions(+), 11 deletions(-)
include/hw/arm/stm32f205_soc.h +4 -0
@@ -56,6 +56,10 @@ typedef struct STM32F205State {ARMv7MState armv7m; +MemoryRegion sram; +MemoryRegion flash; +MemoryRegion flash_alias; +STM32F2XXSyscfgState syscfg;STM32F2XXUsartState usart[STM_NUM_USARTS ];STM32F2XXTimerState timer[STM_NUM_TIMERS ];
hw/arm/stm32f205_soc.c +7 -11
@@ -87,23 +87,19 @@ static void stm32f205_soc_realize(DeviceState *dev_soc, Error **errp)SysBusDevice *busdev;Error *err =NULL ;int i; -MemoryRegion *system_memory =get_system_memory (); -MemoryRegion *sram =g_new (MemoryRegion,1 ); -MemoryRegion *flash =g_new (MemoryRegion,1 ); -MemoryRegion *flash_alias =g_new (MemoryRegion,1 ); -memory_region_init_rom (flash,OBJECT (dev_soc),"STM32F205.flash" , +memory_region_init_rom (&s->flash,OBJECT (dev_soc),"STM32F205.flash" ,FLASH_SIZE , &error_fatal); -memory_region_init_alias (flash_alias,OBJECT (dev_soc), -"STM32F205.flash.alias" , flash,0 ,FLASH_SIZE ); +memory_region_init_alias (&s->flash_alias,OBJECT (dev_soc), +"STM32F205.flash.alias" , &s->flash,0 ,FLASH_SIZE ); -memory_region_add_subregion (system_memory,FLASH_BASE_ADDRESS , flash); -memory_region_add_subregion (system_memory,0 , flash_alias); +memory_region_add_subregion (system_memory,FLASH_BASE_ADDRESS , &s->flash); +memory_region_add_subregion (system_memory,0 , &s->flash_alias); -memory_region_init_ram (sram,NULL ,"STM32F205.sram" ,SRAM_SIZE , +memory_region_init_ram (&s->sram,NULL ,"STM32F205.sram" ,SRAM_SIZE , &error_fatal); -memory_region_add_subregion (system_memory,SRAM_BASE_ADDRESS , sram); +memory_region_add_subregion (system_memory,SRAM_BASE_ADDRESS , &s->sram); armv7m =DEVICE (&s->armv7m);qdev_prop_set_uint32 (armv7m,"num-irq" ,96 );
Signature · 1 line
2.21.1
PATCH v2 13/54 hw/arm/stm32f205_soc: Move some code from realize() to init()
In reply to Philippe Mathieu-DaudéCoccinelle reported:
$ spatch ... --timeout 60 --sp-file \
scripts/coccinelle/simplify-init-realize-error_propagate.cocci
HANDLING: ./hw/arm/stm32f205_soc.cQuoted 1 line
Quoted 1 line
Quoted 1 line
possible moves from
stm32f205_soc_initfn()tostm32f205_soc_realize()in./hw/arm/stm32f205_soc.c:83
Move the calls using &error_fatal which don't depend of input updated before realize() to init().
--- hw/arm/stm32f205_soc.c | 20 ++++++++++---------- 1 file changed, 10 insertions(+), 10 deletions(-)
hw/arm/stm32f205_soc.c +10 -10
@@ -49,6 +49,7 @@ static const int spi_irq[STM_NUM_SPIS] = {35, 36, 51};static void stm32f205_soc_initfn (Object *obj) {STM32F205State *s =STM32F205_SOC (obj); +MemoryRegion *system_memory =get_system_memory ();int i; sysbus_init_child_obj(obj, "armv7m", &s->armv7m, sizeof(s->armv7m),
@@ -78,6 +79,14 @@ static void stm32f205_soc_initfn(Object *obj)sysbus_init_child_obj (obj,"spi[*]" , &s->spi[i],sizeof (s->spi[i]),TYPE_STM32F2XX_SPI ); } + +memory_region_init_ram (&s->sram,NULL ,"STM32F205.sram" ,SRAM_SIZE , + &error_fatal); +memory_region_add_subregion (system_memory,SRAM_BASE_ADDRESS , &s->sram); + +memory_region_init_rom (&s->flash, obj,"STM32F205.flash" , +FLASH_SIZE , &error_fatal); +memory_region_add_subregion (system_memory,FLASH_BASE_ADDRESS , &s->flash); }static void stm32f205_soc_realize (DeviceState *dev_soc,Error **errp)
@@ -87,19 +96,10 @@ static void stm32f205_soc_realize(DeviceState *dev_soc, Error **errp)SysBusDevice *busdev;Error *err =NULL ;int i; -MemoryRegion *system_memory =get_system_memory (); -memory_region_init_rom (&s->flash,OBJECT (dev_soc),"STM32F205.flash" , -FLASH_SIZE , &error_fatal);memory_region_init_alias (&s->flash_alias,OBJECT (dev_soc),"STM32F205.flash.alias" , &s->flash,0 ,FLASH_SIZE ); - -memory_region_add_subregion (system_memory,FLASH_BASE_ADDRESS , &s->flash); -memory_region_add_subregion (system_memory,0 , &s->flash_alias); - -memory_region_init_ram (&s->sram,NULL ,"STM32F205.sram" ,SRAM_SIZE , - &error_fatal); -memory_region_add_subregion (system_memory,SRAM_BASE_ADDRESS , &s->sram); +memory_region_add_subregion (get_system_memory (),0 , &s->flash_alias); armv7m =DEVICE (&s->armv7m);qdev_prop_set_uint32 (armv7m,"num-irq" ,96 );
Signature · 1 line
2.21.1
PATCH v2 14/54 hw/arm/xlnx-zynqmp: Use single propagate_error() call
In reply to Philippe Mathieu-DaudéCoccinelle failed at processing this file:
$ spatch ... --timeout 60 --sp-file \
scripts/coccinelle/simplify-init-realize-error_propagate.cocci
HANDLING: ./hw/arm/xlnx-zynqmp.c
EXN: Coccinelle_modules.Common.TimeoutWe are going to manually add the missing propagate_error() calls. As there are many Error* calls used, simplify by using an unique call to propagate_error().
--- hw/arm/xlnx-zynqmp.c | 61 +++++++++++++++++--------------------------- 1 file changed, 23 insertions(+), 38 deletions(-)
hw/arm/xlnx-zynqmp.c +23 -38
@@ -385,15 +385,13 @@ static void xlnx_zynqmp_realize(DeviceState *dev, Error **errp)object_property_set_bool (OBJECT (&s->apu_cpu[i]), true,"realized" , &err);if (err) { -error_propagate (errp, err); -return ; + goto out_propagate_error; } }object_property_set_bool (OBJECT (&s->gic), true,"realized" , &err);if (err) { -error_propagate (errp, err); -return ; + goto out_propagate_error; }assert (ARRAY_SIZE (xlnx_zynqmp_gic_regions) ==XLNX_ZYNQMP_GIC_REGIONS );
@@ -462,8 +460,7 @@ static void xlnx_zynqmp_realize(DeviceState *dev, Error **errp)xlnx_zynqmp_create_rpu (ms, s, boot_cpu, &err);if (err) { -error_propagate (errp, err); -return ; + goto out_propagate_error; }if (!s->boot_cpu_ptr) {
@@ -488,8 +485,7 @@ static void xlnx_zynqmp_realize(DeviceState *dev, Error **errp) &error_abort);object_property_set_bool (OBJECT (&s->gem[i]), true,"realized" , &err);if (err) { -error_propagate (errp, err); -return ; + goto out_propagate_error; }sysbus_mmio_map (SYS_BUS_DEVICE (&s->gem[i]),0 , gem_addr[i]); sysbus_connect_irq(SYS_BUS_DEVICE(&s->gem[i]), 0,
@@ -500,8 +496,7 @@ static void xlnx_zynqmp_realize(DeviceState *dev, Error **errp)qdev_prop_set_chr (DEVICE (&s->uart[i]),"chardev" ,serial_hd (i));object_property_set_bool (OBJECT (&s->uart[i]), true,"realized" , &err);if (err) { -error_propagate (errp, err); -return ; + goto out_propagate_error; }sysbus_mmio_map (SYS_BUS_DEVICE (&s->uart[i]),0 , uart_addr[i]); sysbus_connect_irq(SYS_BUS_DEVICE(&s->uart[i]), 0,
@@ -512,8 +507,7 @@ static void xlnx_zynqmp_realize(DeviceState *dev, Error **errp) &error_abort);object_property_set_bool (OBJECT (&s->sata), true,"realized" , &err);if (err) { -error_propagate (errp, err); -return ; + goto out_propagate_error; }sysbus_mmio_map (SYS_BUS_DEVICE (&s->sata),0 ,SATA_ADDR );
@@ -531,23 +525,19 @@ static void xlnx_zynqmp_realize(DeviceState *dev, Error **errp)*/ object_property_set_uint (sdhci,3 ,"sd-spec-version" , &err);if (err) { -error_propagate (errp, err); -return ; + goto out_propagate_error; }object_property_set_uint (sdhci,SDHCI_CAPABILITIES ,"capareg" , &err);if (err) { -error_propagate (errp, err); -return ; + goto out_propagate_error; }object_property_set_uint (sdhci,UHS_I ,"uhs" , &err);if (err) { -error_propagate (errp, err); -return ; + goto out_propagate_error; }object_property_set_bool (sdhci, true,"realized" , &err);if (err) { -error_propagate (errp, err); -return ; + goto out_propagate_error; }sysbus_mmio_map (sbd,0 , sdhci_addr[i]);sysbus_connect_irq (sbd,0 , gic_spi[sdhci_intr[i]]);
@@ -564,8 +554,7 @@ static void xlnx_zynqmp_realize(DeviceState *dev, Error **errp)object_property_set_bool (OBJECT (&s->spi[i]), true,"realized" , &err);if (err) { -error_propagate (errp, err); -return ; + goto out_propagate_error; }sysbus_mmio_map (SYS_BUS_DEVICE (&s->spi[i]),0 , spi_addr[i]);
@@ -582,8 +571,7 @@ static void xlnx_zynqmp_realize(DeviceState *dev, Error **errp)object_property_set_bool (OBJECT (&s->qspi), true,"realized" , &err);if (err) { -error_propagate (errp, err); -return ; + goto out_propagate_error; }sysbus_mmio_map (SYS_BUS_DEVICE (&s->qspi),0 ,QSPI_ADDR );sysbus_mmio_map (SYS_BUS_DEVICE (&s->qspi),1 ,LQSPI_ADDR );
@@ -605,16 +593,14 @@ static void xlnx_zynqmp_realize(DeviceState *dev, Error **errp)object_property_set_bool (OBJECT (&s->dp), true,"realized" , &err);if (err) { -error_propagate (errp, err); -return ; + goto out_propagate_error; }sysbus_mmio_map (SYS_BUS_DEVICE (&s->dp),0 ,DP_ADDR );sysbus_connect_irq (SYS_BUS_DEVICE (&s->dp),0 , gic_spi[DP_IRQ ]);object_property_set_bool (OBJECT (&s->dpdma), true,"realized" , &err);if (err) { -error_propagate (errp, err); -return ; + goto out_propagate_error; }object_property_set_link (OBJECT (&s->dp),OBJECT (&s->dpdma),"dpdma" , &error_abort);
@@ -623,16 +609,14 @@ static void xlnx_zynqmp_realize(DeviceState *dev, Error **errp)object_property_set_bool (OBJECT (&s->ipi), true,"realized" , &err);if (err) { -error_propagate (errp, err); -return ; + goto out_propagate_error; }sysbus_mmio_map (SYS_BUS_DEVICE (&s->ipi),0 ,IPI_ADDR );sysbus_connect_irq (SYS_BUS_DEVICE (&s->ipi),0 , gic_spi[IPI_IRQ ]);object_property_set_bool (OBJECT (&s->rtc), true,"realized" , &err);if (err) { -error_propagate (errp, err); -return ; + goto out_propagate_error; }sysbus_mmio_map (SYS_BUS_DEVICE (&s->rtc),0 ,RTC_ADDR );sysbus_connect_irq (SYS_BUS_DEVICE (&s->rtc),0 , gic_spi[RTC_IRQ ]);
@@ -640,13 +624,11 @@ static void xlnx_zynqmp_realize(DeviceState *dev, Error **errp)for (i =0 ; i <XLNX_ZYNQMP_NUM_GDMA_CH ; i++) {object_property_set_uint (OBJECT (&s->gdma[i]),128 ,"bus-width" , &err);if (err) { -error_propagate (errp, err); -return ; + goto out_propagate_error; }object_property_set_bool (OBJECT (&s->gdma[i]), true,"realized" , &err);if (err) { -error_propagate (errp, err); -return ; + goto out_propagate_error; }sysbus_mmio_map (SYS_BUS_DEVICE (&s->gdma[i]),0 , gdma_ch_addr[i]);
@@ -657,14 +639,17 @@ static void xlnx_zynqmp_realize(DeviceState *dev, Error **errp)for (i =0 ; i <XLNX_ZYNQMP_NUM_ADMA_CH ; i++) {object_property_set_bool (OBJECT (&s->adma[i]), true,"realized" , &err);if (err) { -error_propagate (errp, err); -return ; + goto out_propagate_error; }sysbus_mmio_map (SYS_BUS_DEVICE (&s->adma[i]),0 , adma_ch_addr[i]);sysbus_connect_irq (SYS_BUS_DEVICE (&s->adma[i]),0 , gic_spi[adma_ch_intr[i]]); } +return ; + +out_propagate_error: +error_propagate (errp, err); }static Property xlnx_zynqmp_props[] = {
Signature · 1 line
2.21.1
PATCH v2 15/54 hw/arm/xlnx-zynqmp: Split xlnx_zynqmp_create_rpu() as init + realize
In reply to Philippe Mathieu-DaudéCoccinelle failed at processing this file:
$ spatch ... --timeout 60 --sp-file \
scripts/coccinelle/simplify-init-realize-error_propagate.cocci
HANDLING: ./hw/arm/xlnx-zynqmp.c
EXN: Coccinelle_modules.Common.TimeoutWe are going to manually add the missing propagate_error() calls. Some functions can be called at init() time, reducing the need to add extra Error checks at realize() time. Split create_rpu() in init() and realize().
--- hw/arm/xlnx-zynqmp.c | 45 +++++++++++++++++++++++++++----------------- 1 file changed, 28 insertions(+), 17 deletions(-)
hw/arm/xlnx-zynqmp.c +28 -17
@@ -173,18 +173,9 @@ static inline int arm_gic_ppi_index(int cpu_nr, int ppi_index)return GIC_NUM_SPI_INTR + cpu_nr *GIC_INTERNAL + ppi_index; } -static void xlnx_zynqmp_create_rpu (MachineState *ms,XlnxZynqMPState *s, -const char *boot_cpu,Error **errp) +static void xlnx_zynqmp_rpu_init (XlnxZynqMPState *s,int num_rpus) { -Error *err =NULL ;int i; -int num_rpus =MIN (ms->smp.cpus -XLNX_ZYNQMP_NUM_APU_CPUS , -XLNX_ZYNQMP_NUM_RPU_CPUS ); - -if (num_rpus <=0 ) { -/* Don't create rpu-cluster object if there's nothing to put in it */ -return ; - } object_initialize_child(OBJECT(s), "rpu-cluster", &s->rpu_cluster, sizeof(s->rpu_cluster), TYPE_CPU_CLUSTER,
@@ -192,13 +183,25 @@ static void xlnx_zynqmp_create_rpu(MachineState *ms, XlnxZynqMPState *s,qdev_prop_set_uint32 (DEVICE (&s->rpu_cluster),"cluster-id" ,1 );for (i =0 ; i < num_rpus; i++) { -char *name; -object_initialize_child (OBJECT (&s->rpu_cluster),"rpu-cpu[*]" , &s->rpu_cpu[i],sizeof (s->rpu_cpu[i]),ARM_CPU_TYPE_NAME ("cortex-r5f" ), &error_abort,NULL ); +object_property_set_bool (OBJECT (&s->rpu_cpu[i]), true,"reset-hivecs" , + &error_abort); + } +} + +static void xlnx_zynqmp_rpu_realize (XlnxZynqMPState *s,int num_rpus, +const char *boot_cpu,Error **errp) +{ +Error *err =NULL ; +int i; + +for (i =0 ; i < num_rpus; i++) { +char *name; + name =object_get_canonical_path_component (OBJECT (&s->rpu_cpu[i]));if (strcmp (name, boot_cpu)) {/* Secondary CPUs start in PSCI powered-down state */
@@ -209,8 +212,6 @@ static void xlnx_zynqmp_create_rpu(MachineState *ms, XlnxZynqMPState *s, }g_free (name); -object_property_set_bool (OBJECT (&s->rpu_cpu[i]), true,"reset-hivecs" , - &error_abort);object_property_set_bool (OBJECT (&s->rpu_cpu[i]), true,"realized" , &err);if (err) {
@@ -228,6 +229,8 @@ static void xlnx_zynqmp_init(Object *obj)XlnxZynqMPState *s =XLNX_ZYNQMP (obj);int i;int num_apus =MIN (ms->smp.cpus,XLNX_ZYNQMP_NUM_APU_CPUS ); +int num_rpus =MIN (ms->smp.cpus -XLNX_ZYNQMP_NUM_APU_CPUS , +XLNX_ZYNQMP_NUM_RPU_CPUS ); object_initialize_child(obj, "apu-cluster", &s->apu_cluster, sizeof(s->apu_cluster), TYPE_CPU_CLUSTER,
@@ -290,6 +293,10 @@ static void xlnx_zynqmp_init(Object *obj)sysbus_init_child_obj (obj,"adma[*]" , &s->adma[i],sizeof (s->adma[i]),TYPE_XLNX_ZDMA ); } + +if (num_rpus >0 ) { +xlnx_zynqmp_rpu_init (s, num_rpus); + } }static void xlnx_zynqmp_realize (DeviceState *dev,Error **errp)
@@ -300,6 +307,8 @@ static void xlnx_zynqmp_realize(DeviceState *dev, Error **errp)uint8_t i;uint64_t ram_size;int num_apus =MIN (ms->smp.cpus,XLNX_ZYNQMP_NUM_APU_CPUS ); +int num_rpus =MIN (ms->smp.cpus -XLNX_ZYNQMP_NUM_APU_CPUS , +XLNX_ZYNQMP_NUM_RPU_CPUS );const char *boot_cpu = s->boot_cpu ? s->boot_cpu :"apu-cpu[0]" ;ram_addr_t ddr_low_size, ddr_high_size;qemu_irq gic_spi[GIC_NUM_SPI_INTR ];
@@ -458,9 +467,11 @@ static void xlnx_zynqmp_realize(DeviceState *dev, Error **errp) "RPUs just use -smp 6."); } -xlnx_zynqmp_create_rpu (ms, s, boot_cpu, &err); -if (err) { - goto out_propagate_error; +if (num_rpus >0 ) { +xlnx_zynqmp_rpu_realize (s, num_rpus, boot_cpu, &err); +if (err) { + goto out_propagate_error; + } }if (!s->boot_cpu_ptr) {
Signature · 1 line
2.21.1
PATCH v2 16/54 hw/arm/xlnx-zynqmp: Move some code from realize() to init()
In reply to Philippe Mathieu-DaudéCoccinelle failed at processing this file:
$ spatch ... --timeout 60 --sp-file \
scripts/coccinelle/simplify-init-realize-error_propagate.cocci
HANDLING: ./hw/arm/xlnx-zynqmp.c
EXN: Coccinelle_modules.Common.TimeoutMove the calls using &error_abort which don't depend of input updated before realize() to init().
--- hw/arm/xlnx-zynqmp.c | 22 +++++++++++----------- 1 file changed, 11 insertions(+), 11 deletions(-)
hw/arm/xlnx-zynqmp.c +11 -11
@@ -242,6 +242,11 @@ static void xlnx_zynqmp_init(Object *obj) &s->apu_cpu[i],sizeof (s->apu_cpu[i]),ARM_CPU_TYPE_NAME ("cortex-a53" ), &error_abort, NULL); + +object_property_set_int (OBJECT (&s->apu_cpu[i]),QEMU_PSCI_CONDUIT_SMC , +"psci-conduit" , &error_abort); +object_property_set_int (OBJECT (&s->apu_cpu[i]),GIC_BASE_ADDR , +"reset-cbar" , &error_abort); } sysbus_init_child_obj(obj, "gic", &s->gic, sizeof(s->gic),
@@ -250,6 +255,10 @@ static void xlnx_zynqmp_init(Object *obj)for (i =0 ; i <XLNX_ZYNQMP_NUM_GEMS ; i++) {sysbus_init_child_obj (obj,"gem[*]" , &s->gem[i],sizeof (s->gem[i]),TYPE_CADENCE_GEM ); +object_property_set_int (OBJECT (&s->gem[i]),GEM_REVISION ,"revision" , + &error_abort); +object_property_set_int (OBJECT (&s->gem[i]),2 ,"num-priority-queues" , + &error_abort); }for (i =0 ; i <XLNX_ZYNQMP_NUM_UARTS ; i++) {
@@ -259,6 +268,8 @@ static void xlnx_zynqmp_init(Object *obj)sysbus_init_child_obj (obj,"sata" , &s->sata,sizeof (s->sata),TYPE_SYSBUS_AHCI ); +object_property_set_int (OBJECT (&s->sata),SATA_NUM_PORTS ,"num-ports" , + &error_abort);for (i =0 ; i <XLNX_ZYNQMP_NUM_SDHCI ; i++) { sysbus_init_child_obj(obj, "sdhci[*]", &s->sdhci[i],
@@ -370,9 +381,6 @@ static void xlnx_zynqmp_realize(DeviceState *dev, Error **errp)for (i =0 ; i < num_apus; i++) {char *name; -object_property_set_int (OBJECT (&s->apu_cpu[i]),QEMU_PSCI_CONDUIT_SMC , -"psci-conduit" , &error_abort); - name =object_get_canonical_path_component (OBJECT (&s->apu_cpu[i]));if (strcmp (name, boot_cpu)) {/* Secondary CPUs start in PSCI powered-down state */
@@ -387,8 +395,6 @@ static void xlnx_zynqmp_realize(DeviceState *dev, Error **errp) s->secure, "has_el3", NULL);object_property_set_bool (OBJECT (&s->apu_cpu[i]), s->virt,"has_el2" ,NULL ); -object_property_set_int (OBJECT (&s->apu_cpu[i]),GIC_BASE_ADDR , -"reset-cbar" , &error_abort);object_property_set_int (OBJECT (&s->apu_cpu[i]), num_apus,"core-count" , &error_abort); object_property_set_bool(OBJECT(&s->apu_cpu[i]), true, "realized",
@@ -490,10 +496,6 @@ static void xlnx_zynqmp_realize(DeviceState *dev, Error **errp)qemu_check_nic_model (nd,TYPE_CADENCE_GEM );qdev_set_nic_properties (DEVICE (&s->gem[i]), nd); } -object_property_set_int (OBJECT (&s->gem[i]),GEM_REVISION ,"revision" , - &error_abort); -object_property_set_int (OBJECT (&s->gem[i]),2 ,"num-priority-queues" , - &error_abort);object_property_set_bool (OBJECT (&s->gem[i]), true,"realized" , &err);if (err) { goto out_propagate_error;
@@ -514,8 +516,6 @@ static void xlnx_zynqmp_realize(DeviceState *dev, Error **errp) gic_spi[uart_intr[i]]); } -object_property_set_int (OBJECT (&s->sata),SATA_NUM_PORTS ,"num-ports" , - &error_abort);object_property_set_bool (OBJECT (&s->sata), true,"realized" , &err);if (err) { goto out_propagate_error;
Signature · 1 line
2.21.1
PATCH v2 17/54 hw/microblaze/xlnx-zynqmp-pmu: Move some code from realize() to init()
In reply to Philippe Mathieu-DaudéCoccinelle reported:
$ spatch ... --timeout 60 --sp-file \
scripts/coccinelle/simplify-init-realize-error_propagate.cocci
HANDLING: ./hw/microblaze/xlnx-zynqmp-pmu.cQuoted 1 line
Quoted 1 line
Quoted 1 line
possible moves from
xlnx_zynqmp_pmu_soc_init()toxlnx_zynqmp_pmu_soc_realize()in./hw/microblaze/xlnx-zynqmp-pmu.c:79
Move the calls using &error_abort which don't depend of input updated before realize() to init().
--- hw/microblaze/xlnx-zynqmp-pmu.c | 46 ++++++++++++++++----------------- 1 file changed, 23 insertions(+), 23 deletions(-)
hw/microblaze/xlnx-zynqmp-pmu.c +23 -23
@@ -63,24 +63,6 @@ static void xlnx_zynqmp_pmu_soc_init(Object *obj)object_initialize_child (obj,"pmu-cpu" , &s->cpu,sizeof (s->cpu),TYPE_MICROBLAZE_CPU , &error_abort,NULL ); - -sysbus_init_child_obj (obj,"intc" , &s->intc,sizeof (s->intc), -TYPE_XLNX_PMU_IO_INTC ); - -/* Create the IPI device */ -for (int i =0 ; i <XLNX_ZYNQMP_PMU_NUM_IPIS ; i++) { -char *name =g_strdup_printf ("ipi%d" , i); -sysbus_init_child_obj (obj, name, &s->ipi[i], -sizeof (XlnxZynqMPIPI),TYPE_XLNX_ZYNQMP_IPI ); -g_free (name); - } -} - -static void xlnx_zynqmp_pmu_soc_realize (DeviceState *dev,Error **errp) -{ -XlnxZynqMPPMUSoCState *s =XLNX_ZYNQMP_PMU_SOC (dev); -Error *err =NULL ; -object_property_set_uint (OBJECT (&s->cpu),XLNX_ZYNQMP_PMU_ROM_ADDR ,"base-vectors" , &error_abort); object_property_set_bool(OBJECT(&s->cpu), true, "use-stack-protection",
@@ -99,18 +81,36 @@ static void xlnx_zynqmp_pmu_soc_realize(DeviceState *dev, Error **errp)object_property_set_str (OBJECT (&s->cpu),"8.40.b" ,"version" , &error_abort);object_property_set_uint (OBJECT (&s->cpu),0 ,"pvr" , &error_abort); -object_property_set_bool (OBJECT (&s->cpu), true,"realized" , &err); -if (err) { -error_propagate (errp, err); -return ; - } +sysbus_init_child_obj (obj,"intc" , &s->intc,sizeof (s->intc), +TYPE_XLNX_PMU_IO_INTC );object_property_set_uint (OBJECT (&s->intc),0x10 ,"intc-intr-size" , &error_abort);object_property_set_uint (OBJECT (&s->intc),0x0 ,"intc-level-edge" , &error_abort);object_property_set_uint (OBJECT (&s->intc),0xffff ,"intc-positive" , &error_abort); + +/* Create the IPI device */ +for (int i =0 ; i <XLNX_ZYNQMP_PMU_NUM_IPIS ; i++) { +char *name =g_strdup_printf ("ipi%d" , i); +sysbus_init_child_obj (obj, name, &s->ipi[i], +sizeof (XlnxZynqMPIPI),TYPE_XLNX_ZYNQMP_IPI ); +g_free (name); + } +} + +static void xlnx_zynqmp_pmu_soc_realize (DeviceState *dev,Error **errp) +{ +XlnxZynqMPPMUSoCState *s =XLNX_ZYNQMP_PMU_SOC (dev); +Error *err =NULL ; + +object_property_set_bool (OBJECT (&s->cpu), true,"realized" , &err); +if (err) { +error_propagate (errp, err); +return ; + } +object_property_set_bool (OBJECT (&s->intc), true,"realized" , &err);if (err) {error_propagate (errp, err);
Signature · 1 line
2.21.1
PATCH v2 18/54 hw/pci-host/pnv_phb3: Move some code from realize() to init()
In reply to Philippe Mathieu-DaudéCoccinelle reported:
$ spatch ... --timeout 60 --sp-file \
scripts/coccinelle/simplify-init-realize-error_propagate.cocci
HANDLING: ./hw/pci-host/pnv_phb3.cQuoted 1 line
Quoted 1 line
Quoted 1 line
possible moves from
pnv_phb3_instance_init()topnv_phb3_realize()in./hw/pci-host/pnv_phb3.c:992
Move the calls using &error_abort which don't depend of input updated before realize() to init().
--- hw/pci-host/pnv_phb3.c | 8 ++++---- 1 file changed, 4 insertions(+), 4 deletions(-)
hw/pci-host/pnv_phb3.c +4 -4
@@ -970,6 +970,8 @@ static void pnv_phb3_instance_init(Object *obj)/* LSI sources */ object_initialize_child (obj,"lsi" , &phb->lsis,sizeof (phb->lsis),TYPE_ICS , &error_abort,NULL ); +object_property_set_int (OBJECT (&phb->lsis),PNV_PHB3_NUM_LSI ,"nr-irqs" , + &error_abort);/* Default init ... will be fixed by HW inits */ phb->lsis.offset =0 ;
@@ -977,6 +979,8 @@ static void pnv_phb3_instance_init(Object *obj)/* MSI sources */ object_initialize_child (obj,"msi" , &phb->msis,sizeof (phb->msis),TYPE_PHB3_MSI , &error_abort,NULL ); +object_property_set_int (OBJECT (&phb->msis),PHB3_MAX_MSI ,"nr-irqs" , + &error_abort);/* Power Bus Common Queue */ object_initialize_child(obj, "pbcq", &phb->pbcq, sizeof(phb->pbcq),
@@ -1005,8 +1009,6 @@ static void pnv_phb3_realize(DeviceState *dev, Error **errp)/* LSI sources */ object_property_set_link (OBJECT (&phb->lsis),OBJECT (pnv),"xics" , &error_abort); -object_property_set_int (OBJECT (&phb->lsis),PNV_PHB3_NUM_LSI ,"nr-irqs" , - &error_abort);object_property_set_bool (OBJECT (&phb->lsis), true,"realized" , &local_err);if (local_err) {error_propagate (errp, local_err);
@@ -1024,8 +1026,6 @@ static void pnv_phb3_realize(DeviceState *dev, Error **errp) &error_abort);object_property_set_link (OBJECT (&phb->msis),OBJECT (pnv),"xics" , &error_abort); -object_property_set_int (OBJECT (&phb->msis),PHB3_MAX_MSI ,"nr-irqs" , - &error_abort);object_property_set_bool (OBJECT (&phb->msis), true,"realized" , &local_err);if (local_err) {error_propagate (errp, local_err);
Signature · 1 line
2.21.1
PATCH v2 19/54 hw/riscv/sifive_e: Move some code from realize() to init()
In reply to Philippe Mathieu-DaudéCoccinelle reported:
$ spatch ... --timeout 60 --sp-file \
scripts/coccinelle/simplify-init-realize-error_propagate.cocci
HANDLING: ./hw/riscv/sifive_e.cQuoted 1 line
Quoted 1 line
Quoted 1 line
possible moves from
riscv_sifive_e_soc_init()toriscv_sifive_e_soc_realize()in./hw/riscv/sifive_e.c:135
Move the calls using &error_fatal which don't depend of input updated before realize() to init().
--- hw/riscv/sifive_e.c | 26 ++++++++++++++------------ 1 file changed, 14 insertions(+), 12 deletions(-)
hw/riscv/sifive_e.c +14 -12
@@ -118,7 +118,9 @@ static void riscv_sifive_e_init(MachineState *machine)static void riscv_sifive_e_soc_init (Object *obj) {MachineState *ms =MACHINE (qdev_get_machine ()); +const struct MemmapEntry *memmap = sifive_e_memmap;SiFiveESoCState *s =RISCV_E_SOC (obj); +MemoryRegion *sys_mem =get_system_memory (); object_initialize_child(obj, "cpus", &s->cpus, sizeof(s->cpus), TYPE_RISCV_HART_ARRAY,
@@ -130,6 +132,18 @@ static void riscv_sifive_e_soc_init(Object *obj)sysbus_init_child_obj (obj,"riscv.sifive.e.gpio0" , &s->gpio,sizeof (s->gpio),TYPE_SIFIVE_GPIO ); + +/* Mask ROM */ +memory_region_init_rom (&s->mask_rom, obj,"riscv.sifive.e.mrom" , + memmap[SIFIVE_E_MROM ].size, &error_fatal); +memory_region_add_subregion (sys_mem, + memmap[SIFIVE_E_MROM ].base, &s->mask_rom); + +/* Flash memory */ +memory_region_init_rom (&s->xip_mem, obj,"riscv.sifive.e.xip" , + memmap[SIFIVE_E_XIP ].size, &error_fatal); +memory_region_add_subregion (sys_mem, memmap[SIFIVE_E_XIP ].base, + &s->xip_mem); }static void riscv_sifive_e_soc_realize (DeviceState *dev,Error **errp)
@@ -144,12 +158,6 @@ static void riscv_sifive_e_soc_realize(DeviceState *dev, Error **errp)object_property_set_bool (OBJECT (&s->cpus), true,"realized" , &error_abort); -/* Mask ROM */ -memory_region_init_rom (&s->mask_rom,OBJECT (dev),"riscv.sifive.e.mrom" , - memmap[SIFIVE_E_MROM ].size, &error_fatal); -memory_region_add_subregion (sys_mem, - memmap[SIFIVE_E_MROM ].base, &s->mask_rom); -/* MMIO */ s->plic = sifive_plic_create(memmap[SIFIVE_E_PLIC].base, (char *)SIFIVE_E_PLIC_HART_CONFIG,
@@ -206,12 +214,6 @@ static void riscv_sifive_e_soc_realize(DeviceState *dev, Error **errp) memmap[SIFIVE_E_QSPI2].base, memmap[SIFIVE_E_QSPI2].size);create_unimplemented_device ("riscv.sifive.e.pwm2" , memmap[SIFIVE_E_PWM2 ].base, memmap[SIFIVE_E_PWM2 ].size); - -/* Flash memory */ -memory_region_init_rom (&s->xip_mem,OBJECT (dev),"riscv.sifive.e.xip" , - memmap[SIFIVE_E_XIP ].size, &error_fatal); -memory_region_add_subregion (sys_mem, memmap[SIFIVE_E_XIP ].base, - &s->xip_mem); }static void riscv_sifive_e_machine_init (MachineClass *mc)
Signature · 1 line
2.21.1
PATCH v2 20/54 hw/riscv/sifive_u: Use single type_init()
In reply to Philippe Mathieu-DaudéWe can use a single type_init() to call multiple type_register*().
--- hw/riscv/sifive_u.c | 12 +++--------- 1 file changed, 3 insertions(+), 9 deletions(-)
hw/riscv/sifive_u.c +3 -9
@@ -601,13 +601,6 @@ static const TypeInfo riscv_sifive_u_soc_type_info = { .class_init = riscv_sifive_u_soc_class_init, }; -static void riscv_sifive_u_soc_register_types (void ) -{ -type_register_static (&riscv_sifive_u_soc_type_info); -} - -type_init (riscv_sifive_u_soc_register_types) -static void riscv_sifive_u_machine_class_init (ObjectClass *oc,void *data) {MachineClass *mc =MACHINE_CLASS (oc);
@@ -627,9 +620,10 @@ static const TypeInfo riscv_sifive_u_machine_typeinfo = { .instance_size = sizeof(SiFiveUState), }; -static void riscv_sifive_u_machine_init_register_types (void ) +static void riscv_sifive_u_register_types (void ) { +type_register_static (&riscv_sifive_u_soc_type_info);type_register_static (&riscv_sifive_u_machine_typeinfo); } -type_init (riscv_sifive_u_machine_init_register_types) +type_init (riscv_sifive_u_register_types)
Signature · 1 line
2.21.1
PATCH v2 21/54 hw/riscv/sifive_u: Move some code from realize() to init()
In reply to Philippe Mathieu-DaudéCoccinelle reported:
$ spatch ... --timeout 60 --sp-file \
scripts/coccinelle/simplify-init-realize-error_propagate.cocci
HANDLING: ./hw/riscv/sifive_u.cQuoted 1 line
Quoted 1 line
Quoted 1 line
possible moves from
riscv_sifive_u_soc_init()toriscv_sifive_u_soc_realize()in./hw/riscv/sifive_u.c:473
Move the calls using &error_abort which don't depend of input updated before realize() to init().
--- hw/riscv/sifive_u.c | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-)
hw/riscv/sifive_u.c +2 -2
@@ -441,6 +441,8 @@ static void riscv_sifive_u_soc_init(Object *obj)qdev_prop_set_uint32 (DEVICE (&s->otp),"serial" ,OTP_SERIAL );sysbus_init_child_obj (obj,"gem" , &s->gem,sizeof (s->gem),TYPE_CADENCE_GEM ); +object_property_set_int (OBJECT (&s->gem),GEM_REVISION ,"revision" , + &error_abort); }static bool sifive_u_get_start_in_flash (Object *obj,Error **errp)
@@ -569,8 +571,6 @@ static void riscv_sifive_u_soc_realize(DeviceState *dev, Error **errp)qemu_check_nic_model (nd,TYPE_CADENCE_GEM );qdev_set_nic_properties (DEVICE (&s->gem), nd); } -object_property_set_int (OBJECT (&s->gem),GEM_REVISION ,"revision" , - &error_abort);object_property_set_bool (OBJECT (&s->gem), true,"realized" , &err);if (err) {error_propagate (errp, err);
Signature · 1 line
2.21.1
PATCH v2 22/54 hw/riscv/sifive_u: Store MemoryRegion in SiFiveUSoCState
In reply to Philippe Mathieu-DaudéCoccinelle reported:
$ spatch ... --timeout 60 --sp-file \
scripts/coccinelle/simplify-init-realize-error_propagate.cocci
HANDLING: ./hw/riscv/sifive_u.cQuoted 1 line
Quoted 1 line
Quoted 1 line
possible moves from
riscv_sifive_u_soc_init()toriscv_sifive_u_soc_realize()in./hw/riscv/sifive_u.c:473
While reviewing we notice storing the MemoryRegion in the device state, we'll be able to later automatically simplify the error propagation calls.
--- include/hw/riscv/sifive_u.h | 2 ++ hw/riscv/sifive_u.c | 10 ++++------ 2 files changed, 6 insertions(+), 6 deletions(-)
include/hw/riscv/sifive_u.h +2 -0
@@ -42,6 +42,8 @@ typedef struct SiFiveUSoCState {SiFiveUPRCIState prci;SiFiveUOTPState otp;CadenceGEMState gem; +MemoryRegion mask_rom; +MemoryRegion l2lim_mem; } SiFiveUSoCState;#define TYPE_RISCV_U_MACHINE MACHINE_TYPE_NAME("sifive_u")
hw/riscv/sifive_u.c +4 -6
@@ -478,8 +478,6 @@ static void riscv_sifive_u_soc_realize(DeviceState *dev, Error **errp)SiFiveUSoCState *s =RISCV_U_SOC (dev);const struct MemmapEntry *memmap = sifive_u_memmap;MemoryRegion *system_memory =get_system_memory (); -MemoryRegion *mask_rom =g_new (MemoryRegion,1 ); -MemoryRegion *l2lim_mem =g_new (MemoryRegion,1 );qemu_irq plic_gpios[SIFIVE_U_PLIC_NUM_SOURCES ];char *plic_hart_config;size_t plic_hart_config_len;
@@ -503,10 +501,10 @@ static void riscv_sifive_u_soc_realize(DeviceState *dev, Error **errp) &error_abort);/* boot rom */ -memory_region_init_rom (mask_rom,OBJECT (dev),"riscv.sifive.u.mrom" , +memory_region_init_rom (&s->mask_rom,OBJECT (dev),"riscv.sifive.u.mrom" , memmap[SIFIVE_U_MROM ].size, &error_fatal);memory_region_add_subregion (system_memory, memmap[SIFIVE_U_MROM ].base, - mask_rom); + &s->mask_rom);/* * Add L2-LIM at reset size.
@@ -517,10 +515,10 @@ static void riscv_sifive_u_soc_realize(DeviceState *dev, Error **errp)* leave it enabled all the time. This won't break anything, but will be * too generous to misbehaving guests. */ -memory_region_init_ram (l2lim_mem,NULL ,"riscv.sifive.u.l2lim" , +memory_region_init_ram (&s->l2lim_mem,NULL ,"riscv.sifive.u.l2lim" , memmap[SIFIVE_U_L2LIM ].size, &error_fatal);memory_region_add_subregion (system_memory, memmap[SIFIVE_U_L2LIM ].base, - l2lim_mem); + &s->l2lim_mem);/* create PLIC hart topology configuration string */ plic_hart_config_len = (strlen(SIFIVE_U_PLIC_HART_CONFIG) + 1) *
Signature · 1 line
2.21.1
PATCH v2 23/54 hw/riscv/sifive_u: Move some code from realize() to init()
In reply to Philippe Mathieu-DaudéCoccinelle reported:
$ spatch ... --timeout 60 --sp-file \
scripts/coccinelle/simplify-init-realize-error_propagate.cocci
HANDLING: ./hw/riscv/sifive_u.cQuoted 1 line
Quoted 1 line
Quoted 1 line
possible moves from
riscv_sifive_u_soc_init()toriscv_sifive_u_soc_realize()in./hw/riscv/sifive_u.c:473
Move the calls using &error_abort which don't depend of input updated before realize() to init().
--- hw/riscv/sifive_u.c | 42 ++++++++++++++++++++++-------------------- 1 file changed, 22 insertions(+), 20 deletions(-)
hw/riscv/sifive_u.c +22 -20
@@ -406,6 +406,8 @@ static void riscv_sifive_u_init(MachineState *machine)static void riscv_sifive_u_soc_init (Object *obj) {MachineState *ms =MACHINE (qdev_get_machine ()); +const struct MemmapEntry *memmap = sifive_u_memmap; +MemoryRegion *system_memory =get_system_memory ();SiFiveUSoCState *s =RISCV_U_SOC (obj); object_initialize_child(obj, "e-cluster", &s->e_cluster,
@@ -443,6 +445,26 @@ static void riscv_sifive_u_soc_init(Object *obj) TYPE_CADENCE_GEM);object_property_set_int (OBJECT (&s->gem),GEM_REVISION ,"revision" , &error_abort); + +/* boot rom */ +memory_region_init_rom (&s->mask_rom, obj,"riscv.sifive.u.mrom" , + memmap[SIFIVE_U_MROM ].size, &error_fatal); +memory_region_add_subregion (system_memory, memmap[SIFIVE_U_MROM ].base, + &s->mask_rom); + +/* +* Add L2-LIM at reset size. +* This should be reduced in size as the L2 Cache Controller WayEnable +* register is incremented. Unfortunately I don't see a nice (or any) way +* to handle reducing or blocking out the L2 LIM while still allowing it +* be re returned to all enabled after a reset. For the time being, just +* leave it enabled all the time. This won't break anything, but will be +* too generous to misbehaving guests. +*/ +memory_region_init_ram (&s->l2lim_mem,NULL ,"riscv.sifive.u.l2lim" , + memmap[SIFIVE_U_L2LIM ].size, &error_fatal); +memory_region_add_subregion (system_memory, memmap[SIFIVE_U_L2LIM ].base, + &s->l2lim_mem); }static bool sifive_u_get_start_in_flash (Object *obj,Error **errp)
@@ -500,26 +522,6 @@ static void riscv_sifive_u_soc_realize(DeviceState *dev, Error **errp)object_property_set_bool (OBJECT (&s->u_cluster), true,"realized" , &error_abort); -/* boot rom */ -memory_region_init_rom (&s->mask_rom,OBJECT (dev),"riscv.sifive.u.mrom" , - memmap[SIFIVE_U_MROM ].size, &error_fatal); -memory_region_add_subregion (system_memory, memmap[SIFIVE_U_MROM ].base, - &s->mask_rom); - -/* -* Add L2-LIM at reset size. -* This should be reduced in size as the L2 Cache Controller WayEnable -* register is incremented. Unfortunately I don't see a nice (or any) way -* to handle reducing or blocking out the L2 LIM while still allowing it -* be re returned to all enabled after a reset. For the time being, just -* leave it enabled all the time. This won't break anything, but will be -* too generous to misbehaving guests. -*/ -memory_region_init_ram (&s->l2lim_mem,NULL ,"riscv.sifive.u.l2lim" , - memmap[SIFIVE_U_L2LIM ].size, &error_fatal); -memory_region_add_subregion (system_memory, memmap[SIFIVE_U_L2LIM ].base, - &s->l2lim_mem); -/* create PLIC hart topology configuration string */ plic_hart_config_len = (strlen (SIFIVE_U_PLIC_HART_CONFIG ) +1 ) * ms->smp.cpus;
Signature · 1 line
2.21.1
PATCH v2 24/54 hw/riscv/sifive_u: Rename MachineClass::init()
In reply to Philippe Mathieu-DaudéAs there already is the riscv_sifive_u_soc_init() method, rename riscv_sifive_u_init() as riscv_sifive_u_machine_init().
--- hw/riscv/sifive_u.c | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-)
hw/riscv/sifive_u.c +2 -2
@@ -312,7 +312,7 @@ static void create_fdt(SiFiveUState *s, const struct MemmapEntry *memmap,g_free (nodename); } -static void riscv_sifive_u_init (MachineState *machine) +static void riscv_sifive_u_machine_init (MachineState *machine) {const struct MemmapEntry *memmap = sifive_u_memmap;SiFiveUState *s =RISCV_U_MACHINE (machine);
@@ -606,7 +606,7 @@ static void riscv_sifive_u_machine_class_init(ObjectClass *oc, void *data)MachineClass *mc =MACHINE_CLASS (oc); mc->desc ="RISC-V Board compatible with SiFive U SDK" ; - mc->init = riscv_sifive_u_init; + mc->init = riscv_sifive_u_machine_init; mc->max_cpus =SIFIVE_U_MANAGEMENT_CPU_COUNT +SIFIVE_U_COMPUTE_CPU_COUNT ; mc->min_cpus =SIFIVE_U_MANAGEMENT_CPU_COUNT +1 ; mc->default_cpus = mc->min_cpus;
Signature · 1 line
2.21.1
PATCH v2 25/54 scripts/coccinelle: Catch missing error_propagate() calls in realize()
In reply to Philippe Mathieu-DaudéIn some DeviceClass::realize() while we can propagate errors to the caller, we forgot to do so. Add a Coccinelle patch to automatically add the missing code.
--- .../use-error_propagate-in-realize.cocci | 54 +++++++++++++++++++ MAINTAINERS | 1 + 2 files changed, 55 insertions(+) create mode 100644 scripts/coccinelle/use-error_propagate-in-realize.cocci
scripts/coccinelle/use-error_propagate-in-realize.cocci new file +54 -0
@@ -0,0 +1,54 @@ +// Add missing error-propagation code in DeviceClass::realize() +// +// Copyright: (C) 2020 Philippe Mathieu-Daudé +// This work is licensed under the terms of the GNU GPLv2 or later. +// +// spatch \ +// --macro-file scripts/cocci-macro-file.h --include-headers \ +// --sp-file scripts/coccinelle/use-error_abort-in-instance_init.cocci \ +// --keep-comments --timeout 60 --in-place +// +// Inspired by https://www.mail-archive.com/[email protected]/msg691638.html + + +@ match_class_init @ +TypeInfo info; +identifier class_initfn; +@@ + info.class_init = class_initfn; + + +@ match_realize @ +identifier match_class_init.class_initfn; +DeviceClass *dc; +identifier realizefn; +@@ +void class_initfn(...) +{ + ... + dc->realize = realizefn; + ... +} + + +@ propagate_in_realize @ +identifier match_realize.realizefn; +identifier err; +identifier errp; +identifier func_with_errp; +symbol error_abort, error_fatal; +@@ +void realizefn(..., Error **errp) +{ + ... + Error *err = NULL; + <+... + func_with_errp(..., +- \(&error_abort\|&error_fatal\)); ++ &err); ++ if (err) { ++ error_propagate(errp, err); ++ return; ++ } + ...+> +}
MAINTAINERS +1 -0
@@ -2059,6 +2059,7 @@ F: scripts/coccinelle/error_propagate_null.cocci F: scripts/coccinelle/remove_local_err.cocci F: scripts/coccinelle/simplify-init-realize-error_propagate.cocci F: scripts/coccinelle/use-error_fatal.cocci +F: scripts/coccinelle/use-error_propagate-in-realize.cocci GDB stub M: Alex Bennée <[email protected]>
Signature · 1 line
2.21.1
PATCH v2 26/54 hw/arm/fsl-imx: Add missing error-propagation code
In reply to Philippe Mathieu-DaudéPatch created mechanically by running:
$ spatch \
--macro-file scripts/cocci-macro-file.h --include-headers \
--sp-file scripts/coccinelle/use-error_propagate-in-realize.cocci \
--keep-comments --smpl-spacing --in-place --dir hw--- hw/arm/fsl-imx25.c | 6 +++++- hw/arm/fsl-imx6.c | 18 +++++++++++++++--- 2 files changed, 20 insertions(+), 4 deletions(-)
hw/arm/fsl-imx25.c +5 -1
@@ -295,7 +295,11 @@ static void fsl_imx25_realize(DeviceState *dev, Error **errp) };object_property_set_bool (OBJECT (&s->usb[i]), true,"realized" , - &error_abort); + &err); +if (err) { +error_propagate (errp, err); +return ; + }sysbus_mmio_map (SYS_BUS_DEVICE (&s->usb[i]),0 , usb_table[i].addr); sysbus_connect_irq(SYS_BUS_DEVICE(&s->usb[i]), 0, qdev_get_gpio_in(DEVICE(&s->avic),
hw/arm/fsl-imx6.c +15 -3
@@ -359,7 +359,11 @@ static void fsl_imx6_realize(DeviceState *dev, Error **errp)/* USB */ for (i =0 ; i <FSL_IMX6_NUM_USB_PHYS ; i++) {object_property_set_bool (OBJECT (&s->usbphy[i]), true,"realized" , - &error_abort); + &err); +if (err) { +error_propagate (errp, err); +return ; + }sysbus_mmio_map (SYS_BUS_DEVICE (&s->usbphy[i]),0 ,FSL_IMX6_USBPHY1_ADDR + i *0x1000 ); }
@@ -372,7 +376,11 @@ static void fsl_imx6_realize(DeviceState *dev, Error **errp) };object_property_set_bool (OBJECT (&s->usb[i]), true,"realized" , - &error_abort); + &err); +if (err) { +error_propagate (errp, err); +return ; + }sysbus_mmio_map (SYS_BUS_DEVICE (&s->usb[i]),0 ,FSL_IMX6_USBOH3_USB_ADDR + i *0x200 ); sysbus_connect_irq(SYS_BUS_DEVICE(&s->usb[i]), 0,
@@ -430,7 +438,11 @@ static void fsl_imx6_realize(DeviceState *dev, Error **errp) };object_property_set_bool (OBJECT (&s->wdt[i]), true,"realized" , - &error_abort); + &err); +if (err) { +error_propagate (errp, err); +return ; + }sysbus_mmio_map (SYS_BUS_DEVICE (&s->wdt[i]),0 , FSL_IMX6_WDOGn_ADDR[i]); }
Signature · 1 line
2.21.1
PATCH v2 27/54 hw/arm/stm32f*05_soc: Add missing error-propagation code
In reply to Philippe Mathieu-DaudéPatch created mechanically by running:
$ spatch \
--macro-file scripts/cocci-macro-file.h --include-headers \
--sp-file scripts/coccinelle/use-error_propagate-in-realize.cocci \
--keep-comments --smpl-spacing --in-place --dir hw--- hw/arm/stm32f205_soc.c | 6 +++++- hw/arm/stm32f405_soc.c | 6 +++++- 2 files changed, 10 insertions(+), 2 deletions(-)
hw/arm/stm32f205_soc.c +5 -1
@@ -106,7 +106,11 @@ static void stm32f205_soc_realize(DeviceState *dev_soc, Error **errp)qdev_prop_set_string (armv7m,"cpu-type" , s->cpu_type);qdev_prop_set_bit (armv7m,"enable-bitband" , true);object_property_set_link (OBJECT (&s->armv7m),OBJECT (get_system_memory ()), -"memory" , &error_abort); +"memory" , &err); +if (err) { +error_propagate (errp, err); +return ; + }object_property_set_bool (OBJECT (&s->armv7m), true,"realized" , &err);if (err !=NULL ) {error_propagate (errp, err);
hw/arm/stm32f405_soc.c +5 -1
@@ -121,7 +121,11 @@ static void stm32f405_soc_realize(DeviceState *dev_soc, Error **errp)qdev_prop_set_string (armv7m,"cpu-type" , s->cpu_type);qdev_prop_set_bit (armv7m,"enable-bitband" , true);object_property_set_link (OBJECT (&s->armv7m),OBJECT (system_memory), -"memory" , &error_abort); +"memory" , &err); +if (err) { +error_propagate (errp, err); +return ; + }object_property_set_bool (OBJECT (&s->armv7m), true,"realized" , &err);if (err !=NULL ) {error_propagate (errp, err);
Signature · 1 line
2.21.1
PATCH v2 28/54 hw/arm/aspeed: Add missing error-propagation code
In reply to Philippe Mathieu-DaudéPatch created mechanically by running:
$ spatch \
--macro-file scripts/cocci-macro-file.h --include-headers \
--sp-file scripts/coccinelle/use-error_propagate-in-realize.cocci \
--keep-comments --smpl-spacing --in-place --dir hw--- hw/arm/aspeed_ast2600.c | 36 ++++++++++++++++++++++++++++++------ hw/arm/aspeed_soc.c | 12 ++++++++++-- 2 files changed, 40 insertions(+), 8 deletions(-)
hw/arm/aspeed_ast2600.c +30 -6
@@ -277,7 +277,11 @@ static void aspeed_soc_ast2600_realize(DeviceState *dev, Error **errp)if (s->num_cpus >1 ) {object_property_set_int (OBJECT (&s->cpu[i]),ASPEED_A7MPCORE_ADDR , -"reset-cbar" , &error_abort); +"reset-cbar" , &err); +if (err) { +error_propagate (errp, err); +return ; + } }/* * TODO: the secondary CPUs are started and a boot helper
@@ -293,10 +297,18 @@ static void aspeed_soc_ast2600_realize(DeviceState *dev, Error **errp)/* A7MPCORE */ object_property_set_int (OBJECT (&s->a7mpcore), s->num_cpus,"num-cpu" , - &error_abort); + &err); +if (err) { +error_propagate (errp, err); +return ; + }object_property_set_bool (OBJECT (&s->a7mpcore), true,"realized" , - &error_abort); + &err); +if (err) { +error_propagate (errp, err); +return ; + }sysbus_mmio_map (SYS_BUS_DEVICE (&s->a7mpcore),0 ,ASPEED_A7MPCORE_ADDR );for (i =0 ; i < s->num_cpus; i++) {
@@ -343,7 +355,11 @@ static void aspeed_soc_ast2600_realize(DeviceState *dev, Error **errp)/* Timer */ object_property_set_link (OBJECT (&s->timerctrl), -OBJECT (&s->scu),"scu" , &error_abort); +OBJECT (&s->scu),"scu" , &err); +if (err) { +error_propagate (errp, err); +return ; + }object_property_set_bool (OBJECT (&s->timerctrl), true,"realized" , &err);if (err) {error_propagate (errp, err);
@@ -459,7 +475,11 @@ static void aspeed_soc_ast2600_realize(DeviceState *dev, Error **errp)AspeedWDTClass *awc =ASPEED_WDT_GET_CLASS (&s->wdt[i]);object_property_set_link (OBJECT (&s->wdt[i]), -OBJECT (&s->scu),"scu" , &error_abort); +OBJECT (&s->scu),"scu" , &err); +if (err) { +error_propagate (errp, err); +return ; + }object_property_set_bool (OBJECT (&s->wdt[i]), true,"realized" , &err);if (err) {error_propagate (errp, err);
@@ -490,7 +510,11 @@ static void aspeed_soc_ast2600_realize(DeviceState *dev, Error **errp) aspeed_soc_get_irq(s, ASPEED_ETH1 + i));object_property_set_link (OBJECT (&s->mii[i]),OBJECT (&s->ftgmac100[i]), -"nic" , &error_abort); +"nic" , &err); +if (err) { +error_propagate (errp, err); +return ; + }object_property_set_bool (OBJECT (&s->mii[i]), true,"realized" , &err);if (err) {
hw/arm/aspeed_soc.c +10 -2
@@ -301,7 +301,11 @@ static void aspeed_soc_realize(DeviceState *dev, Error **errp)/* Timer */ object_property_set_link (OBJECT (&s->timerctrl), -OBJECT (&s->scu),"scu" , &error_abort); +OBJECT (&s->scu),"scu" , &err); +if (err) { +error_propagate (errp, err); +return ; + }object_property_set_bool (OBJECT (&s->timerctrl), true,"realized" , &err);if (err) {error_propagate (errp, err);
@@ -398,7 +402,11 @@ static void aspeed_soc_realize(DeviceState *dev, Error **errp)AspeedWDTClass *awc =ASPEED_WDT_GET_CLASS (&s->wdt[i]);object_property_set_link (OBJECT (&s->wdt[i]), -OBJECT (&s->scu),"scu" , &error_abort); +OBJECT (&s->scu),"scu" , &err); +if (err) { +error_propagate (errp, err); +return ; + }object_property_set_bool (OBJECT (&s->wdt[i]), true,"realized" , &err);if (err) {error_propagate (errp, err);
Signature · 1 line
2.21.1
Re: [PATCH-for-5.1 v2 28/54] hw/arm/aspeed: Add missing error-propagation code
Quoted 8 lines · Philippe Mathieu-Daudé
Patch created mechanically by running:
$ spatch \ --macro-file scripts/cocci-macro-file.h --include-headers \ --sp-file scripts/coccinelle/use-error_propagate-in-realize.cocci \ --keep-comments --smpl-spacing --in-place --dir hwSigned-off-by Philippe Mathieu-Daudé <[email protected]>
The 'return' are correct this time.
Thanks,
C.
Quoted 113 lines
--- hw/arm/aspeed_ast2600.c | 36 ++++++++++++++++++++++++++++++------ hw/arm/aspeed_soc.c | 12 ++++++++++-- 2 files changed, 40 insertions(+), 8 deletions(-)hw/arm/aspeed_ast2600.c +30
-6@@ -277,7 +277,11 @@ static void aspeed_soc_ast2600_realize(DeviceState *dev, Error **errp)if (s->num_cpus >1 ) {object_property_set_int (OBJECT (&s->cpu[i]),ASPEED_A7MPCORE_ADDR , -"reset-cbar" , &error_abort); +"reset-cbar" , &err); +if (err) { +error_propagate (errp, err); +return ; + } }/* * TODO: the secondary CPUs are started and a boot helper @@ -293,10 +297,18 @@ static void aspeed_soc_ast2600_realize(DeviceState *dev, Error **errp)/* A7MPCORE */ object_property_set_int (OBJECT (&s->a7mpcore), s->num_cpus,"num-cpu" , - &error_abort); + &err); +if (err) { +error_propagate (errp, err); +return ; + }object_property_set_bool (OBJECT (&s->a7mpcore), true,"realized" , - &error_abort); + &err); +if (err) { +error_propagate (errp, err); +return ; + }sysbus_mmio_map (SYS_BUS_DEVICE (&s->a7mpcore),0 ,ASPEED_A7MPCORE_ADDR );for (i =0 ; i < s->num_cpus; i++) {@@ -343,7 +355,11 @@ static void aspeed_soc_ast2600_realize(DeviceState *dev, Error **errp)/* Timer */ object_property_set_link (OBJECT (&s->timerctrl), -OBJECT (&s->scu),"scu" , &error_abort); +OBJECT (&s->scu),"scu" , &err); +if (err) { +error_propagate (errp, err); +return ; + }object_property_set_bool (OBJECT (&s->timerctrl), true,"realized" , &err);if (err) {error_propagate (errp, err);@@ -459,7 +475,11 @@ static void aspeed_soc_ast2600_realize(DeviceState *dev, Error **errp)AspeedWDTClass *awc =ASPEED_WDT_GET_CLASS (&s->wdt[i]);object_property_set_link (OBJECT (&s->wdt[i]), -OBJECT (&s->scu),"scu" , &error_abort); +OBJECT (&s->scu),"scu" , &err); +if (err) { +error_propagate (errp, err); +return ; + }object_property_set_bool (OBJECT (&s->wdt[i]), true,"realized" , &err);if (err) {error_propagate (errp, err);@@ -490,7 +510,11 @@ static void aspeed_soc_ast2600_realize(DeviceState *dev, Error **errp) aspeed_soc_get_irq(s, ASPEED_ETH1 + i));object_property_set_link (OBJECT (&s->mii[i]),OBJECT (&s->ftgmac100[i]), -"nic" , &error_abort); +"nic" , &err); +if (err) { +error_propagate (errp, err); +return ; + }object_property_set_bool (OBJECT (&s->mii[i]), true,"realized" , &err);if (err) {hw/arm/aspeed_soc.c +10
-2@@ -301,7 +301,11 @@ static void aspeed_soc_realize(DeviceState *dev, Error **errp)/* Timer */ object_property_set_link (OBJECT (&s->timerctrl), -OBJECT (&s->scu),"scu" , &error_abort); +OBJECT (&s->scu),"scu" , &err); +if (err) { +error_propagate (errp, err); +return ; + }object_property_set_bool (OBJECT (&s->timerctrl), true,"realized" , &err);if (err) {error_propagate (errp, err);@@ -398,7 +402,11 @@ static void aspeed_soc_realize(DeviceState *dev, Error **errp)AspeedWDTClass *awc =ASPEED_WDT_GET_CLASS (&s->wdt[i]);object_property_set_link (OBJECT (&s->wdt[i]), -OBJECT (&s->scu),"scu" , &error_abort); +OBJECT (&s->scu),"scu" , &err); +if (err) { +error_propagate (errp, err); +return ; + }object_property_set_bool (OBJECT (&s->wdt[i]), true,"realized" , &err);if (err) {error_propagate (errp, err);
PATCH v2 29/54 hw/arm/allwinner-a10: Add missing error-propagation code
In reply to Philippe Mathieu-DaudéPatch created mechanically by running:
$ spatch \
--macro-file scripts/cocci-macro-file.h --include-headers \
--sp-file scripts/coccinelle/use-error_propagate-in-realize.cocci \
--keep-comments --smpl-spacing --in-place --dir hw--- hw/arm/allwinner-a10.c | 18 +++++++++++++++--- 1 file changed, 15 insertions(+), 3 deletions(-)
hw/arm/allwinner-a10.c +15 -3
@@ -158,14 +158,22 @@ static void aw_a10_realize(DeviceState *dev, Error **errp)for (i =0 ; i <AW_A10_NUM_USB ; i++) {object_property_set_bool (OBJECT (&s->ehci[i]), true,"realized" , - &error_fatal); + &err); +if (err) { +error_propagate (errp, err); +return ; + }sysbus_mmio_map (SYS_BUS_DEVICE (&s->ehci[i]),0 ,AW_A10_EHCI_BASE + i *0x8000 );sysbus_connect_irq (SYS_BUS_DEVICE (&s->ehci[i]),0 ,qdev_get_gpio_in (dev,39 + i));object_property_set_bool (OBJECT (&s->ohci[i]), true,"realized" , - &error_fatal); + &err); +if (err) { +error_propagate (errp, err); +return ; + }sysbus_mmio_map (SYS_BUS_DEVICE (&s->ohci[i]),0 ,AW_A10_OHCI_BASE + i *0x8000 ); sysbus_connect_irq(SYS_BUS_DEVICE(&s->ohci[i]), 0,
@@ -178,7 +186,11 @@ static void aw_a10_realize(DeviceState *dev, Error **errp)sysbus_mmio_map (SYS_BUS_DEVICE (&s->mmc0),0 ,AW_A10_MMC0_BASE );sysbus_connect_irq (SYS_BUS_DEVICE (&s->mmc0),0 ,qdev_get_gpio_in (dev,32 ));object_property_add_alias (OBJECT (s),"sd-bus" ,OBJECT (&s->mmc0), -"sd-bus" , &error_abort); +"sd-bus" , &err); +if (err) { +error_propagate (errp, err); +return ; + }/* RTC */ qdev_init_nofail (DEVICE (&s->rtc));
Signature · 1 line
2.21.1
PATCH v2 30/54 hw/arm/msf2-soc: Add missing error-propagation code
In reply to Philippe Mathieu-DaudéPatch created mechanically by running:
$ spatch \
--macro-file scripts/cocci-macro-file.h --include-headers \
--sp-file scripts/coccinelle/use-error_propagate-in-realize.cocci \
--keep-comments --smpl-spacing --in-place --dir hw--- hw/arm/msf2-soc.c | 24 ++++++++++++++++++++---- 1 file changed, 20 insertions(+), 4 deletions(-)
hw/arm/msf2-soc.c +20 -4
@@ -93,7 +93,11 @@ static void m2sxxx_soc_realize(DeviceState *dev_soc, Error **errp)MemoryRegion *system_memory =get_system_memory ();memory_region_init_rom (&s->nvm,OBJECT (dev_soc),"MSF2.eNVM" , s->envm_size, - &error_fatal); + &err); +if (err) { +error_propagate (errp, err); +return ; + }/* * On power-on, the eNVM region 0x60000000 is automatically * remapped to the Cortex-M3 processor executable region
@@ -107,7 +111,11 @@ static void m2sxxx_soc_realize(DeviceState *dev_soc, Error **errp)memory_region_add_subregion (system_memory,0 , &s->nvm_alias);memory_region_init_ram (&s->sram,NULL ,"MSF2.eSRAM" , s->esram_size, - &error_fatal); + &err); +if (err) { +error_propagate (errp, err); +return ; + }memory_region_add_subregion (system_memory,SRAM_BASE_ADDRESS , &s->sram); armv7m =DEVICE (&s->armv7m);
@@ -115,7 +123,11 @@ static void m2sxxx_soc_realize(DeviceState *dev_soc, Error **errp)qdev_prop_set_string (armv7m,"cpu-type" , s->cpu_type);qdev_prop_set_bit (armv7m,"enable-bitband" , true);object_property_set_link (OBJECT (&s->armv7m),OBJECT (get_system_memory ()), -"memory" , &error_abort); +"memory" , &err); +if (err) { +error_propagate (errp, err); +return ; + }object_property_set_bool (OBJECT (&s->armv7m), true,"realized" , &err);if (err !=NULL ) {error_propagate (errp, err);
@@ -184,8 +196,12 @@ static void m2sxxx_soc_realize(DeviceState *dev_soc, Error **errp) bus_name =g_strdup_printf ("spi%d" , i);object_property_add_alias (OBJECT (s), bus_name,OBJECT (&s->spi[i]),"spi" , - &error_abort); + &err);g_free (bus_name); +if (err) { +error_propagate (errp, err); +return ; + } }/* Below devices are not modelled yet. */
Signature · 1 line
2.21.1
PATCH v2 31/54 hw/riscv/sifive: Add missing error-propagation code
In reply to Philippe Mathieu-DaudéPatch created mechanically by running:
$ spatch \
--macro-file scripts/cocci-macro-file.h --include-headers \
--sp-file scripts/coccinelle/use-error_propagate-in-realize.cocci \
--keep-comments --smpl-spacing --in-place --dir hw--- hw/riscv/sifive_e.c | 6 +++++- hw/riscv/sifive_u.c | 24 ++++++++++++++++++++---- 2 files changed, 25 insertions(+), 5 deletions(-)
hw/riscv/sifive_e.c +5 -1
@@ -156,7 +156,11 @@ static void riscv_sifive_e_soc_realize(DeviceState *dev, Error **errp)MemoryRegion *sys_mem =get_system_memory ();object_property_set_bool (OBJECT (&s->cpus), true,"realized" , - &error_abort); + &err); +if (err) { +error_propagate (errp, err); +return ; + }/* MMIO */ s->plic = sifive_plic_create(memmap[SIFIVE_E_PLIC].base,
hw/riscv/sifive_u.c +20 -4
@@ -508,9 +508,17 @@ static void riscv_sifive_u_soc_realize(DeviceState *dev, Error **errp)NICInfo *nd = &nd_table[0 ];object_property_set_bool (OBJECT (&s->e_cpus), true,"realized" , - &error_abort); + &err); +if (err) { +error_propagate (errp, err); +return ; + }object_property_set_bool (OBJECT (&s->u_cpus), true,"realized" , - &error_abort); + &err); +if (err) { +error_propagate (errp, err); +return ; + }/* * The cluster must be realized after the RISC-V hart array container, * as the container's CPU object is only created on realize, and the
@@ -518,9 +526,17 @@ static void riscv_sifive_u_soc_realize(DeviceState *dev, Error **errp)* cluster is realized. */ object_property_set_bool (OBJECT (&s->e_cluster), true,"realized" , - &error_abort); + &err); +if (err) { +error_propagate (errp, err); +return ; + }object_property_set_bool (OBJECT (&s->u_cluster), true,"realized" , - &error_abort); + &err); +if (err) { +error_propagate (errp, err); +return ; + }/* create PLIC hart topology configuration string */ plic_hart_config_len = (strlen(SIFIVE_U_PLIC_HART_CONFIG) + 1) *
Signature · 1 line
2.21.1
PATCH v2 32/54 hw/arm/armv7m: Add missing error-propagation code
In reply to Philippe Mathieu-DaudéPatch created mechanically by running:
$ spatch \
--macro-file scripts/cocci-macro-file.h --include-headers \
--sp-file scripts/coccinelle/use-error_propagate-in-realize.cocci \
--keep-comments --smpl-spacing --in-place --dir hw--- hw/arm/armv7m.c | 12 ++++++++++-- 1 file changed, 10 insertions(+), 2 deletions(-)
hw/arm/armv7m.c +10 -2
@@ -168,7 +168,11 @@ static void armv7m_realize(DeviceState *dev, Error **errp) }object_property_set_link (OBJECT (s->cpu),OBJECT (&s->container),"memory" , - &error_abort); + &err); +if (err) { +error_propagate (errp, err); +return ; + }if (object_property_find (OBJECT (s->cpu),"idau" ,NULL )) {object_property_set_link (OBJECT (s->cpu), s->idau,"idau" , &err);if (err !=NULL ) {
@@ -256,7 +260,11 @@ static void armv7m_realize(DeviceState *dev, Error **errp)return ; }object_property_set_link (obj,OBJECT (s->board_memory), -"source-memory" , &error_abort); +"source-memory" , &err); +if (err) { +error_propagate (errp, err); +return ; + }object_property_set_bool (obj, true,"realized" , &err);if (err !=NULL ) {error_propagate (errp, err);
Signature · 1 line
2.21.1
PATCH v2 33/54 hw/intc/arm_gicv3_its_kvm: Add missing error-propagation code
In reply to Philippe Mathieu-DaudéPatch created mechanically by running:
$ spatch \
--macro-file scripts/cocci-macro-file.h --include-headers \
--sp-file scripts/coccinelle/use-error_propagate-in-realize.cocci \
--keep-comments --smpl-spacing --in-place --dir hw--- hw/intc/arm_gicv3_its_kvm.c | 6 +++++- 1 file changed, 5 insertions(+), 1 deletion(-)
hw/intc/arm_gicv3_its_kvm.c +5 -1
@@ -101,7 +101,11 @@ static void kvm_arm_its_realize(DeviceState *dev, Error **errp)/* explicit init of the ITS */ kvm_device_access (s->dev_fd,KVM_DEV_ARM_VGIC_GRP_CTRL , -KVM_DEV_ARM_VGIC_CTRL_INIT ,NULL , true, &error_abort); +KVM_DEV_ARM_VGIC_CTRL_INIT ,NULL , true, &local_err); +if (local_err) { +error_propagate (errp, local_err); +return ; + }/* register the base address */ kvm_arm_register_device(&s->iomem_its_cntrl, -1, KVM_DEV_ARM_VGIC_GRP_ADDR,
Signature · 1 line
2.21.1
PATCH v2 34/54 hw/microblaze/xlnx-zynqmp-pmu: Add missing error-propagation code
In reply to Philippe Mathieu-DaudéPatch created mechanically by running:
$ spatch \
--macro-file scripts/cocci-macro-file.h --include-headers \
--sp-file scripts/coccinelle/use-error_propagate-in-realize.cocci \
--keep-comments --smpl-spacing --in-place --dir hw--- hw/microblaze/xlnx-zynqmp-pmu.c | 6 +++++- 1 file changed, 5 insertions(+), 1 deletion(-)
hw/microblaze/xlnx-zynqmp-pmu.c +5 -1
@@ -123,7 +123,11 @@ static void xlnx_zynqmp_pmu_soc_realize(DeviceState *dev, Error **errp)/* Connect the IPI device */ for (int i =0 ; i <XLNX_ZYNQMP_PMU_NUM_IPIS ; i++) {object_property_set_bool (OBJECT (&s->ipi[i]), true,"realized" , - &error_abort); + &err); +if (err) { +error_propagate (errp, err); +return ; + }sysbus_mmio_map (SYS_BUS_DEVICE (&s->ipi[i]),0 , ipi_addr[i]);sysbus_connect_irq (SYS_BUS_DEVICE (&s->ipi[i]),0 ,qdev_get_gpio_in (DEVICE (&s->intc), ipi_irq[i]));
Signature · 1 line
2.21.1
PATCH v2 35/54 hw/pci-host/pnv_phb3: Add missing error-propagation code
In reply to Philippe Mathieu-DaudéPatch created mechanically by running:
$ spatch \
--macro-file scripts/cocci-macro-file.h --include-headers \
--sp-file scripts/coccinelle/use-error_propagate-in-realize.cocci \
--keep-comments --smpl-spacing --in-place --dir hw--- hw/pci-host/pnv_phb3.c | 24 ++++++++++++++++++++---- 1 file changed, 20 insertions(+), 4 deletions(-)
hw/pci-host/pnv_phb3.c +20 -4
@@ -1008,7 +1008,11 @@ static void pnv_phb3_realize(DeviceState *dev, Error **errp)/* LSI sources */ object_property_set_link (OBJECT (&phb->lsis),OBJECT (pnv),"xics" , - &error_abort); + &local_err); +if (local_err) { +error_propagate (errp, local_err); +return ; + }object_property_set_bool (OBJECT (&phb->lsis), true,"realized" , &local_err);if (local_err) {error_propagate (errp, local_err);
@@ -1023,9 +1027,17 @@ static void pnv_phb3_realize(DeviceState *dev, Error **errp)/* MSI sources */ object_property_set_link (OBJECT (&phb->msis),OBJECT (phb),"phb" , - &error_abort); + &local_err); +if (local_err) { +error_propagate (errp, local_err); +return ; + }object_property_set_link (OBJECT (&phb->msis),OBJECT (pnv),"xics" , - &error_abort); + &local_err); +if (local_err) { +error_propagate (errp, local_err); +return ; + }object_property_set_bool (OBJECT (&phb->msis), true,"realized" , &local_err);if (local_err) {error_propagate (errp, local_err);
@@ -1034,7 +1046,11 @@ static void pnv_phb3_realize(DeviceState *dev, Error **errp)/* Power Bus Common Queue */ object_property_set_link (OBJECT (&phb->pbcq),OBJECT (phb),"phb" , - &error_abort); + &local_err); +if (local_err) { +error_propagate (errp, local_err); +return ; + }object_property_set_bool (OBJECT (&phb->pbcq), true,"realized" , &local_err);if (local_err) {error_propagate (errp, local_err);
Signature · 1 line
2.21.1
PATCH v2 36/54 hw/block/onenand: Add missing error-propagation code
In reply to Philippe Mathieu-DaudéPatch created mechanically by running:
$ spatch \
--macro-file scripts/cocci-macro-file.h --include-headers \
--sp-file scripts/coccinelle/use-error_propagate-in-realize.cocci \
--keep-comments --smpl-spacing --in-place --dir hw--- hw/block/onenand.c | 6 +++++- 1 file changed, 5 insertions(+), 1 deletion(-)
hw/block/onenand.c +5 -1
@@ -810,7 +810,11 @@ static void onenand_realize(DeviceState *dev, Error **errp) s->otp =memset (g_malloc ((64 +2 ) <<PAGE_SHIFT ),0xff , (64 +2 ) <<PAGE_SHIFT );memory_region_init_ram_nomigrate (&s->ram,OBJECT (s),"onenand.ram" , -0xc000 << s->shift, &error_fatal); +0xc000 << s->shift, &local_err); +if (local_err) { +error_propagate (errp, local_err); +return ; + }vmstate_register_ram_global (&s->ram); ram =memory_region_get_ram_ptr (&s->ram); s->boot[0 ] = ram + (0x0000 << s->shift);
Signature · 1 line
2.21.1
PATCH v2 37/54 scripts/coccinelle: Add script to catch missing error_propagate() calls
In reply to Philippe Mathieu-DaudéIn some places in we put an error into a local Error*, but forget to check for failure and pass it back to the caller.
Add a Coccinelle patch to catch automatically add the missing code.
--- .../add-missing-error_propagate.cocci | 30 +++++++++++++++++++ MAINTAINERS | 1 + 2 files changed, 31 insertions(+) create mode 100644 scripts/coccinelle/add-missing-error_propagate.cocci
scripts/coccinelle/add-missing-error_propagate.cocci new file +30 -0
@@ -0,0 +1,30 @@ +// Add missing error-propagation code where caller provide a Error* argument +// +// Copyright: (C) 2020 Philippe Mathieu-Daudé +// This work is licensed under the terms of the GNU GPLv2 or later. +// +// spatch \ +// --macro-file scripts/cocci-macro-file.h --include-headers \ +// --sp-file scripts/coccinelle/add-missing-error_propagate.cocci \ +// --keep-comments --in-place +// +// Inspired by https://www.mail-archive.com/[email protected]/msg691638.html + + +@ add_missing_error_propagate @ +typedef Error; +Error *local_err; +identifier func, errp, errfunc1, errfunc2; +@@ +func(..., Error **errp) +{ + <... + errfunc1(..., &local_err); ++ if (local_err) { ++ error_propagate(errp, local_err); ++ return; ++ } + ... when != local_err + errfunc2(..., &local_err); + ...> +}
MAINTAINERS +1 -0
@@ -2053,6 +2053,7 @@ F: include/qemu/error-report.h F: qapi/error.json F: util/error.c F: util/qemu-error.c +F: scripts/coccinelle/add-missing-error_propagate.cocci F: scripts/coccinelle/err-bad-newline.cocci F: scripts/coccinelle/error-use-after-free.cocci F: scripts/coccinelle/error_propagate_null.cocci
Signature · 1 line
2.21.1
Re: [PATCH-for-5.1 v2 37/54] scripts/coccinelle: Add script to catch missing error_propagate() calls
Quoted 3 lines · Philippe Mathieu-Daudé
In some places in we put an error into a local Error*, but forget to check for failure and pass it back to the caller.
Add a Coccinelle patch to catch automatically add the missing code.
s/catch/catch and/
Quoted 15 lines
Inspired-by Peter Maydell <[email protected]>Signed-off-by Philippe Mathieu-Daudé <[email protected]>--- .../add-missing-error_propagate.cocci | 30 +++++++++++++++++++ MAINTAINERS | 1 + 2 files changed, 31 insertions(+)create mode 100644
scripts/coccinelle/add-missing-error_propagate.cocciscripts/coccinelle/add-missing-error_propagate.cocci new file +0
-0
scripts/coccinelle/add-missing-error_propagate.cocci line 1
Quoted 1 line
scripts/coccinelle/add-missing-error_propagate.cocci new file +1
-0@@ -0,0 +1,30 @@ +// Add missing error-propagation code where caller provide a Error* argument
provides
Quoted 14 lines
scripts/coccinelle/add-missing-error_propagate.cocci new file +14
-0+// +// Copyright: (C) 2020 Philippe Mathieu-Daudé +// This work is licensed under the terms of the GNU GPLv2 or later. +// +// spatch \ +// --macro-file scripts/cocci-macro-file.h --include-headers \ +// --sp-file scripts/coccinelle/add-missing-error_propagate.cocci \ +// --keep-comments --in-place +// +// Inspired by https://www.mail-archive.com/[email protected]/msg691638.html + + +@ add_missing_error_propagate @ +typedef Error;
scripts/coccinelle/add-missing-error_propagate.cocci line 25
Quoted 10 lines
scripts/coccinelle/add-missing-error_propagate.cocci new file +10
-0+Error *local_err; +identifier func, errp, errfunc1, errfunc2; +@@ +func(..., Error **errp) +{ + <... + errfunc1(..., &local_err); ++ if (local_err) { ++ error_propagate(errp, local_err); ++ return;
Do we have to ensure that 'func' returns void? But then again, I guess it's easy enough to validate whether things still compile after this script makes cleanups.
Quoted 18 lines
scripts/coccinelle/add-missing-error_propagate.cocci new file +5
-0++ } + ... when != local_err + errfunc2(..., &local_err); + ...> +}MAINTAINERS +1
-0@@ -2053,6 +2053,7 @@ F: include/qemu/error-report.h F: qapi/error.json F: util/error.c F: util/qemu-error.c +F: scripts/coccinelle/add-missing-error_propagate.cocci F: scripts/coccinelle/err-bad-newline.cocci F: scripts/coccinelle/error-use-after-free.cocci F: scripts/coccinelle/error_propagate_null.cocci
Signature · 3 lines
Eric Blake, Principal Software Engineer Red Hat, Inc. +1-919-301-3226 Virtualization: qemu.org | libvirt.org
PATCH v2 38/54 hw/arm/bcm2835_peripherals: Add missing error-propagation code
In reply to Philippe Mathieu-DaudéPatch created mechanically by running:
$ spatch \
--macro-file scripts/cocci-macro-file.h --include-headers \
--sp-file scripts/coccinelle/object_property_missing_error_propagate.cocci \
--keep-comments --smpl-spacing --in-place --dir hw--- hw/arm/bcm2835_peripherals.c | 8 ++++++++ 1 file changed, 8 insertions(+)
hw/arm/bcm2835_peripherals.c +8 -0
@@ -289,8 +289,16 @@ static void bcm2835_peripherals_realize(DeviceState *dev, Error **errp)* SD3.0_Host_AHB_eMMC4.4_Usersguide_ver5.9_jan11_10.pdf */ object_property_set_uint (OBJECT (&s->sdhci),3 ,"sd-spec-version" , &err); +if (err) { +error_propagate (errp, err); +return ; + }object_property_set_uint (OBJECT (&s->sdhci),BCM2835_SDHC_CAPAREG ,"capareg" , &err); +if (err) { +error_propagate (errp, err); +return ; + }object_property_set_bool (OBJECT (&s->sdhci), true,"pending-insert-quirk" , &err);if (err) {
Signature · 1 line
2.21.1
Re: [PATCH-for-5.1 v2 38/54] hw/arm/bcm2835_peripherals: Add missing error-propagation code
Quoted 5 lines · Philippe Mathieu-Daudé
Patch created mechanically by running:
$ spatch \ --macro-file scripts/cocci-macro-file.h --include-headers \ --sp-file scripts/coccinelle/object_property_missing_error_propagate.cocci \
sigh I forgot to update this, the scrip has been renamed add-missing-error_propagate.cocci :(
Quoted 30 lines
--keep-comments --smpl-spacing --in-place --dir hwReviewed-by Peter Maydell <[email protected]>Signed-off-by Philippe Mathieu-Daudé <[email protected]>--- hw/arm/bcm2835_peripherals.c | 8 ++++++++ 1 file changed, 8 insertions(+)hw/arm/bcm2835_peripherals.c +8
-0@@ -289,8 +289,16 @@ static void bcm2835_peripherals_realize(DeviceState *dev, Error **errp)* SD3.0_Host_AHB_eMMC4.4_Usersguide_ver5.9_jan11_10.pdf */ object_property_set_uint (OBJECT (&s->sdhci),3 ,"sd-spec-version" , &err); +if (err) { +error_propagate (errp, err); +return ; + }object_property_set_uint (OBJECT (&s->sdhci),BCM2835_SDHC_CAPAREG ,"capareg" , &err); +if (err) { +error_propagate (errp, err); +return ; + }object_property_set_bool (OBJECT (&s->sdhci), true,"pending-insert-quirk" , &err);if (err) {
PATCH v2 39/54 hw/arm/fsl-imx: Add missing error-propagation code
In reply to Philippe Mathieu-DaudéPatch created mechanically by running:
$ spatch \
--macro-file scripts/cocci-macro-file.h --include-headers \
--sp-file scripts/coccinelle/object_property_missing_error_propagate.cocci \
--keep-comments --smpl-spacing --in-place --dir hw--- hw/arm/fsl-imx25.c | 8 ++++++++ hw/arm/fsl-imx6.c | 8 ++++++++ 2 files changed, 16 insertions(+)
hw/arm/fsl-imx25.c +8 -0
@@ -271,8 +271,16 @@ static void fsl_imx25_realize(DeviceState *dev, Error **errp)object_property_set_uint (OBJECT (&s->esdhc[i]),2 ,"sd-spec-version" , &err); +if (err) { +error_propagate (errp, err); +return ; + }object_property_set_uint (OBJECT (&s->esdhc[i]),IMX25_ESDHC_CAPABILITIES ,"capareg" , &err); +if (err) { +error_propagate (errp, err); +return ; + }object_property_set_bool (OBJECT (&s->esdhc[i]), true,"realized" , &err);if (err) {error_propagate (errp, err);
hw/arm/fsl-imx6.c +8 -0
@@ -343,8 +343,16 @@ static void fsl_imx6_realize(DeviceState *dev, Error **errp)/* UHS-I SDIO3.0 SDR104 1.8V ADMA */ object_property_set_uint (OBJECT (&s->esdhc[i]),3 ,"sd-spec-version" , &err); +if (err) { +error_propagate (errp, err); +return ; + }object_property_set_uint (OBJECT (&s->esdhc[i]),IMX6_ESDHC_CAPABILITIES ,"capareg" , &err); +if (err) { +error_propagate (errp, err); +return ; + }object_property_set_bool (OBJECT (&s->esdhc[i]), true,"realized" , &err);if (err) {error_propagate (errp, err);
Signature · 1 line
2.21.1
PATCH v2 40/54 hw/arm/stm32fx05_soc: Add missing error-propagation code
In reply to Philippe Mathieu-DaudéPatch created mechanically by running:
$ spatch \
--macro-file scripts/cocci-macro-file.h --include-headers \
--sp-file scripts/coccinelle/object_property_missing_error_propagate.cocci \
--keep-comments --smpl-spacing --in-place --dir hw--- hw/arm/stm32f205_soc.c | 4 ++++ hw/arm/stm32f405_soc.c | 4 ++++ 2 files changed, 8 insertions(+)
hw/arm/stm32f205_soc.c +4 -0
@@ -159,6 +159,10 @@ static void stm32f205_soc_realize(DeviceState *dev_soc, Error **errp)/* ADC 1 to 3 */ object_property_set_int (OBJECT (s->adc_irqs),STM_NUM_ADCS ,"num-lines" , &err); +if (err) { +error_propagate (errp, err); +return ; + }object_property_set_bool (OBJECT (s->adc_irqs), true,"realized" , &err);if (err !=NULL ) {error_propagate (errp, err);
hw/arm/stm32f405_soc.c +4 -0
@@ -181,6 +181,10 @@ static void stm32f405_soc_realize(DeviceState *dev_soc, Error **errp) }object_property_set_int (OBJECT (&s->adc_irqs),STM_NUM_ADCS ,"num-lines" , &err); +if (err) { +error_propagate (errp, err); +return ; + }object_property_set_bool (OBJECT (&s->adc_irqs), true,"realized" , &err);if (err !=NULL ) {error_propagate (errp, err);
Signature · 1 line
2.21.1
PATCH v2 41/54 hw/dma/xilinx_axidma: Add missing error-propagation code
In reply to Philippe Mathieu-DaudéPatch created mechanically by running:
$ spatch \
--macro-file scripts/cocci-macro-file.h --include-headers \
--sp-file scripts/coccinelle/object_property_missing_error_propagate.cocci \
--keep-comments --smpl-spacing --dir hwThen review showed this file has a 'xilinx_axidma_realize_fail' label that calls error_propagate(). Updated the patch to use the label.
---
v2: New cocci patch generated both transformations
(Peter noticed v1 only catched one)
--- hw/dma/xilinx_axidma.c | 6 ++++++ 1 file changed, 6 insertions(+)
hw/dma/xilinx_axidma.c +6 -0
@@ -531,6 +531,9 @@ static void xilinx_axidma_realize(DeviceState *dev, Error **errp) object_property_allow_set_link,OBJ_PROP_LINK_STRONG , &local_err); +if (local_err) { + goto xilinx_axidma_realize_fail; + } object_property_add_link(OBJECT(cs), "dma", TYPE_XILINX_AXI_DMA, (Object **)&cs->dma, object_property_allow_set_link,
@@ -540,6 +543,9 @@ static void xilinx_axidma_realize(DeviceState *dev, Error **errp) goto xilinx_axidma_realize_fail; }object_property_set_link (OBJECT (ds),OBJECT (s),"dma" , &local_err); +if (local_err) { + goto xilinx_axidma_realize_fail; + }object_property_set_link (OBJECT (cs),OBJECT (s),"dma" , &local_err);if (local_err) { goto xilinx_axidma_realize_fail;
Signature · 1 line
2.21.1
PATCH v2 42/54 hw/i386/x86: Add missing error-propagation code
In reply to Philippe Mathieu-DaudéRunning the coccinelle script:
$ spatch \
--macro-file scripts/cocci-macro-file.h --include-headers \
--sp-file scripts/coccinelle/object_property_missing_error_propagate.cocci \
--keep-comments --smpl-spacing --dir hwinserted a block after object_property_set_uint("apic-id") which calls error_propagate() and return.
Thanksfully code review noticed returning here would skip the 'object_unref(cpu)' call.
Manually fix the error propagation code by adding a label to the existing call.
--- hw/i386/x86.c | 4 ++++ 1 file changed, 4 insertions(+)
hw/i386/x86.c +4 -0
@@ -124,8 +124,12 @@ void x86_cpu_new(X86MachineState *x86ms, int64_t apic_id, Error **errp) cpu =object_new (MACHINE (x86ms)->cpu_type);object_property_set_uint (cpu, apic_id,"apic-id" , &local_err); +if (local_err) { + goto out; + }object_property_set_bool (cpu, true,"realized" , &local_err); +out:object_unref (cpu);error_propagate (errp, local_err); }
Signature · 1 line
2.21.1
PATCH v2 43/54 hw/mips/cps: Add missing error-propagation code
In reply to Philippe Mathieu-DaudéPatch created mechanically by running:
$ spatch \
--macro-file scripts/cocci-macro-file.h --include-headers \
--sp-file scripts/coccinelle/object_property_missing_error_propagate.cocci \
--keep-comments --smpl-spacing --in-place --dir hwUnfortunately the cocci script doesn't properly patch trailing error_propagate() block and emitted duplicate if() block statements. These 3 blocks were manually removed.
--- hw/mips/cps.c | 48 ++++++++++++++++++++++++++++++++++++++++++++++++ 1 file changed, 48 insertions(+)
hw/mips/cps.c +48 -0
@@ -102,9 +102,21 @@ static void mips_cps_realize(DeviceState *dev, Error **errp)sysbus_init_child_obj (OBJECT (dev),"itu" , &s->itu,sizeof (s->itu),TYPE_MIPS_ITU );object_property_set_int (OBJECT (&s->itu),16 ,"num-fifo" , &err); +if (err) { +error_propagate (errp, err); +return ; + }object_property_set_int (OBJECT (&s->itu),16 ,"num-semaphores" , &err); +if (err) { +error_propagate (errp, err); +return ; + }object_property_set_bool (OBJECT (&s->itu), saar_present,"saar-present" , &err); +if (err) { +error_propagate (errp, err); +return ; + }if (saar_present) { s->itu.saar = &env->CP0_SAAR; }
@@ -122,7 +134,15 @@ static void mips_cps_realize(DeviceState *dev, Error **errp)sysbus_init_child_obj (OBJECT (dev),"cpc" , &s->cpc,sizeof (s->cpc),TYPE_MIPS_CPC );object_property_set_int (OBJECT (&s->cpc), s->num_vp,"num-vp" , &err); +if (err) { +error_propagate (errp, err); +return ; + }object_property_set_int (OBJECT (&s->cpc),1 ,"vp-start-running" , &err); +if (err) { +error_propagate (errp, err); +return ; + }object_property_set_bool (OBJECT (&s->cpc), true,"realized" , &err);if (err !=NULL ) {error_propagate (errp, err);
@@ -136,7 +156,15 @@ static void mips_cps_realize(DeviceState *dev, Error **errp)sysbus_init_child_obj (OBJECT (dev),"gic" , &s->gic,sizeof (s->gic),TYPE_MIPS_GIC );object_property_set_int (OBJECT (&s->gic), s->num_vp,"num-vp" , &err); +if (err) { +error_propagate (errp, err); +return ; + }object_property_set_int (OBJECT (&s->gic),128 ,"num-irq" , &err); +if (err) { +error_propagate (errp, err); +return ; + }object_property_set_bool (OBJECT (&s->gic), true,"realized" , &err);if (err !=NULL ) {error_propagate (errp, err);
@@ -152,10 +180,30 @@ static void mips_cps_realize(DeviceState *dev, Error **errp)sysbus_init_child_obj (OBJECT (dev),"gcr" , &s->gcr,sizeof (s->gcr),TYPE_MIPS_GCR );object_property_set_int (OBJECT (&s->gcr), s->num_vp,"num-vp" , &err); +if (err) { +error_propagate (errp, err); +return ; + }object_property_set_int (OBJECT (&s->gcr),0x800 ,"gcr-rev" , &err); +if (err) { +error_propagate (errp, err); +return ; + }object_property_set_int (OBJECT (&s->gcr), gcr_base,"gcr-base" , &err); +if (err) { +error_propagate (errp, err); +return ; + }object_property_set_link (OBJECT (&s->gcr),OBJECT (&s->gic.mr),"gic" , &err); +if (err) { +error_propagate (errp, err); +return ; + }object_property_set_link (OBJECT (&s->gcr),OBJECT (&s->cpc.mr),"cpc" , &err); +if (err) { +error_propagate (errp, err); +return ; + }object_property_set_bool (OBJECT (&s->gcr), true,"realized" , &err);if (err !=NULL ) {error_propagate (errp, err);
Signature · 1 line
2.21.1
PATCH v2 44/54 hw/misc/macio/macio: Add missing error-propagation code
In reply to Philippe Mathieu-DaudéPatch created mechanically by running:
$ spatch \
--macro-file scripts/cocci-macro-file.h --include-headers \
--sp-file scripts/coccinelle/object_property_missing_error_propagate.cocci \
--keep-comments --smpl-spacing --dir hw--- hw/misc/macio/macio.c | 4 ++++ 1 file changed, 4 insertions(+)
hw/misc/macio/macio.c +4 -0
@@ -348,6 +348,10 @@ static void macio_newworld_realize(PCIDevice *d, Error **errp)memory_region_add_subregion (&s->bar,0x50 ,sysbus_mmio_get_region (sysbus_dev,0 ));object_property_set_bool (OBJECT (&ns->gpio), true,"realized" , &err); +if (err) { +error_propagate (errp, err); +return ; + }/* PMU */ object_initialize_child(OBJECT(s), "pmu", &s->pmu, sizeof(s->pmu),
Signature · 1 line
2.21.1
PATCH v2 45/54 hw/net/xilinx_axienet: Add missing error-propagation code
In reply to Philippe Mathieu-DaudéPatch created mechanically by running:
$ spatch \
--macro-file scripts/cocci-macro-file.h --include-headers \
--sp-file scripts/coccinelle/object_property_missing_error_propagate.cocci \
--keep-comments --smpl-spacing --dir hwThen review showed this file has a 'xilinx_enet_realize_fail' label that calls error_propagate(). Updated the patch to use the label.
---
v2: New cocci patch generated both transformations
(Peter noticed v1 only catched one)
--- hw/net/xilinx_axienet.c | 6 ++++++ 1 file changed, 6 insertions(+)
hw/net/xilinx_axienet.c +6 -0
@@ -958,6 +958,9 @@ static void xilinx_enet_realize(DeviceState *dev, Error **errp) object_property_allow_set_link,OBJ_PROP_LINK_STRONG , &local_err); +if (local_err) { + goto xilinx_enet_realize_fail; + } object_property_add_link(OBJECT(cs), "enet", "xlnx.axi-ethernet", (Object **) &cs->enet, object_property_allow_set_link,
@@ -967,6 +970,9 @@ static void xilinx_enet_realize(DeviceState *dev, Error **errp) goto xilinx_enet_realize_fail; }object_property_set_link (OBJECT (ds),OBJECT (s),"enet" , &local_err); +if (local_err) { + goto xilinx_enet_realize_fail; + }object_property_set_link (OBJECT (cs),OBJECT (s),"enet" , &local_err);if (local_err) { goto xilinx_enet_realize_fail;
Signature · 1 line
2.21.1
PATCH v2 46/54 hw/riscv/sifive_u: Add missing error-propagation code
In reply to Philippe Mathieu-DaudéPatch created mechanically by running:
$ spatch \
--macro-file scripts/cocci-macro-file.h --include-headers \
--sp-file scripts/coccinelle/object_property_missing_error_propagate.cocci \
--keep-comments --smpl-spacing --dir hw--- hw/riscv/sifive_u.c | 8 ++++++++ 1 file changed, 8 insertions(+)
hw/riscv/sifive_u.c +8 -0
@@ -574,9 +574,17 @@ static void riscv_sifive_u_soc_realize(DeviceState *dev, Error **errp) SIFIVE_SIP_BASE, SIFIVE_TIMECMP_BASE, SIFIVE_TIME_BASE, false);object_property_set_bool (OBJECT (&s->prci), true,"realized" , &err); +if (err) { +error_propagate (errp, err); +return ; + }sysbus_mmio_map (SYS_BUS_DEVICE (&s->prci),0 , memmap[SIFIVE_U_PRCI ].base);object_property_set_bool (OBJECT (&s->otp), true,"realized" , &err); +if (err) { +error_propagate (errp, err); +return ; + }sysbus_mmio_map (SYS_BUS_DEVICE (&s->otp),0 , memmap[SIFIVE_U_OTP ].base);for (i =0 ; i <SIFIVE_U_PLIC_NUM_SOURCES ; i++) {
Signature · 1 line
2.21.1
PATCH v2 47/54 hw/sd/milkymist-memcard: Add missing error-propagation code
In reply to Philippe Mathieu-DaudéPatch created mechanically by running:
$ spatch \
--macro-file scripts/cocci-macro-file.h --include-headers \
--sp-file scripts/coccinelle/object_property_missing_error_propagate.cocci \
--keep-comments --smpl-spacing --dir hw--- hw/sd/milkymist-memcard.c | 4 ++++ 1 file changed, 4 insertions(+)
hw/sd/milkymist-memcard.c +4 -0
@@ -280,6 +280,10 @@ static void milkymist_memcard_realize(DeviceState *dev, Error **errp) blk = dinfo ?blk_by_legacy_dinfo (dinfo) :NULL ; carddev =qdev_create (BUS (&s->sdbus),TYPE_SD_CARD );qdev_prop_set_drive (carddev,"drive" , blk, &err); +if (err) { +error_propagate (errp, err); +return ; + }object_property_set_bool (OBJECT (carddev), true,"realized" , &err);if (err) {error_setg (errp,"failed to init SD card: %s" ,error_get_pretty (err));
Signature · 1 line
2.21.1
PATCH v2 48/54 scripts/coccinelle: Use &error_abort in TypeInfo::instance_init()
In reply to Philippe Mathieu-DaudéThe instance_init() calls are not suppose to fail. Add a Coccinelle script to use &error_abort instead of ignoring errors by using a NULL Error*.
--- .../use-error_abort-in-instance_init.cocci | 52 +++++++++++++++++++ MAINTAINERS | 1 + 2 files changed, 53 insertions(+) create mode 100644 scripts/coccinelle/use-error_abort-in-instance_init.cocci
scripts/coccinelle/use-error_abort-in-instance_init.cocci new file +52 -0
@@ -0,0 +1,52 @@ +// Use &error_abort in TypeInfo::instance_init() +// +// Copyright: (C) 2020 Philippe Mathieu-Daudé +// This work is licensed under the terms of the GNU GPLv2 or later. +// +// spatch \ +// --macro-file scripts/cocci-macro-file.h --include-headers \ +// --sp-file scripts/coccinelle/use-error_abort-in-instance_init.cocci \ +// --keep-comments --in-place +// +// Inspired by https://www.mail-archive.com/[email protected]/msg692500.html +// and https://www.mail-archive.com/[email protected]/msg693637.html + + +@ has_qapi_error @ +@@ + #include "qapi/error.h" + + +@ match_instance_init @ +TypeInfo info; +identifier instance_initfn; +@@ + info.instance_init = instance_initfn; + + +@ use_error_abort @ +identifier match_instance_init.instance_initfn; +identifier func_with_error; +expression parentobj, propname, childobj, size, type, errp; +position pos; +@@ +void instance_initfn(...) +{ + <+... +( + object_initialize_child(parentobj, propname, + childobj, size, type, + errp, NULL); +| + func_with_error@pos(..., +- NULL); ++ &error_abort); +) + ...+> +} + + +@script:python depends on use_error_abort && !has_qapi_error@ +p << use_error_abort.pos; +@@ +print('[[manual edit required, %s misses #include "qapi/error.h"]]' % p[0].file)
MAINTAINERS +1 -0
@@ -2059,6 +2059,7 @@ F: scripts/coccinelle/error-use-after-free.cocci F: scripts/coccinelle/error_propagate_null.cocci F: scripts/coccinelle/remove_local_err.cocci F: scripts/coccinelle/simplify-init-realize-error_propagate.cocci +F: scripts/coccinelle/use-error_abort-in-instance_init.cocci F: scripts/coccinelle/use-error_fatal.cocci F: scripts/coccinelle/use-error_propagate-in-realize.cocci
Signature · 1 line
2.21.1
Re: [PATCH-for-5.1 v2 48/54] scripts/coccinelle: Use &error_abort in TypeInfo::instance_init()
Quoted 51 lines · Philippe Mathieu-Daudé
The
instance_init()calls are not suppose to fail. Add a Coccinelle script to use&error_abortinstead of ignoring errors by using a NULL Error*.Signed-off-by Philippe Mathieu-Daudé <[email protected]>--- .../use-error_abort-in-instance_init.cocci | 52 +++++++++++++++++++ MAINTAINERS | 1 + 2 files changed, 53 insertions(+)create mode 100644
scripts/coccinelle/use-error_abort-in-instance_init.cocciscripts/coccinelle/use-error_abort-in-instance_init.cocci new file +34
-0@@ -0,0 +1,52 @@ +// Use &error_abort in TypeInfo::instance_init() +// +// Copyright: (C) 2020 Philippe Mathieu-Daudé +// This work is licensed under the terms of the GNU GPLv2 or later. +// +// spatch \ +// --macro-file scripts/cocci-macro-file.h --include-headers \ +// --sp-file scripts/coccinelle/use-error_abort-in-instance_init.cocci \ +// --keep-comments --in-place +// +// Inspired by https://www.mail-archive.com/[email protected]/msg692500.html +// and https://www.mail-archive.com/[email protected]/msg693637.html + + +@ has_qapi_error @ +@@ + #include "qapi/error.h" + + +@ match_instance_init @ +TypeInfo info; +identifier instance_initfn; +@@ + info.instance_init = instance_initfn; + + +@ use_error_abort @ +identifier match_instance_init.instance_initfn; +identifier func_with_error; +expression parentobj, propname, childobj, size, type, errp; +position pos; +@@ +void instance_initfn(...) +{
scripts/coccinelle/use-error_abort-in-instance_init.cocci line 44
Quoted 10 lines
scripts/coccinelle/use-error_abort-in-instance_init.cocci new file +10
-0+ <+... +( + object_initialize_child(parentobj, propname, + childobj, size, type, + errp, NULL); +| + func_with_error@pos(..., +- NULL); ++ &error_abort); +)
Hmm. I don't follow, what are you trying to achieve by this ( | ) construction? The second pattern (func_with_error...) will be matched anyway, with or without first pattern (object_initialize_child...) matched. And first pattern does nothing.
Quoted 21 lines
scripts/coccinelle/use-error_abort-in-instance_init.cocci new file +8
-0+ ...+> +} + + +@script:python depends on use_error_abort && !has_qapi_error@ +p << use_error_abort.pos; +@@ +print('[[manual edit required, %s misses #include "qapi/error.h"]]' % p[0].file)MAINTAINERS +1
-0@@ -2059,6 +2059,7 @@ F: scripts/coccinelle/error-use-after-free.cocci F: scripts/coccinelle/error_propagate_null.cocci F: scripts/coccinelle/remove_local_err.cocci F: scripts/coccinelle/simplify-init-realize-error_propagate.cocci +F: scripts/coccinelle/use-error_abort-in-instance_init.cocci F: scripts/coccinelle/use-error_fatal.cocci F: scripts/coccinelle/use-error_propagate-in-realize.cocci
Signature · 2 lines
Best regards, Vladimir
Re: [PATCH-for-5.1 v2 48/54] scripts/coccinelle: Use &error_abort in TypeInfo::instance_init()
Quoted 59 lines · Vladimir Sementsov-Ogievskiy
Quoted 58 lines · Philippe Mathieu-Daudé
The
instance_init()calls are not suppose to fail. Add a Coccinelle script to use&error_abortinstead of ignoring errors by using a NULL Error*.Signed-off-by Philippe Mathieu-Daudé <[email protected]>---
.../use-error_abort-in-instance_init.cocci | 52 +++++++++++++++++++ MAINTAINERS | 1 +2 files changed, 53 insertions(+)create mode 100644
scripts/coccinelle/use-error_abort-in-instance_init.cocciscripts/coccinelle/use-error_abort-in-instance_init.cocci new file +8
-0@@ -0,0 +1,52 @@ +// Use &error_abort in TypeInfo::instance_init() +// +// Copyright: (C) 2020 Philippe Mathieu-Daudé +// This work is licensed under the terms of the GNU GPLv2 or later. +// +// spatch \ +// --macro-file scripts/cocci-macro-file.h --include-headers \ +// --sp-file
scripts/coccinelle/use-error_abort-in-instance_init.cocci\scripts/coccinelle/use-error_abort-in-instance_init.cocci new file +3
-0+// --keep-comments --in-place +// +// Inspired byhttps://www.mail-archive.com/[email protected]/msg692500.html
scripts/coccinelle/use-error_abort-in-instance_init.cocci new file +28
-0+// and https://www.mail-archive.com/[email protected]/msg693637.html + + +@ has_qapi_error @ +@@ + #include "qapi/error.h" + + +@ match_instance_init @ +TypeInfo info; +identifier instance_initfn; +@@ + info.instance_init = instance_initfn; + + +@ use_error_abort @ +identifier match_instance_init.instance_initfn; +identifier func_with_error; +expression parentobj, propname, childobj, size, type, errp; +position pos; +@@ +void instance_initfn(...) +{ + <+... +( + object_initialize_child(parentobj, propname, + childobj, size, type, + errp, NULL);
Quoted 8 lines
Quoted 5 lines
+|
+ func_with_error@pos(...,
+- NULL);
++&error_abort);
+)Hmm. I don't follow, what are you trying to achieve by this ( | ) construction? The second pattern (
func_with_error...) will be matched anyway, with or without first pattern (object_initialize_child...) matched. And first pattern does nothing.
Expected behavior :)
If object_initialize_child() matched:
do nothing.
Else:
transform.
Quoted 25 lines
Quoted 23 lines
+ ...+>
scripts/coccinelle/use-error_abort-in-instance_init.cocci new file +7
-0+} + + +@script:python depends on use_error_abort && !has_qapi_error@ +p << use_error_abort.pos; +@@ +print('[[manual edit required, %s misses #include "qapi/error.h"]]' %p[0].file)
MAINTAINERS +0
-0@@ -2059,6 +2059,7 @@ F: scripts/coccinelle/error-use-after-free.cocciF:
scripts/coccinelle/error_propagate_null.cocci
F:scripts/coccinelle/remove_local_err.cocci
F:scripts/coccinelle/simplify-init-realize-error_propagate.cocci+F:scripts/coccinelle/use-error_abort-in-instance_init.cocci
F:scripts/coccinelle/use-error_fatal.cocci
F:scripts/coccinelle/use-error_propagate-in-realize.cocci
Re: [PATCH-for-5.1 v2 48/54] scripts/coccinelle: Use &error_abort in TypeInfo::instance_init()
Quoted 50 lines · Philippe Mathieu-Daudé
Quoted 49 lines · Vladimir Sementsov-Ogievskiy
Quoted 48 lines · Philippe Mathieu-Daudé
The
instance_init()calls are not suppose to fail. Add a Coccinelle script to use&error_abortinstead of ignoring errors by using a NULL Error*.Signed-off-by Philippe Mathieu-Daudé <[email protected]>---
.../use-error_abort-in-instance_init.cocci | 52 +++++++++++++++++++ MAINTAINERS | 1 +2 files changed, 53 insertions(+)create mode 100644
scripts/coccinelle/use-error_abort-in-instance_init.cocciscripts/coccinelle/use-error_abort-in-instance_init.cocci new file +31
-0@@ -0,0 +1,52 @@ +// Use &error_abort in TypeInfo::instance_init() +// +// Copyright: (C) 2020 Philippe Mathieu-Daudé +// This work is licensed under the terms of the GNU GPLv2 or later. +// +// spatch \ +// --macro-file scripts/cocci-macro-file.h --include-headers \ +// --sp-file scripts/coccinelle/use-error_abort-in-instance_init.cocci \ +// --keep-comments --in-place +// +// Inspired by https://www.mail-archive.com/[email protected]/msg692500.html +// and https://www.mail-archive.com/[email protected]/msg693637.html + + +@ has_qapi_error @ +@@ + #include "qapi/error.h" + + +@ match_instance_init @ +TypeInfo info; +identifier instance_initfn; +@@ + info.instance_init = instance_initfn; + + +@ use_error_abort @ +identifier match_instance_init.instance_initfn; +identifier func_with_error; +expression parentobj, propname, childobj, size, type, errp; +position pos;
Quoted 8 lines
Quoted 8 lines
scripts/coccinelle/use-error_abort-in-instance_init.cocci line 39
Quoted 8 lines
scripts/coccinelle/use-error_abort-in-instance_init.cocci new file +8
-0+@@ +void instance_initfn(...) +{ + <+... +( + object_initialize_child(parentobj, propname, + childobj, size, type, + errp, NULL);
I think, it doesn't actually differs from just object_initialize_child(..., NULL); and you don't need all these metavaraibles
Quoted 7 lines
Quoted 7 lines
Quoted 5 lines
scripts/coccinelle/use-error_abort-in-instance_init.cocci new file +5
-0+| + func_with_error@pos(..., +- NULL); ++ &error_abort); +)
Quoted 8 lines
Quoted 1 line
Hmm. I don't follow, what are you trying to achieve by this ( | ) construction? The second pattern (
func_with_error...) will be matched anyway, with or without first pattern (object_initialize_child...) matched. And first pattern does nothing.Expected behavior :)
If
object_initialize_child()matched:
do nothing.
Else:
transform.
Ah, understand, thanks. Checked, it works.
Possibly simpler way is just define func_with_errno identifier like this:
identifier func_with_error != object_initialize_child;
Quoted 26 lines
Quoted 25 lines
Quoted 23 lines
scripts/coccinelle/use-error_abort-in-instance_init.cocci new file +8
-0+ ...+> +} + + +@script:python depends on use_error_abort && !has_qapi_error@ +p << use_error_abort.pos; +@@ +print('[[manual edit required, %s misses #include "qapi/error.h"]]' % p[0].file)MAINTAINERS +0
-0@@ -2059,6 +2059,7 @@ F: scripts/coccinelle/error-use-after-free.cocciF:
scripts/coccinelle/error_propagate_null.cocci
F:scripts/coccinelle/remove_local_err.cocci
F:scripts/coccinelle/simplify-init-realize-error_propagate.cocci+F:scripts/coccinelle/use-error_abort-in-instance_init.cocci
F:scripts/coccinelle/use-error_fatal.cocci
F:scripts/coccinelle/use-error_propagate-in-realize.cocci
Signature · 2 lines
Best regards, Vladimir
Re: [PATCH-for-5.1 v2 48/54] scripts/coccinelle: Use &error_abort in TypeInfo::instance_init()
Quoted 82 lines · Vladimir Sementsov-Ogievskiy
Quoted 54 lines · Philippe Mathieu-Daudé
Quoted 53 lines · Vladimir Sementsov-Ogievskiy
Quoted 52 lines · Philippe Mathieu-Daudé
The
instance_init()calls are not suppose to fail. Add a Coccinelle script to use&error_abortinstead of ignoring errors by using a NULL Error*.Signed-off-by Philippe Mathieu-Daudé <[email protected]>---
.../use-error_abort-in-instance_init.cocci | 52
+++++++++++++++++++
MAINTAINERS | 1 +2 files changed, 53 insertions(+)create mode 100644
scripts/coccinelle/use-error_abort-in-instance_init.cocciscripts/coccinelle/use-error_abort-in-instance_init.cocci new file +8
-0@@ -0,0 +1,52 @@ +// Use &error_abort in TypeInfo::instance_init() +// +// Copyright: (C) 2020 Philippe Mathieu-Daudé +// This work is licensed under the terms of the GNU GPLv2 or later. +// +// spatch \ +// --macro-file scripts/cocci-macro-file.h --include-headers \ +// --sp-file
scripts/coccinelle/use-error_abort-in-instance_init.cocci\scripts/coccinelle/use-error_abort-in-instance_init.cocci new file +3
-0+// --keep-comments --in-place +// +// Inspired byhttps://www.mail-archive.com/[email protected]/msg692500.html
+// and
https://www.mail-archive.com/[email protected]/msg693637.htmlscripts/coccinelle/use-error_abort-in-instance_init.cocci new file +19
-0+ + +@ has_qapi_error @ +@@ + #include "qapi/error.h" + + +@ match_instance_init @ +TypeInfo info; +identifier instance_initfn; +@@ + info.instance_init = instance_initfn; + + +@ use_error_abort @ +identifier match_instance_init.instance_initfn; +identifier func_with_error; +expression parentobj, propname, childobj, size, type, errp; +position pos;Quoted 8 lines
Quoted 8 lines
scripts/coccinelle/use-error_abort-in-instance_init.cocci line 39
Quoted 8 lines
+@@
scripts/coccinelle/use-error_abort-in-instance_init.cocci new file +7
-0+void instance_initfn(...) +{ + <+... +( + object_initialize_child(parentobj, propname, + childobj, size, type, + errp, NULL);I think, it doesn't actually differs from just
object_initialize_child(..., NULL); and you don't need all these metavaraiblesQuoted 7 lines
Quoted 7 lines
Quoted 5 lines
+|
+ func_with_error@pos(...,
+- NULL);
++&error_abort);
+)Quoted 8 lines
Quoted 1 line
Hmm. I don't follow, what are you trying to achieve by this ( | ) construction? The second pattern (
func_with_error...) will be matched anyway, with or without first pattern (object_initialize_child...) matched. And first pattern does nothing.Expected behavior :)
If
object_initialize_child()matched:
do nothing.
Else:
transform.
Quoted 5 lines
Ah, understand, thanks. Checked, it works.
Possibly simpler way is just define
func_with_errnoidentifier like this:identifier
func_with_error!=object_initialize_child;
I didn't know, thanks!
Quoted 30 lines
Quoted 28 lines
Quoted 27 lines
Quoted 25 lines
+ ...+>
scripts/coccinelle/use-error_abort-in-instance_init.cocci new file +7
-0+} + + +@script:python depends on use_error_abort && !has_qapi_error@ +p << use_error_abort.pos; +@@ +print('[[manual edit required, %s misses #include "qapi/error.h"]]'% p[0].file)
MAINTAINERS +0
-0@@ -2059,6 +2059,7 @@ F: scripts/coccinelle/error-use-after-free.cocciF:
scripts/coccinelle/error_propagate_null.cocci
F:scripts/coccinelle/remove_local_err.cocci
F:scripts/coccinelle/simplify-init-realize-error_propagate.cocci+F:scripts/coccinelle/use-error_abort-in-instance_init.cocci
F:scripts/coccinelle/use-error_fatal.cocci
F:scripts/coccinelle/use-error_propagate-in-realize.cocci
Re: [PATCH-for-5.1 v2 48/54] scripts/coccinelle: Use &error_abort in TypeInfo::instance_init()
Quoted 83 lines · Philippe Mathieu-Daudé
Quoted 82 lines · Vladimir Sementsov-Ogievskiy
Quoted 54 lines · Philippe Mathieu-Daudé
Quoted 53 lines · Vladimir Sementsov-Ogievskiy
Quoted 52 lines · Philippe Mathieu-Daudé
The
instance_init()calls are not suppose to fail. Add a Coccinelle script to use&error_abortinstead of ignoring errors by using a NULL Error*.Signed-off-by Philippe Mathieu-Daudé <[email protected]>---
.../use-error_abort-in-instance_init.cocci | 52
+++++++++++++++++++
MAINTAINERS | 1 +2 files changed, 53 insertions(+)create mode 100644
scripts/coccinelle/use-error_abort-in-instance_init.cocciscripts/coccinelle/use-error_abort-in-instance_init.cocci new file +8
-0@@ -0,0 +1,52 @@ +// Use &error_abort in TypeInfo::instance_init() +// +// Copyright: (C) 2020 Philippe Mathieu-Daudé +// This work is licensed under the terms of the GNU GPLv2 or later. +// +// spatch \ +// --macro-file scripts/cocci-macro-file.h --include-headers \ +// --sp-file
scripts/coccinelle/use-error_abort-in-instance_init.cocci\scripts/coccinelle/use-error_abort-in-instance_init.cocci new file +3
-0+// --keep-comments --in-place +// +// Inspired byhttps://www.mail-archive.com/[email protected]/msg692500.html
+// and
https://www.mail-archive.com/[email protected]/msg693637.htmlscripts/coccinelle/use-error_abort-in-instance_init.cocci new file +19
-0+ + +@ has_qapi_error @ +@@ + #include "qapi/error.h" + + +@ match_instance_init @ +TypeInfo info; +identifier instance_initfn; +@@ + info.instance_init = instance_initfn; + + +@ use_error_abort @ +identifier match_instance_init.instance_initfn; +identifier func_with_error; +expression parentobj, propname, childobj, size, type, errp; +position pos;Quoted 8 lines
Quoted 8 lines
scripts/coccinelle/use-error_abort-in-instance_init.cocci line 39
Quoted 8 lines
+@@
scripts/coccinelle/use-error_abort-in-instance_init.cocci new file +7
-0+void instance_initfn(...) +{ + <+... +( + object_initialize_child(parentobj, propname, + childobj, size, type, + errp, NULL);I think, it doesn't actually differs from just
object_initialize_child(..., NULL); and you don't need all these metavaraiblesQuoted 15 lines
Quoted 8 lines
Quoted 5 lines
+|
+ func_with_error@pos(...,
+- NULL);
++&error_abort);
+)Hmm. I don't follow, what are you trying to achieve by this ( | ) construction? The second pattern (
func_with_error...) will be matched anyway, with or without first pattern (object_initialize_child...) matched. And first pattern does nothing.Expected behavior :)
If
object_initialize_child()matched:
do nothing.
Else:
transform.
Quoted 5 lines
Quoted 5 lines
Ah, understand, thanks. Checked, it works.
Possibly simpler way is just define
func_with_errnoidentifier like this:identifier
func_with_error!=object_initialize_child;
Thanks for the tip Vladimir, I simplified as:
@ use_error_abort @
identifier match_instance_init.instance_initfn;
identifier func_with_error != {qbus_create_inplace, object_initialize_child}; position pos;
@@
void instance_initfn(...)
{
<+...
func_with_error@pos(...,
- NULL);
+ &error_abort);
...+>
}
BTW do you know how to automatically add an include ("qapi/error.h" below)?
Quoted 30 lines
Quoted 30 lines
Quoted 28 lines
Quoted 27 lines
Quoted 25 lines
+ ...+>
scripts/coccinelle/use-error_abort-in-instance_init.cocci new file +7
-0+} + + +@script:python depends on use_error_abort && !has_qapi_error@ +p << use_error_abort.pos; +@@ +print('[[manual edit required, %s misses #include"
qapi/error.h"]]' % p[0].file)MAINTAINERS +0
-0@@ -2059,6 +2059,7 @@ F: scripts/coccinelle/error-use-after-free.cocciF:
scripts/coccinelle/error_propagate_null.cocci
F:scripts/coccinelle/remove_local_err.cocci
F:scripts/coccinelle/simplify-init-realize-error_propagate.cocci+F:scripts/coccinelle/use-error_abort-in-instance_init.cocci
F:scripts/coccinelle/use-error_fatal.cocci
F:scripts/coccinelle/use-error_propagate-in-realize.cocci
Re: [PATCH-for-5.1 v2 48/54] scripts/coccinelle: Use &error_abort in TypeInfo::instance_init()
Quoted 84 lines · Philippe Mathieu-Daudé
Quoted 83 lines · Philippe Mathieu-Daudé
Quoted 82 lines · Vladimir Sementsov-Ogievskiy
Quoted 50 lines · Philippe Mathieu-Daudé
Quoted 49 lines · Vladimir Sementsov-Ogievskiy
Quoted 48 lines · Philippe Mathieu-Daudé
The
instance_init()calls are not suppose to fail. Add a Coccinelle script to use&error_abortinstead of ignoring errors by using a NULL Error*.Signed-off-by Philippe Mathieu-Daudé <[email protected]>---
.../use-error_abort-in-instance_init.cocci | 52 +++++++++++++++++++ MAINTAINERS | 1 +2 files changed, 53 insertions(+)create mode 100644
scripts/coccinelle/use-error_abort-in-instance_init.cocciscripts/coccinelle/use-error_abort-in-instance_init.cocci new file +31
-0@@ -0,0 +1,52 @@ +// Use &error_abort in TypeInfo::instance_init() +// +// Copyright: (C) 2020 Philippe Mathieu-Daudé +// This work is licensed under the terms of the GNU GPLv2 or later. +// +// spatch \ +// --macro-file scripts/cocci-macro-file.h --include-headers \ +// --sp-file scripts/coccinelle/use-error_abort-in-instance_init.cocci \ +// --keep-comments --in-place +// +// Inspired by https://www.mail-archive.com/[email protected]/msg692500.html +// and https://www.mail-archive.com/[email protected]/msg693637.html + + +@ has_qapi_error @ +@@ + #include "qapi/error.h" + + +@ match_instance_init @ +TypeInfo info; +identifier instance_initfn; +@@ + info.instance_init = instance_initfn; + + +@ use_error_abort @ +identifier match_instance_init.instance_initfn; +identifier func_with_error; +expression parentobj, propname, childobj, size, type, errp; +position pos;Quoted 8 lines
Quoted 8 lines
scripts/coccinelle/use-error_abort-in-instance_init.cocci line 39
Quoted 8 lines
scripts/coccinelle/use-error_abort-in-instance_init.cocci new file +8
-0+@@ +void instance_initfn(...) +{ + <+... +( + object_initialize_child(parentobj, propname, + childobj, size, type, + errp, NULL);I think, it doesn't actually differs from just
object_initialize_child(..., NULL); and you don't need all these metavaraiblesQuoted 7 lines
Quoted 7 lines
Quoted 5 lines
scripts/coccinelle/use-error_abort-in-instance_init.cocci new file +5
-0+| + func_with_error@pos(..., +- NULL); ++ &error_abort); +)Quoted 8 lines
Quoted 1 line
Hmm. I don't follow, what are you trying to achieve by this ( | ) construction? The second pattern (
func_with_error...) will be matched anyway, with or without first pattern (object_initialize_child...) matched. And first pattern does nothing.Expected behavior :)
If
object_initialize_child()matched:
do nothing.
Else:
transform.Ah, understand, thanks. Checked, it works.
Possibly simpler way is just define
func_with_errnoidentifier like this:
Quoted 7 lines
Quoted 1 line
Quoted 1 line
identifier
func_with_error!=object_initialize_child;Thanks for the tip Vladimir, I simplified as:
@
use_error_abort@
identifier match_instance_init.instance_initfn;
identifierfunc_with_error!= {qbus_create_inplace,object_initialize_child};
New syntax for me, great)
Quoted 11 lines
position pos;
@@
voidinstance_initfn(...)
{
<+...
func_with_error@pos(...,
- NULL);
+&error_abort);
...+>
}
Quoted 1 line
BTW do you know how to automatically add an include ("
qapi/error.h" below)?
No, I don't.
I can guess something like this
@ already_has_include @
@@
#include <qapi/error.h>
@ depends on !already_has_include && use_error_abort @
#include ...
+#include <qapi/error.h>
===
or maybe in one rule:
@@
... when != error.h
#include ...
+#include <qapi/error.h>
... when != error.h
(possibly last line is not needed)..
what spec says about includes:
An #include may be followed by "...", <...> or simply .... With either quotes or angle brackets, it is possible to put a partial path, ending with ..., such as <include/...>, or to put a complete path. A #include with ... matches any include, with either quotes or angle brackets. Partial paths or complete are not allowed in the latter case. Something that is added before an include will be put before the last matching include that is not under an ifdef in the file. Likewise, something that is added after an include will be put after the last matching include that is not under an ifdef in the file.
Quoted 31 lines
Quoted 30 lines
Quoted 30 lines
Quoted 28 lines
Quoted 27 lines
Quoted 25 lines
scripts/coccinelle/use-error_abort-in-instance_init.cocci new file +8
-0+ ...+> +} + + +@script:python depends on use_error_abort && !has_qapi_error@ +p << use_error_abort.pos; +@@ +print('[[manual edit required, %s misses #include "qapi/error.h"]]' % p[0].file)MAINTAINERS +0
-0@@ -2059,6 +2059,7 @@ F: scripts/coccinelle/error-use-after-free.cocciF:
scripts/coccinelle/error_propagate_null.cocci
F:scripts/coccinelle/remove_local_err.cocci
F:scripts/coccinelle/simplify-init-realize-error_propagate.cocci+F:scripts/coccinelle/use-error_abort-in-instance_init.cocci
F:scripts/coccinelle/use-error_fatal.cocci
F:scripts/coccinelle/use-error_propagate-in-realize.cocci
Signature · 2 lines
Best regards, Vladimir
Re: [PATCH-for-5.1 v2 48/54] scripts/coccinelle: Use &error_abort in TypeInfo::instance_init()
Quoted 116 lines · Vladimir Sementsov-Ogievskiy
Quoted 84 lines · Philippe Mathieu-Daudé
Quoted 83 lines · Philippe Mathieu-Daudé
Quoted 82 lines · Vladimir Sementsov-Ogievskiy
Quoted 50 lines · Philippe Mathieu-Daudé
Quoted 49 lines · Vladimir Sementsov-Ogievskiy
Quoted 48 lines · Philippe Mathieu-Daudé
The
instance_init()calls are not suppose to fail. Add a Coccinelle script to use&error_abortinstead of ignoring errors by using a NULL Error*.Signed-off-by Philippe Mathieu-Daudé <[email protected]>--- .../use-error_abort-in-instance_init.cocci | 52 +++++++++++++++++++ MAINTAINERS | 1 + 2 files changed, 53 insertions(+)create mode 100644
scripts/coccinelle/use-error_abort-in-instance_init.cocciscripts/coccinelle/use-error_abort-in-instance_init.cocci new file +31
-0@@ -0,0 +1,52 @@ +// Use &error_abort in TypeInfo::instance_init() +// +// Copyright: (C) 2020 Philippe Mathieu-Daudé +// This work is licensed under the terms of the GNU GPLv2 or later. +// +// spatch \ +// --macro-file scripts/cocci-macro-file.h --include-headers \ +// --sp-file scripts/coccinelle/use-error_abort-in-instance_init.cocci \ +// --keep-comments --in-place +// +// Inspired by https://www.mail-archive.com/[email protected]/msg692500.html +// and https://www.mail-archive.com/[email protected]/msg693637.html + + +@ has_qapi_error @ +@@ + #include "qapi/error.h" + + +@ match_instance_init @ +TypeInfo info; +identifier instance_initfn; +@@ + info.instance_init = instance_initfn; + + +@ use_error_abort @ +identifier match_instance_init.instance_initfn; +identifier func_with_error; +expression parentobj, propname, childobj, size, type, errp; +position pos;Quoted 8 lines
Quoted 8 lines
scripts/coccinelle/use-error_abort-in-instance_init.cocci line 39
Quoted 8 lines
scripts/coccinelle/use-error_abort-in-instance_init.cocci new file +8
-0+@@ +void instance_initfn(...) +{ + <+... +( + object_initialize_child(parentobj, propname, + childobj, size, type, + errp, NULL);I think, it doesn't actually differs from just
object_initialize_child(..., NULL); and you don't need all these metavaraiblesQuoted 7 lines
Quoted 7 lines
Quoted 5 lines
scripts/coccinelle/use-error_abort-in-instance_init.cocci new file +5
-0+| + func_with_error@pos(..., +- NULL); ++ &error_abort); +)Quoted 8 lines
Quoted 1 line
Hmm. I don't follow, what are you trying to achieve by this ( | ) construction? The second pattern (
func_with_error...) will be matched anyway, with or without first pattern (object_initialize_child...) matched. And first pattern does nothing.Expected behavior :)
If
object_initialize_child()matched:
do nothing.
Else:
transform.Ah, understand, thanks. Checked, it works.
Possibly simpler way is just define
func_with_errnoidentifier like this:Quoted 7 lines
Quoted 1 line
Quoted 1 line
identifier
func_with_error!=object_initialize_child;Thanks for the tip Vladimir, I simplified as:
@
use_error_abort@
identifier match_instance_init.instance_initfn;
identifierfunc_with_error!= {qbus_create_inplace,object_initialize_child};New syntax for me, great)
Quoted 11 lines
position pos;
@@
voidinstance_initfn(...){ <+... func_with_error@pos(...,(quoted diff) +1
-1- NULL); + &error_abort); ...+>}
Quoted 1 line
BTW do you know how to automatically add an include ("
qapi/error.h" below)?No, I don't.
I can guess something like this
@
already_has_include@
@@
Quoted 6 lines
#include <
qapi/error.h>@ depends on !already_has_include &&
use_error_abort@#include ...
+#include <qapi/error.h>
OMG this works!
@ depends on !has_qapi_error && use_error_abort @
@@
#include ...
+ #include "qapi/error.h"
Produces:
e1000.c +2 -1
@@ -39,6 +39,7 @@#include "e1000x_common.h" #include "trace.h" +#include "qapi/error.h" static const uint8_t bcast[] = {0xff ,0xff ,0xff ,0xff ,0xff ,0xff };
@@ -1774,7 +1775,7 @@ static void e1000_instance_init(Object *E1000State *n =E1000 (obj);device_add_bootindex_property (obj, &n->conf.bootindex,"bootindex" ,"/ethernet-phy@0" , -DEVICE (n),NULL ); +DEVICE (n), &error_abort); }
Quoted 55 lines
===
or maybe in one rule:
@@
... when !=error.h
#include ...
+#include <qapi/error.h>
... when !=error.h(possibly last line is not needed)..
what spec says about includes:
An #include may be followed by "...", <...> or simply .... With either quotes or angle brackets, it is possible to put a partial path, ending with ..., such as <
include/...>, or to put a complete path. A #include with ... matches any include, with either quotes or angle brackets. Partial paths or complete are not allowed in the latter case. Something that is added before an include will be put before the last matching include that is not under an ifdef in the file. Likewise, something that is added after an include will be put after the last matching include that is not under an ifdef in the file.Quoted 22 lines
Quoted 22 lines
Quoted 22 lines
Quoted 22 lines
Quoted 22 lines
Quoted 22 lines
scripts/coccinelle/use-error_abort-in-instance_init.cocci new file +8
-0+ ...+> +} + + +@script:python depends on use_error_abort && !has_qapi_error@ +p << use_error_abort.pos; +@@ +print('[[manual edit required, %s misses #include "qapi/error.h"]]' % p[0].file)MAINTAINERS +1
-0@@ -2059,6 +2059,7 @@ F: scripts/coccinelle/error-use-after-free.cocci F: scripts/coccinelle/error_propagate_null.cocci F: scripts/coccinelle/remove_local_err.cocci F: scripts/coccinelle/simplify-init-realize-error_propagate.cocci +F: scripts/coccinelle/use-error_abort-in-instance_init.cocciQuoted 9 lines
Quoted 8 lines
Quoted 8 lines
Quoted 6 lines
Quoted 5 lines
MAINTAINERS F: scripts/coccinelle/error-use-after-free.cocci · line 2065
Quoted 3 lines
MAINTAINERS +0
-0F: scripts/coccinelle/use-error_fatal.cocci F: scripts/coccinelle/use-error_propagate-in-realize.cocci--
Best regards,
Vladimir
PATCH v2 49/54 various: Use &error_abort in instance_init()
In reply to Philippe Mathieu-DaudéPatch created mechanically by running:
$ spatch \
--macro-file scripts/cocci-macro-file.h \
--include-headers --keep-comments --in-place \
--sp-file \
scripts/coccinelle/use-error_abort-in-instance_init.cocci--- backends/cryptodev-vhost-user.c | 2 +- backends/rng-egd.c | 2 +- backends/rng-random.c | 2 +- backends/vhost-user.c | 3 ++- hw/arm/bcm2835_peripherals.c | 6 ++++-- hw/arm/vexpress.c | 8 ++++---- hw/arm/xlnx-zcu102.c | 8 ++++---- hw/block/fdc.c | 4 ++-- hw/block/vhost-user-blk.c | 2 +- hw/block/virtio-blk.c | 2 +- hw/core/machine.c | 6 +++--- hw/cpu/core.c | 4 ++-- hw/display/vga-pci.c | 7 +++++-- hw/display/xlnx_dp.c | 4 ++-- hw/dma/sparc32_dma.c | 2 +- hw/gpio/aspeed_gpio.c | 2 +- hw/ide/macio.c | 4 +++- hw/ide/qdev.c | 4 ++-- hw/intc/apic_common.c | 2 +- hw/mem/nvdimm.c | 4 ++-- hw/misc/aspeed_sdmc.c | 2 +- hw/misc/edu.c | 3 ++- hw/misc/macio/macio.c | 4 ++-- hw/misc/macio/pmu.c | 3 ++- hw/misc/pca9552.c | 2 +- hw/misc/tmp105.c | 2 +- hw/misc/tmp421.c | 8 ++++---- hw/net/e1000.c | 3 ++- hw/net/lance.c | 3 ++- hw/net/lasi_i82596.c | 3 ++- hw/net/ne2000-isa.c | 4 ++-- hw/net/spapr_llan.c | 2 +- hw/net/virtio-net.c | 2 +- hw/pci-host/grackle.c | 2 +- hw/pci-host/i440fx.c | 8 ++++---- hw/pci-host/prep.c | 2 +- hw/pci-host/q35.c | 23 ++++++++++++++--------- hw/pci-host/sabre.c | 3 ++- hw/pci-host/uninorth.c | 9 +++++---- hw/pcmcia/pxa2xx.c | 3 ++- hw/ppc/spapr_drc.c | 6 +++--- hw/ppc/spapr_rng.c | 2 +- hw/riscv/sifive_u.c | 4 ++-- hw/s390x/event-facility.c | 6 +++--- hw/s390x/s390-ccw.c | 2 +- hw/s390x/s390-skeys.c | 4 ++-- hw/s390x/s390-stattrib.c | 4 ++-- hw/s390x/sclp.c | 2 +- hw/scsi/scsi-bus.c | 2 +- hw/ssi/xilinx_spips.c | 2 +- hw/usb/bus.c | 4 ++-- hw/usb/dev-network.c | 2 +- hw/usb/dev-storage.c | 4 ++-- hw/usb/host-libusb.c | 2 +- hw/usb/redirect.c | 2 +- hw/virtio/virtio-balloon.c | 4 ++-- net/dump.c | 4 ++-- net/filter-buffer.c | 2 +- net/filter-mirror.c | 10 +++++----- net/filter-rewriter.c | 3 ++- target/arm/cpu64.c | 4 ++-- target/i386/cpu.c | 23 ++++++++++++++--------- target/s390x/cpu.c | 3 ++- tests/check-qom-proplist.c | 7 ++++--- tests/test-qdev-global-props.c | 4 ++-- 65 files changed, 155 insertions(+), 126 deletions(-)
backends/cryptodev-vhost-user.c +1 -1
@@ -341,7 +341,7 @@ static void cryptodev_vhost_user_instance_int(Object *obj)object_property_add_str (obj,"chardev" , cryptodev_vhost_user_get_chardev, cryptodev_vhost_user_set_chardev, -NULL ); + &error_abort); }static void cryptodev_vhost_user_finalize (Object *obj)
backends/rng-egd.c +1 -1
@@ -139,7 +139,7 @@ static void rng_egd_init(Object *obj) {object_property_add_str (obj,"chardev" , rng_egd_get_chardev, rng_egd_set_chardev, -NULL ); + &error_abort); }static void rng_egd_finalize (Object *obj)
backends/rng-random.c +1 -1
@@ -111,7 +111,7 @@ static void rng_random_init(Object *obj)object_property_add_str (obj,"filename" , rng_random_get_filename, rng_random_set_filename, -NULL ); + &error_abort); s->filename =g_strdup ("/dev/urandom" ); s->fd =-1 ;
backends/vhost-user.c +2 -1
@@ -177,7 +177,8 @@ static char *get_chardev(Object *obj, Error **errp)static void vhost_user_backend_init (Object *obj) { -object_property_add_str (obj,"chardev" , get_chardev, set_chardev,NULL ); +object_property_add_str (obj,"chardev" , get_chardev, set_chardev, + &error_abort); }static void vhost_user_backend_finalize (Object *obj)
hw/arm/bcm2835_peripherals.c +4 -2
@@ -43,12 +43,14 @@ static void bcm2835_peripherals_init(Object *obj)/* Memory region for peripheral devices, which we export to our parent */ memory_region_init (&s->peri_mr, obj,"bcm2835-peripherals" ,0x1000000 ); -object_property_add_child (obj,"peripheral-io" ,OBJECT (&s->peri_mr),NULL ); +object_property_add_child (obj,"peripheral-io" ,OBJECT (&s->peri_mr), + &error_abort);sysbus_init_mmio (SYS_BUS_DEVICE (s), &s->peri_mr);/* Internal memory region for peripheral bus addresses (not exported) */ memory_region_init (&s->gpu_bus_mr, obj,"bcm2835-gpu" , (uint64_t )1 <<32 ); -object_property_add_child (obj,"gpu-bus" ,OBJECT (&s->gpu_bus_mr),NULL ); +object_property_add_child (obj,"gpu-bus" ,OBJECT (&s->gpu_bus_mr), + &error_abort);/* Internal memory region for request/response communication with * mailbox-addressable peripherals (not exported)
hw/arm/vexpress.c +4 -4
@@ -749,11 +749,11 @@ static void vexpress_instance_init(Object *obj)/* EL3 is enabled by default on vexpress */ vms->secure = true;object_property_add_bool (obj,"secure" , vexpress_get_secure, - vexpress_set_secure,NULL ); + vexpress_set_secure, &error_abort);object_property_set_description (obj,"secure" ,"Set on/off to enable/disable the ARM " "Security Extensions (TrustZone)" , -NULL ); + &error_abort); }static void vexpress_a15_instance_init (Object *obj)
@@ -766,12 +766,12 @@ static void vexpress_a15_instance_init(Object *obj)*/ vms->virt = true;object_property_add_bool (obj,"virtualization" , vexpress_get_virt, - vexpress_set_virt,NULL ); + vexpress_set_virt, &error_abort);object_property_set_description (obj,"virtualization" ,"Set on/off to enable/disable the ARM " "Virtualization Extensions " "(defaults to same as 'secure')" , -NULL ); + &error_abort); }static void vexpress_a9_instance_init (Object *obj)
hw/arm/xlnx-zcu102.c +4 -4
@@ -178,21 +178,21 @@ static void xlnx_zcu102_machine_instance_init(Object *obj)/* Default to secure mode being disabled */ s->secure = false;object_property_add_bool (obj,"secure" , zcu102_get_secure, - zcu102_set_secure,NULL ); + zcu102_set_secure, &error_abort);object_property_set_description (obj,"secure" ,"Set on/off to enable/disable the ARM " "Security Extensions (TrustZone)" , -NULL ); + &error_abort);/* Default to virt (EL2) being disabled */ s->virt = false;object_property_add_bool (obj,"virtualization" , zcu102_get_virt, - zcu102_set_virt,NULL ); + zcu102_set_virt, &error_abort);object_property_set_description (obj,"virtualization" ,"Set on/off to enable/disable emulating a " "guest CPU which implements the ARM " "Virtualization Extensions" , -NULL ); + &error_abort); }static void xlnx_zcu102_machine_class_init (ObjectClass *oc,void *data)
hw/block/fdc.c +2 -2
@@ -2812,10 +2812,10 @@ static void isabus_fdc_instance_init(Object *obj)device_add_bootindex_property (obj, &isa->bootindexA,"bootindexA" ,"/floppy@0" , -DEVICE (obj),NULL ); +DEVICE (obj), &error_abort);device_add_bootindex_property (obj, &isa->bootindexB,"bootindexB" ,"/floppy@1" , -DEVICE (obj),NULL ); +DEVICE (obj), &error_abort); }static const TypeInfo isa_fdc_info = {
hw/block/vhost-user-blk.c +1 -1
@@ -477,7 +477,7 @@ static void vhost_user_blk_instance_init(Object *obj)VHostUserBlk *s =VHOST_USER_BLK (obj);device_add_bootindex_property (obj, &s->bootindex,"bootindex" , -"/disk@0,0" ,DEVICE (obj),NULL ); +"/disk@0,0" ,DEVICE (obj), &error_abort); }static const VMStateDescription vmstate_vhost_user_blk = {
hw/block/virtio-blk.c +1 -1
@@ -1248,7 +1248,7 @@ static void virtio_blk_instance_init(Object *obj)device_add_bootindex_property (obj, &s->conf.conf.bootindex,"bootindex" ,"/disk@0,0" , -DEVICE (obj),NULL ); +DEVICE (obj), &error_abort); }static const VMStateDescription vmstate_virtio_blk = {
hw/core/machine.c +3 -3
@@ -894,7 +894,7 @@ static void machine_initfn(Object *obj) &error_abort);object_property_set_description (obj,"nvdimm" ,"Set on/off to enable/disable " -"NVDIMM instantiation" ,NULL ); +"NVDIMM instantiation" , &error_abort); object_property_add_str(obj, "nvdimm-persistence", machine_get_nvdimm_persistence,
@@ -903,7 +903,7 @@ static void machine_initfn(Object *obj)object_property_set_description (obj,"nvdimm-persistence" ,"Set NVDIMM persistence" "Valid values are cpu, mem-ctrl" , -NULL ); + &error_abort); }if (mc->cpu_index_to_instance_props && mc->get_default_cpu_node_id) {
@@ -914,7 +914,7 @@ static void machine_initfn(Object *obj)object_property_set_description (obj,"hmat" ,"Set on/off to enable/disable " "ACPI Heterogeneous Memory Attribute " -"Table (HMAT)" ,NULL ); +"Table (HMAT)" , &error_abort); } object_property_add_str(obj, "memory-backend",
hw/cpu/core.c +2 -2
@@ -76,9 +76,9 @@ static void cpu_core_instance_init(Object *obj)CPUCore *core =CPU_CORE (obj);object_property_add (obj,"core-id" ,"int" , core_prop_get_core_id, - core_prop_set_core_id,NULL ,NULL ,NULL ); + core_prop_set_core_id,NULL ,NULL , &error_abort);object_property_add (obj,"nr-threads" ,"int" , core_prop_get_nr_threads, - core_prop_set_nr_threads,NULL ,NULL ,NULL ); + core_prop_set_nr_threads,NULL ,NULL , &error_abort); core->nr_threads = ms->smp.threads; }
hw/display/vga-pci.c +5 -2
@@ -25,6 +25,7 @@*/ #include "qemu/osdep.h" +#include "qapi/error.h" #include "hw/pci/pci.h" #include "hw/qdev-properties.h" #include "migration/vmstate.h"
@@ -270,7 +271,8 @@ static void pci_std_vga_init(Object *obj) {/* Expose framebuffer byteorder via QOM */ object_property_add_bool (obj,"big-endian-framebuffer" , - vga_get_big_endian_fb, vga_set_big_endian_fb,NULL ); + vga_get_big_endian_fb, vga_set_big_endian_fb, + &error_abort); }static void pci_secondary_vga_realize (PCIDevice *dev,Error **errp)
@@ -321,7 +323,8 @@ static void pci_secondary_vga_init(Object *obj) {/* Expose framebuffer byteorder via QOM */ object_property_add_bool (obj,"big-endian-framebuffer" , - vga_get_big_endian_fb, vga_set_big_endian_fb,NULL ); + vga_get_big_endian_fb, vga_set_big_endian_fb, + &error_abort); }static void pci_secondary_vga_reset (DeviceState *dev)
hw/display/xlnx_dp.c +2 -2
@@ -1249,11 +1249,11 @@ static void xlnx_dp_init(Object *obj)* Initialize DPCD and EDID.. */ s->dpcd =DPCD (aux_create_slave (s->aux_bus,"dpcd" )); -object_property_add_child (OBJECT (s),"dpcd" ,OBJECT (s->dpcd),NULL ); +object_property_add_child (OBJECT (s),"dpcd" ,OBJECT (s->dpcd), &error_abort); s->edid =I2CDDC (qdev_create (BUS (aux_get_i2c_bus (s->aux_bus)),"i2c-ddc" ));i2c_set_slave_address (I2C_SLAVE (s->edid),0x50 ); -object_property_add_child (OBJECT (s),"edid" ,OBJECT (s->edid),NULL ); +object_property_add_child (OBJECT (s),"edid" ,OBJECT (s->edid), &error_abort);fifo8_create (&s->rx_fifo,16 );fifo8_create (&s->tx_fifo,16 );
hw/dma/sparc32_dma.c +1 -1
@@ -264,7 +264,7 @@ static void sparc32_dma_device_init(Object *obj)object_property_add_link (OBJECT (dev),"iommu" ,TYPE_SUN4M_IOMMU , (Object **) &s->iommu, qdev_prop_allow_set_link_before_realize, -0 ,NULL ); +0 , &error_abort);qdev_init_gpio_in (dev, dma_set_irq,1 );qdev_init_gpio_out (dev, s->gpio,2 );
hw/gpio/aspeed_gpio.c +1 -1
@@ -873,7 +873,7 @@ static void aspeed_gpio_init(Object *obj) name =g_strdup_printf ("gpio%s%d" , props->group_label[group_idx], pin_idx %GPIOS_PER_GROUP );object_property_add (obj, name,"bool" , aspeed_gpio_get_pin, - aspeed_gpio_set_pin,NULL ,NULL ,NULL ); + aspeed_gpio_set_pin,NULL ,NULL , &error_abort);g_free (name); } }
hw/ide/macio.c +3 -1
@@ -24,6 +24,7 @@*/ #include "qemu/osdep.h" +#include "qapi/error.h" #include "hw/ppc/mac.h" #include "hw/ppc/mac_dbdma.h" #include "hw/qdev-properties.h"
@@ -459,7 +460,8 @@ static void macio_ide_initfn(Object *obj)object_property_add_link (obj,"dbdma" ,TYPE_MAC_DBDMA , (Object **) &s->dbdma, - qdev_prop_allow_set_link_before_realize,0 ,NULL ); + qdev_prop_allow_set_link_before_realize,0 , + &error_abort); }static Property macio_ide_properties[] = {
hw/ide/qdev.c +2 -2
@@ -266,8 +266,8 @@ static void ide_dev_instance_init(Object *obj) {object_property_add (obj,"bootindex" ,"int32" , ide_dev_get_bootindex, - ide_dev_set_bootindex,NULL ,NULL ,NULL ); -object_property_set_int (obj,-1 ,"bootindex" ,NULL ); + ide_dev_set_bootindex,NULL ,NULL , &error_abort); +object_property_set_int (obj,-1 ,"bootindex" , &error_abort); }static void ide_hd_realize (IDEDevice *dev,Error **errp)
hw/intc/apic_common.c +1 -1
@@ -445,7 +445,7 @@ static void apic_common_initfn(Object *obj) s->id = s->initial_apic_id =-1 ;object_property_add (obj,"id" ,"uint32" , apic_common_get_id, - apic_common_set_id,NULL ,NULL ,NULL ); + apic_common_set_id,NULL ,NULL , &error_abort); }static void apic_common_class_init (ObjectClass *klass,void *data)
hw/mem/nvdimm.c +2 -2
@@ -110,10 +110,10 @@ static void nvdimm_init(Object *obj) {object_property_add (obj,NVDIMM_LABEL_SIZE_PROP ,"int" , nvdimm_get_label_size, nvdimm_set_label_size,NULL , -NULL ,NULL ); +NULL , &error_abort);object_property_add (obj,NVDIMM_UUID_PROP ,"QemuUUID" , nvdimm_get_uuid, - nvdimm_set_uuid,NULL ,NULL ,NULL ); + nvdimm_set_uuid,NULL ,NULL , &error_abort); }static void nvdimm_finalize (Object *obj)
hw/misc/aspeed_sdmc.c +1 -1
@@ -255,7 +255,7 @@ static void aspeed_sdmc_initfn(Object *obj) {object_property_add (obj,"ram-size" ,"int" , aspeed_sdmc_get_ram_size, aspeed_sdmc_set_ram_size, -NULL ,NULL ,NULL ); +NULL ,NULL , &error_abort); }static void aspeed_sdmc_realize (DeviceState *dev,Error **errp)
hw/misc/edu.c +2 -1
@@ -23,6 +23,7 @@*/ #include "qemu/osdep.h" +#include "qapi/error.h" #include "qemu/units.h" #include "hw/pci/pci.h" #include "hw/hw.h"
@@ -403,7 +404,7 @@ static void edu_instance_init(Object *obj) edu->dma_mask = (1UL <<28 ) -1 ;object_property_add_uint64_ptr (obj,"dma_mask" , &edu->dma_mask,OBJ_PROP_FLAG_READWRITE , -NULL ); + &error_abort); }static void edu_class_init (ObjectClass *class,void *data)
hw/misc/macio/macio.c +2 -2
@@ -241,7 +241,7 @@ static void macio_oldworld_init(Object *obj)object_property_add_link (obj,"pic" ,TYPE_HEATHROW , (Object **) &os->pic, qdev_prop_allow_set_link_before_realize, -0 ,NULL ); +0 , &error_abort);macio_init_child_obj (s,"cuda" , &s->cuda,sizeof (s->cuda),TYPE_CUDA );
@@ -401,7 +401,7 @@ static void macio_newworld_init(Object *obj)object_property_add_link (obj,"pic" ,TYPE_OPENPIC , (Object **) &ns->pic, qdev_prop_allow_set_link_before_realize, -0 ,NULL ); +0 , &error_abort);macio_init_child_obj (s,"gpio" , &ns->gpio,sizeof (ns->gpio),TYPE_MACIO_GPIO );
hw/misc/macio/pmu.c +2 -1
@@ -30,6 +30,7 @@#include "qemu/osdep.h" #include "qemu-common.h" +#include "qapi/error.h" #include "hw/ppc/mac.h" #include "hw/qdev-properties.h" #include "migration/vmstate.h"
@@ -773,7 +774,7 @@ static void pmu_init(Object *obj)object_property_add_link (obj,"gpio" ,TYPE_MACIO_GPIO , (Object **) &s->gpio, qdev_prop_allow_set_link_before_realize, -0 ,NULL ); +0 , &error_abort);sysbus_init_child_obj (obj,"mos6522-pmu" , &s->mos6522_pmu,sizeof (s->mos6522_pmu),TYPE_MOS6522_PMU );
hw/misc/pca9552.c +1 -1
@@ -298,7 +298,7 @@ static void pca9552_initfn(Object *obj) name =g_strdup_printf ("led%d" , led);object_property_add (obj, name,"bool" , pca9552_get_led, pca9552_set_led, -NULL ,NULL ,NULL ); +NULL ,NULL , &error_abort);g_free (name); } }
hw/misc/tmp105.c +1 -1
@@ -245,7 +245,7 @@ static void tmp105_initfn(Object *obj) {object_property_add (obj,"temperature" ,"int" , tmp105_get_temperature, - tmp105_set_temperature,NULL ,NULL ,NULL ); + tmp105_set_temperature,NULL ,NULL , &error_abort); }static void tmp105_class_init (ObjectClass *klass,void *data)
hw/misc/tmp421.c +4 -4
@@ -347,16 +347,16 @@ static void tmp421_initfn(Object *obj) {object_property_add (obj,"temperature0" ,"int" , tmp421_get_temperature, - tmp421_set_temperature,NULL ,NULL ,NULL ); + tmp421_set_temperature,NULL ,NULL , &error_abort);object_property_add (obj,"temperature1" ,"int" , tmp421_get_temperature, - tmp421_set_temperature,NULL ,NULL ,NULL ); + tmp421_set_temperature,NULL ,NULL , &error_abort);object_property_add (obj,"temperature2" ,"int" , tmp421_get_temperature, - tmp421_set_temperature,NULL ,NULL ,NULL ); + tmp421_set_temperature,NULL ,NULL , &error_abort);object_property_add (obj,"temperature3" ,"int" , tmp421_get_temperature, - tmp421_set_temperature,NULL ,NULL ,NULL ); + tmp421_set_temperature,NULL ,NULL , &error_abort); }static void tmp421_class_init (ObjectClass *klass,void *data)
hw/net/e1000.c +2 -1
@@ -26,6 +26,7 @@#include "qemu/osdep.h" +#include "qapi/error.h" #include "hw/pci/pci.h" #include "hw/qdev-properties.h" #include "migration/vmstate.h"
@@ -1774,7 +1775,7 @@ static void e1000_instance_init(Object *obj)E1000State *n =E1000 (obj);device_add_bootindex_property (obj, &n->conf.bootindex,"bootindex" ,"/ethernet-phy@0" , -DEVICE (n),NULL ); +DEVICE (n), &error_abort); }static const TypeInfo e1000_base_info = {
hw/net/lance.c +2 -1
@@ -38,6 +38,7 @@#include "qemu/osdep.h" #include "qemu/module.h" #include "qemu/timer.h" +#include "qapi/error.h" #include "hw/sparc/sparc32_dma.h" #include "migration/vmstate.h" #include "hw/net/lance.h"
@@ -134,7 +135,7 @@ static void lance_instance_init(Object *obj)device_add_bootindex_property (obj, &s->conf.bootindex,"bootindex" ,"/ethernet-phy@0" , -DEVICE (obj),NULL ); +DEVICE (obj), &error_abort); }static Property lance_properties[] = {
hw/net/lasi_i82596.c +2 -1
@@ -11,6 +11,7 @@*/ #include "qemu/osdep.h" +#include "qapi/error.h" #include "qemu/timer.h" #include "hw/sysbus.h" #include "net/eth.h"
@@ -152,7 +153,7 @@ static void lasi_82596_instance_init(Object *obj)device_add_bootindex_property (obj, &s->conf.bootindex,"bootindex" ,"/ethernet-phy@0" , -DEVICE (obj),NULL ); +DEVICE (obj), &error_abort); }static Property lasi_82596_properties[] = {
hw/net/ne2000-isa.c +2 -2
@@ -133,8 +133,8 @@ static void isa_ne2000_instance_init(Object *obj) {object_property_add (obj,"bootindex" ,"int32" , isa_ne2000_get_bootindex, - isa_ne2000_set_bootindex,NULL ,NULL ,NULL ); -object_property_set_int (obj,-1 ,"bootindex" ,NULL ); + isa_ne2000_set_bootindex,NULL ,NULL , &error_abort); +object_property_set_int (obj,-1 ,"bootindex" , &error_abort); }static const TypeInfo ne2000_isa_info = { .name =TYPE_ISA_NE2000 ,
hw/net/spapr_llan.c +1 -1
@@ -340,7 +340,7 @@ static void spapr_vlan_instance_init(Object *obj)device_add_bootindex_property (obj, &dev->nicconf.bootindex,"bootindex" ,"" , -DEVICE (dev),NULL ); +DEVICE (dev), &error_abort);if (dev->compat_flags &SPAPRVLAN_FLAG_RX_BUF_POOLS ) {for (i =0 ; i <RX_MAX_POOLS ; i++) {
hw/net/virtio-net.c +1 -1
@@ -3122,7 +3122,7 @@ static void virtio_net_instance_init(Object *obj) n->config_size =sizeof (struct virtio_net_config );device_add_bootindex_property (obj, &n->nic_conf.bootindex,"bootindex" ,"/ethernet-phy@0" , -DEVICE (n),NULL ); +DEVICE (n), &error_abort); }static int virtio_net_pre_save (void *opaque)
hw/pci-host/grackle.c +1 -1
@@ -109,7 +109,7 @@ static void grackle_init(Object *obj)object_property_add_link (obj,"pic" ,TYPE_HEATHROW , (Object **) &s->pic, qdev_prop_allow_set_link_before_realize, -0 ,NULL ); +0 , &error_abort);sysbus_init_mmio (sbd, &phb->conf_mem);sysbus_init_mmio (sbd, &phb->data_mem);
hw/pci-host/i440fx.c +4 -4
@@ -212,19 +212,19 @@ static void i440fx_pcihost_initfn(Object *obj)object_property_add (obj,PCI_HOST_PROP_PCI_HOLE_START ,"uint32" , i440fx_pcihost_get_pci_hole_start, -NULL ,NULL ,NULL ,NULL ); +NULL ,NULL ,NULL , &error_abort);object_property_add (obj,PCI_HOST_PROP_PCI_HOLE_END ,"uint32" , i440fx_pcihost_get_pci_hole_end, -NULL ,NULL ,NULL ,NULL ); +NULL ,NULL ,NULL , &error_abort);object_property_add (obj,PCI_HOST_PROP_PCI_HOLE64_START ,"uint64" , i440fx_pcihost_get_pci_hole64_start, -NULL ,NULL ,NULL ,NULL ); +NULL ,NULL ,NULL , &error_abort);object_property_add (obj,PCI_HOST_PROP_PCI_HOLE64_END ,"uint64" , i440fx_pcihost_get_pci_hole64_end, -NULL ,NULL ,NULL ,NULL ); +NULL ,NULL ,NULL , &error_abort); }static void i440fx_pcihost_realize (DeviceState *dev,Error **errp)
hw/pci-host/prep.c +1 -1
@@ -311,7 +311,7 @@ static void raven_pcihost_initfn(Object *obj) pci_dev =DEVICE (&s->pci_dev);qdev_set_parent_bus (pci_dev,BUS (&s->pci_bus));object_property_set_int (OBJECT (&s->pci_dev),PCI_DEVFN (0 ,0 ),"addr" , -NULL ); + &error_abort);qdev_prop_set_bit (pci_dev,"multifunction" , false); }
hw/pci-host/q35.c +14 -9
@@ -222,38 +222,43 @@ static void q35_host_initfn(Object *obj) Q35_PCI_HOST_HOLE64_SIZE_DEFAULT);object_property_add (obj,PCI_HOST_PROP_PCI_HOLE_START ,"uint32" , q35_host_get_pci_hole_start, -NULL ,NULL ,NULL ,NULL ); +NULL ,NULL ,NULL , &error_abort);object_property_add (obj,PCI_HOST_PROP_PCI_HOLE_END ,"uint32" , q35_host_get_pci_hole_end, -NULL ,NULL ,NULL ,NULL ); +NULL ,NULL ,NULL , &error_abort);object_property_add (obj,PCI_HOST_PROP_PCI_HOLE64_START ,"uint64" , q35_host_get_pci_hole64_start, -NULL ,NULL ,NULL ,NULL ); +NULL ,NULL ,NULL , &error_abort);object_property_add (obj,PCI_HOST_PROP_PCI_HOLE64_END ,"uint64" , q35_host_get_pci_hole64_end, -NULL ,NULL ,NULL ,NULL ); +NULL ,NULL ,NULL , &error_abort);object_property_add_uint64_ptr (obj,PCIE_HOST_MCFG_SIZE , - &pehb->size,OBJ_PROP_FLAG_READ ,NULL ); + &pehb->size,OBJ_PROP_FLAG_READ , + &error_abort);object_property_add_link (obj,MCH_HOST_PROP_RAM_MEM ,TYPE_MEMORY_REGION , (Object **) &s->mch.ram_memory, - qdev_prop_allow_set_link_before_realize,0 ,NULL ); + qdev_prop_allow_set_link_before_realize,0 , + &error_abort);object_property_add_link (obj,MCH_HOST_PROP_PCI_MEM ,TYPE_MEMORY_REGION , (Object **) &s->mch.pci_address_space, - qdev_prop_allow_set_link_before_realize,0 ,NULL ); + qdev_prop_allow_set_link_before_realize,0 , + &error_abort);object_property_add_link (obj,MCH_HOST_PROP_SYSTEM_MEM ,TYPE_MEMORY_REGION , (Object **) &s->mch.system_memory, - qdev_prop_allow_set_link_before_realize,0 ,NULL ); + qdev_prop_allow_set_link_before_realize,0 , + &error_abort);object_property_add_link (obj,MCH_HOST_PROP_IO_MEM ,TYPE_MEMORY_REGION , (Object **) &s->mch.address_space_io, - qdev_prop_allow_set_link_before_realize,0 ,NULL ); + qdev_prop_allow_set_link_before_realize,0 , + &error_abort); }static const TypeInfo q35_host_info = {
hw/pci-host/sabre.c +2 -1
@@ -25,6 +25,7 @@*/ #include "qemu/osdep.h" +#include "qapi/error.h" #include "hw/sysbus.h" #include "hw/pci/pci.h" #include "hw/pci/pci_host.h"
@@ -442,7 +443,7 @@ static void sabre_init(Object *obj)object_property_add_link (obj,"iommu" ,TYPE_SUN4U_IOMMU , (Object **) &s->iommu, qdev_prop_allow_set_link_before_realize, -0 ,NULL ); +0 , &error_abort);/* sabre_config */ memory_region_init_io(&s->sabre_config, OBJECT(s), &sabre_config_ops, s,
hw/pci-host/uninorth.c +5 -4
@@ -23,6 +23,7 @@*/ #include "qemu/osdep.h" +#include "qapi/error.h" #include "hw/irq.h" #include "hw/ppc/mac.h" #include "hw/qdev-properties.h"
@@ -175,7 +176,7 @@ static void pci_unin_main_init(Object *obj)object_property_add_link (obj,"pic" ,TYPE_OPENPIC , (Object **) &s->pic, qdev_prop_allow_set_link_before_realize, -0 ,NULL ); +0 , &error_abort);sysbus_init_mmio (sbd, &h->conf_mem);sysbus_init_mmio (sbd, &h->data_mem);
@@ -223,7 +224,7 @@ static void pci_u3_agp_init(Object *obj)object_property_add_link (obj,"pic" ,TYPE_OPENPIC , (Object **) &s->pic, qdev_prop_allow_set_link_before_realize, -0 ,NULL ); +0 , &error_abort);sysbus_init_mmio (sbd, &h->conf_mem);sysbus_init_mmio (sbd, &h->data_mem);
@@ -262,7 +263,7 @@ static void pci_unin_agp_init(Object *obj)object_property_add_link (obj,"pic" ,TYPE_OPENPIC , (Object **) &s->pic, qdev_prop_allow_set_link_before_realize, -0 ,NULL ); +0 , &error_abort);sysbus_init_mmio (sbd, &h->conf_mem);sysbus_init_mmio (sbd, &h->data_mem);
@@ -299,7 +300,7 @@ static void pci_unin_internal_init(Object *obj)object_property_add_link (obj,"pic" ,TYPE_OPENPIC , (Object **) &s->pic, qdev_prop_allow_set_link_before_realize, -0 ,NULL ); +0 , &error_abort);sysbus_init_mmio (sbd, &h->conf_mem);sysbus_init_mmio (sbd, &h->data_mem);
hw/pcmcia/pxa2xx.c +2 -1
@@ -11,6 +11,7 @@*/ #include "qemu/osdep.h" +#include "qapi/error.h" #include "hw/irq.h" #include "hw/sysbus.h" #include "qemu/module.h"
@@ -189,7 +190,7 @@ static void pxa2xx_pcmcia_initfn(Object *obj)object_property_add_link (obj,"card" ,TYPE_PCMCIA_CARD , (Object **)&s->card,NULL ,/* read-only property */ -0 ,NULL ); +0 , &error_abort); }/* Insert a new card into a slot */
hw/ppc/spapr_drc.c +3 -3
@@ -584,11 +584,11 @@ static void spapr_dr_connector_instance_init(Object *obj)SpaprDrcClass *drck =SPAPR_DR_CONNECTOR_GET_CLASS (drc);object_property_add_uint32_ptr (obj,"id" , &drc->id,OBJ_PROP_FLAG_READ , -NULL ); + &error_abort);object_property_add (obj,"index" ,"uint32" , prop_get_index, -NULL ,NULL ,NULL ,NULL ); +NULL ,NULL ,NULL , &error_abort);object_property_add (obj,"fdt" ,"struct" , prop_get_fdt, -NULL ,NULL ,NULL ,NULL ); +NULL ,NULL ,NULL , &error_abort); drc->state = drck->empty_state; }
hw/ppc/spapr_rng.c +1 -1
@@ -104,7 +104,7 @@ static void spapr_rng_instance_init(Object *obj)object_property_set_description (obj,"rng" ,"ID of the random number generator backend" , -NULL ); + &error_abort); }static void spapr_rng_realize (DeviceState *dev,Error **errp)
hw/riscv/sifive_u.c +2 -2
@@ -487,11 +487,11 @@ static void riscv_sifive_u_machine_instance_init(Object *obj) s->start_in_flash = false;object_property_add_bool (obj,"start-in-flash" , sifive_u_get_start_in_flash, - sifive_u_set_start_in_flash,NULL ); + sifive_u_set_start_in_flash, &error_abort);object_property_set_description (obj,"start-in-flash" ,"Set on to tell QEMU's ROM to jump to " "flash. Otherwise QEMU will jump to DRAM" , -NULL ); + &error_abort); }static void riscv_sifive_u_soc_realize (DeviceState *dev,Error **errp)
hw/s390x/event-facility.c +3 -3
@@ -449,18 +449,18 @@ static void init_event_facility(Object *obj) event_facility->allow_all_mask_sizes = true;object_property_add_bool (obj,"allow_all_mask_sizes" , sclp_event_get_allow_all_mask_sizes, - sclp_event_set_allow_all_mask_sizes,NULL ); + sclp_event_set_allow_all_mask_sizes, &error_abort);/* Spawn a new bus for SCLP events */ qbus_create_inplace (&event_facility->sbus,sizeof (event_facility->sbus),TYPE_SCLP_EVENTS_BUS , sdev,NULL ); new =object_new (TYPE_SCLP_QUIESCE ); -object_property_add_child (obj,TYPE_SCLP_QUIESCE , new,NULL ); +object_property_add_child (obj,TYPE_SCLP_QUIESCE , new, &error_abort);object_unref (new);qdev_set_parent_bus (DEVICE (new),BUS (&event_facility->sbus)); new =object_new (TYPE_SCLP_CPU_HOTPLUG ); -object_property_add_child (obj,TYPE_SCLP_CPU_HOTPLUG , new,NULL ); +object_property_add_child (obj,TYPE_SCLP_CPU_HOTPLUG , new, &error_abort);object_unref (new);qdev_set_parent_bus (DEVICE (new),BUS (&event_facility->sbus));/* the facility will automatically realize the devices via the bus */
hw/s390x/s390-ccw.c +1 -1
@@ -151,7 +151,7 @@ static void s390_ccw_instance_init(Object *obj)S390CCWDevice *dev =S390_CCW_DEVICE (obj);device_add_bootindex_property (obj, &dev->bootindex,"bootindex" , -"/disk@0,0" ,DEVICE (obj),NULL ); +"/disk@0,0" ,DEVICE (obj), &error_abort); }static void s390_ccw_class_init (ObjectClass *klass,void *data)
hw/s390x/s390-skeys.c +2 -2
@@ -400,8 +400,8 @@ static void s390_skeys_instance_init(Object *obj) {object_property_add_bool (obj,"migration-enabled" , s390_skeys_get_migration_enabled, - s390_skeys_set_migration_enabled,NULL ); -object_property_set_bool (obj, true,"migration-enabled" ,NULL ); + s390_skeys_set_migration_enabled, &error_abort); +object_property_set_bool (obj, true,"migration-enabled" , &error_abort); }static void s390_skeys_class_init (ObjectClass *oc,void *data)
hw/s390x/s390-stattrib.c +2 -2
@@ -387,8 +387,8 @@ static void s390_stattrib_instance_init(Object *obj)object_property_add_bool (obj,"migration-enabled" , s390_stattrib_get_migration_enabled, - s390_stattrib_set_migration_enabled,NULL ); -object_property_set_bool (obj, true,"migration-enabled" ,NULL ); + s390_stattrib_set_migration_enabled, &error_abort); +object_property_set_bool (obj, true,"migration-enabled" , &error_abort); sas->migration_cur_gfn =0 ; }
hw/s390x/sclp.c +1 -1
@@ -349,7 +349,7 @@ static void sclp_init(Object *obj)Object *new; new =object_new (TYPE_SCLP_EVENT_FACILITY ); -object_property_add_child (obj,TYPE_SCLP_EVENT_FACILITY , new,NULL ); +object_property_add_child (obj,TYPE_SCLP_EVENT_FACILITY , new, &error_abort);object_unref (new); sclp->event_facility =EVENT_FACILITY (new);
hw/scsi/scsi-bus.c +1 -1
@@ -1738,7 +1738,7 @@ static void scsi_dev_instance_init(Object *obj)device_add_bootindex_property (obj, &s->conf.bootindex,"bootindex" ,NULL , - &s->qdev,NULL ); + &s->qdev, &error_abort); }static const TypeInfo scsi_device_type_info = {
hw/ssi/xilinx_spips.c +1 -1
@@ -1361,7 +1361,7 @@ static void xlnx_zynqmp_qspips_init(Object *obj) (Object **)&rq->dma, object_property_allow_set_link,OBJ_PROP_LINK_STRONG , - NULL); + &error_abort); }static int xilinx_spips_post_load (void *opaque,int version_id)
hw/usb/bus.c +2 -2
@@ -754,11 +754,11 @@ static void usb_device_instance_init(Object *obj)if (klass->attached_settable) {object_property_add_bool (obj,"attached" , usb_get_attached, usb_set_attached, -NULL ); + &error_abort); }else {object_property_add_bool (obj,"attached" , usb_get_attached,NULL , -NULL ); + &error_abort); } }
hw/usb/dev-network.c +1 -1
@@ -1381,7 +1381,7 @@ static void usb_net_instance_init(Object *obj)device_add_bootindex_property (obj, &s->conf.bootindex,"bootindex" ,"/ethernet-phy@0" , - &dev->qdev,NULL ); + &dev->qdev, &error_abort); }static const VMStateDescription vmstate_usb_net = {
hw/usb/dev-storage.c +2 -2
@@ -753,8 +753,8 @@ static void usb_msd_instance_init(Object *obj) {object_property_add (obj,"bootindex" ,"int32" , usb_msd_get_bootindex, - usb_msd_set_bootindex,NULL ,NULL ,NULL ); -object_property_set_int (obj,-1 ,"bootindex" ,NULL ); + usb_msd_set_bootindex,NULL ,NULL , &error_abort); +object_property_set_int (obj,-1 ,"bootindex" , &error_abort); }static void usb_msd_class_bot_initfn (ObjectClass *klass,void *data)
hw/usb/host-libusb.c +1 -1
@@ -1101,7 +1101,7 @@ static void usb_host_instance_init(Object *obj)device_add_bootindex_property (obj, &s->bootindex,"bootindex" ,NULL , - &udev->qdev,NULL ); + &udev->qdev, &error_abort); }static void usb_host_unrealize (USBDevice *udev,Error **errp)
hw/usb/redirect.c +1 -1
@@ -2595,7 +2595,7 @@ static void usbredir_instance_init(Object *obj)device_add_bootindex_property (obj, &dev->bootindex,"bootindex" ,NULL , - &udev->qdev,NULL ); + &udev->qdev, &error_abort); }static const TypeInfo usbredir_dev_info = {
hw/virtio/virtio-balloon.c +2 -2
@@ -893,12 +893,12 @@ static void virtio_balloon_instance_init(Object *obj)VirtIOBalloon *s =VIRTIO_BALLOON (obj);object_property_add (obj,"guest-stats" ,"guest statistics" , - balloon_stats_get_all,NULL ,NULL , s,NULL ); + balloon_stats_get_all,NULL ,NULL , s, &error_abort);object_property_add (obj,"guest-stats-polling-interval" ,"int" , balloon_stats_get_poll_interval, balloon_stats_set_poll_interval, -NULL , s,NULL ); +NULL , s, &error_abort); }static const VMStateDescription vmstate_virtio_balloon = {
net/dump.c +2 -2
@@ -232,9 +232,9 @@ static void filter_dump_instance_init(Object *obj) nfds->maxlen =65536 ;object_property_add (obj,"maxlen" ,"uint32" , filter_dump_get_maxlen, - filter_dump_set_maxlen,NULL ,NULL ,NULL ); + filter_dump_set_maxlen,NULL ,NULL , &error_abort);object_property_add_str (obj,"file" , file_dump_get_filename, - file_dump_set_filename,NULL ); + file_dump_set_filename, &error_abort); }static void filter_dump_instance_finalize (Object *obj)
net/filter-buffer.c +1 -1
@@ -192,7 +192,7 @@ static void filter_buffer_init(Object *obj) {object_property_add (obj,"interval" ,"uint32" , filter_buffer_get_interval, - filter_buffer_set_interval,NULL ,NULL ,NULL ); + filter_buffer_set_interval,NULL ,NULL , &error_abort); }static const TypeInfo filter_buffer_info = {
net/filter-mirror.c +5 -5
@@ -392,12 +392,12 @@ static void filter_mirror_init(Object *obj)MirrorState *s =FILTER_MIRROR (obj);object_property_add_str (obj,"outdev" , filter_mirror_get_outdev, - filter_mirror_set_outdev,NULL ); + filter_mirror_set_outdev, &error_abort); s->vnet_hdr = false;object_property_add_bool (obj,"vnet_hdr_support" , filter_mirror_get_vnet_hdr, - filter_mirror_set_vnet_hdr,NULL ); + filter_mirror_set_vnet_hdr, &error_abort); }static void filter_redirector_init (Object *obj)
@@ -405,14 +405,14 @@ static void filter_redirector_init(Object *obj)MirrorState *s =FILTER_REDIRECTOR (obj);object_property_add_str (obj,"indev" , filter_redirector_get_indev, - filter_redirector_set_indev,NULL ); + filter_redirector_set_indev, &error_abort);object_property_add_str (obj,"outdev" , filter_redirector_get_outdev, - filter_redirector_set_outdev,NULL ); + filter_redirector_set_outdev, &error_abort); s->vnet_hdr = false;object_property_add_bool (obj,"vnet_hdr_support" , filter_redirector_get_vnet_hdr, - filter_redirector_set_vnet_hdr,NULL ); + filter_redirector_set_vnet_hdr, &error_abort); }static void filter_mirror_fini (Object *obj)
net/filter-rewriter.c +2 -1
@@ -10,6 +10,7 @@*/ #include "qemu/osdep.h" +#include "qapi/error.h" #include "trace.h" #include "colo.h" #include "net/filter.h"
@@ -413,7 +414,7 @@ static void filter_rewriter_init(Object *obj) s->failover_mode =FAILOVER_MODE_OFF ;object_property_add_bool (obj,"vnet_hdr_support" , filter_rewriter_get_vnet_hdr, - filter_rewriter_set_vnet_hdr,NULL ); + filter_rewriter_set_vnet_hdr, &error_abort); }static void colo_rewriter_class_init (ObjectClass *oc,void *data)
target/arm/cpu64.c +2 -2
@@ -782,11 +782,11 @@ static void aarch64_cpu_set_aarch64(Object *obj, bool value, Error **errp)static void aarch64_cpu_initfn (Object *obj) {object_property_add_bool (obj,"aarch64" , aarch64_cpu_get_aarch64, - aarch64_cpu_set_aarch64,NULL ); + aarch64_cpu_set_aarch64, &error_abort);object_property_set_description (obj,"aarch64" ,"Set on/off to enable/disable aarch64 " "execution state " , -NULL ); + &error_abort); }static void aarch64_cpu_finalizefn (Object *obj)
target/i386/cpu.c +14 -9
@@ -6905,28 +6905,32 @@ static void x86_cpu_initfn(Object *obj)object_property_add (obj,"family" ,"int" , x86_cpuid_version_get_family, - x86_cpuid_version_set_family,NULL ,NULL ,NULL ); + x86_cpuid_version_set_family,NULL ,NULL , + &error_abort);object_property_add (obj,"model" ,"int" , x86_cpuid_version_get_model, - x86_cpuid_version_set_model,NULL ,NULL ,NULL ); + x86_cpuid_version_set_model,NULL ,NULL , + &error_abort);object_property_add (obj,"stepping" ,"int" , x86_cpuid_version_get_stepping, - x86_cpuid_version_set_stepping,NULL ,NULL ,NULL ); + x86_cpuid_version_set_stepping,NULL ,NULL , + &error_abort);object_property_add_str (obj,"vendor" , x86_cpuid_get_vendor, - x86_cpuid_set_vendor,NULL ); + x86_cpuid_set_vendor, &error_abort);object_property_add_str (obj,"model-id" , x86_cpuid_get_model_id, - x86_cpuid_set_model_id,NULL ); + x86_cpuid_set_model_id, &error_abort);object_property_add (obj,"tsc-frequency" ,"int" , x86_cpuid_get_tsc_freq, - x86_cpuid_set_tsc_freq,NULL ,NULL ,NULL ); + x86_cpuid_set_tsc_freq,NULL ,NULL , &error_abort);object_property_add (obj,"feature-words" ,"X86CPUFeatureWordInfo" , x86_cpu_get_feature_words, -NULL ,NULL , (void *)env->features,NULL ); +NULL ,NULL , (void *)env->features, &error_abort);object_property_add (obj,"filtered-features" ,"X86CPUFeatureWordInfo" , x86_cpu_get_feature_words, -NULL ,NULL , (void *)cpu->filtered_features,NULL ); +NULL ,NULL , (void *)cpu->filtered_features, + &error_abort);/* * The "unavailable-features" property has the same semantics as * CpuDefinitionInfo.unavailable-features on the "query-cpu-definitions"
@@ -6938,7 +6942,8 @@ static void x86_cpu_initfn(Object *obj) NULL, NULL, NULL, &error_abort);object_property_add (obj,"crash-information" ,"GuestPanicInformation" , - x86_cpu_get_crash_info_qom,NULL ,NULL ,NULL ,NULL ); + x86_cpu_get_crash_info_qom,NULL ,NULL ,NULL , + &error_abort);for (w =0 ; w <FEATURE_WORDS ; w++) {int bitnr;
target/s390x/cpu.c +2 -1
@@ -287,7 +287,8 @@ static void s390_cpu_initfn(Object *obj) cs->halted =1 ; cs->exception_index =EXCP_HLT ;object_property_add (obj,"crash-information" ,"GuestPanicInformation" , - s390_cpu_get_crash_info_qom,NULL ,NULL ,NULL ,NULL ); + s390_cpu_get_crash_info_qom,NULL ,NULL ,NULL , + &error_abort);s390_cpu_model_register_props (obj);#if !defined(CONFIG_USER_ONLY ) cpu->env.tod_timer =
tests/check-qom-proplist.c +4 -3
@@ -255,13 +255,14 @@ static void dummy_dev_init(Object *obj)DummyBus *bus =DUMMY_BUS (object_new (TYPE_DUMMY_BUS ));DummyBackend *backend =DUMMY_BACKEND (object_new (TYPE_DUMMY_BACKEND )); -object_property_add_child (obj,"bus" ,OBJECT (bus),NULL ); +object_property_add_child (obj,"bus" ,OBJECT (bus), &error_abort); dev->bus = bus; -object_property_add_child (OBJECT (bus),"backend" ,OBJECT (backend),NULL ); +object_property_add_child (OBJECT (bus),"backend" ,OBJECT (backend), + &error_abort); bus->backend = backend;object_property_add_link (obj,"backend" ,TYPE_DUMMY_BACKEND , - (Object **)&bus->backend,NULL ,0 ,NULL ); + (Object **)&bus->backend,NULL ,0 , &error_abort); }static void dummy_dev_unparent (Object *obj)
tests/test-qdev-global-props.c +2 -2
@@ -151,9 +151,9 @@ static void prop2_accessor(Object *obj, Visitor *v, const char *name,static void dynamic_instance_init (Object *obj) {object_property_add (obj,"prop1" ,"uint32" , prop1_accessor, prop1_accessor, -NULL ,NULL ,NULL ); +NULL ,NULL , &error_abort);object_property_add (obj,"prop2" ,"uint32" , prop2_accessor, prop2_accessor, -NULL ,NULL ,NULL ); +NULL ,NULL , &error_abort); }static void dynamic_class_init (ObjectClass *oc,void *data)
Signature · 1 line
2.21.1
Re: [PATCH-for-5.1 v2 49/54] various: Use &error_abort in instance_init()
Quoted 77 lines · Philippe Mathieu-Daudé
Patch created mechanically by running:
$ spatch \ --macro-file scripts/cocci-macro-file.h \ --include-headers --keep-comments --in-place \ --sp-file \ scripts/coccinelle/use-error_abort-in-instance_init.cocciSigned-off-by Philippe Mathieu-Daudé <[email protected]>--- backends/cryptodev-vhost-user.c | 2 +- backends/rng-egd.c | 2 +- backends/rng-random.c | 2 +- backends/vhost-user.c | 3 ++- hw/arm/bcm2835_peripherals.c | 6 ++++-- hw/arm/vexpress.c | 8 ++++---- hw/arm/xlnx-zcu102.c | 8 ++++---- hw/block/fdc.c | 4 ++-- hw/block/vhost-user-blk.c | 2 +- hw/block/virtio-blk.c | 2 +- hw/core/machine.c | 6 +++--- hw/cpu/core.c | 4 ++-- hw/display/vga-pci.c | 7 +++++-- hw/display/xlnx_dp.c | 4 ++-- hw/dma/sparc32_dma.c | 2 +- hw/gpio/aspeed_gpio.c | 2 +- hw/ide/macio.c | 4 +++- hw/ide/qdev.c | 4 ++-- hw/intc/apic_common.c | 2 +- hw/mem/nvdimm.c | 4 ++-- hw/misc/aspeed_sdmc.c | 2 +- hw/misc/edu.c | 3 ++- hw/misc/macio/macio.c | 4 ++-- hw/misc/macio/pmu.c | 3 ++- hw/misc/pca9552.c | 2 +- hw/misc/tmp105.c | 2 +- hw/misc/tmp421.c | 8 ++++---- hw/net/e1000.c | 3 ++- hw/net/lance.c | 3 ++- hw/net/lasi_i82596.c | 3 ++- hw/net/ne2000-isa.c | 4 ++-- hw/net/spapr_llan.c | 2 +- hw/net/virtio-net.c | 2 +- hw/pci-host/grackle.c | 2 +- hw/pci-host/i440fx.c | 8 ++++---- hw/pci-host/prep.c | 2 +- hw/pci-host/q35.c | 23 ++++++++++++++--------- hw/pci-host/sabre.c | 3 ++- hw/pci-host/uninorth.c | 9 +++++---- hw/pcmcia/pxa2xx.c | 3 ++- hw/ppc/spapr_drc.c | 6 +++--- hw/ppc/spapr_rng.c | 2 +- hw/riscv/sifive_u.c | 4 ++-- hw/s390x/event-facility.c | 6 +++--- hw/s390x/s390-ccw.c | 2 +- hw/s390x/s390-skeys.c | 4 ++-- hw/s390x/s390-stattrib.c | 4 ++-- hw/s390x/sclp.c | 2 +- hw/scsi/scsi-bus.c | 2 +- hw/ssi/xilinx_spips.c | 2 +- hw/usb/bus.c | 4 ++-- hw/usb/dev-network.c | 2 +- hw/usb/dev-storage.c | 4 ++-- hw/usb/host-libusb.c | 2 +- hw/usb/redirect.c | 2 +- hw/virtio/virtio-balloon.c | 4 ++-- net/dump.c | 4 ++-- net/filter-buffer.c | 2 +- net/filter-mirror.c | 10 +++++----- net/filter-rewriter.c | 3 ++- target/arm/cpu64.c | 4 ++-- target/i386/cpu.c | 23 ++++++++++++++--------- target/s390x/cpu.c | 3 ++- tests/check-qom-proplist.c | 7 ++++--- tests/test-qdev-global-props.c | 4 ++-- 65 files changed, 155 insertions(+), 126 deletions(-)
[...]
tests/test-qdev-global-props.c
Quoted 4 lines
tests/test-qdev-global-props.c +0
-0
Oops I forgot to commit this hunk:
@@ -27,6 +27,7 @@
#include "hw/qdev-properties.h"
#include "qom/object.h"
#include "qapi/visitor.h"
+#include "qapi/error.h"
#define TYPE_STATIC_PROPS "static_prop_type"
Quoted 13 lines
tests/test-qdev-global-props.c +2
-2@@ -151,9 +151,9 @@ static void prop2_accessor(Object *obj, Visitor *v, const char *name,static void dynamic_instance_init (Object *obj) {object_property_add (obj,"prop1" ,"uint32" , prop1_accessor, prop1_accessor, -NULL ,NULL ,NULL ); +NULL ,NULL , &error_abort);object_property_add (obj,"prop2" ,"uint32" , prop2_accessor, prop2_accessor, -NULL ,NULL ,NULL ); +NULL ,NULL , &error_abort); }static void dynamic_class_init (ObjectClass *oc,void *data)
Re: [PATCH-for-5.1 v2 49/54] various: Use &error_abort in instance_init()
In reply to Philippe Mathieu-DaudéQuoted 9 lines · Philippe Mathieu-Daudé
Patch created mechanically by running:
$ spatch \ --macro-file scripts/cocci-macro-file.h \ --include-headers --keep-comments --in-place \ --sp-file \ scripts/coccinelle/use-error_abort-in-instance_init.cocciSigned-off-by Philippe Mathieu-Daudé <[email protected]>
For the aspeed part,
Thanks,
C.
Quoted 1,333 lines
--- backends/cryptodev-vhost-user.c | 2 +- backends/rng-egd.c | 2 +- backends/rng-random.c | 2 +- backends/vhost-user.c | 3 ++- hw/arm/bcm2835_peripherals.c | 6 ++++-- hw/arm/vexpress.c | 8 ++++---- hw/arm/xlnx-zcu102.c | 8 ++++---- hw/block/fdc.c | 4 ++-- hw/block/vhost-user-blk.c | 2 +- hw/block/virtio-blk.c | 2 +- hw/core/machine.c | 6 +++--- hw/cpu/core.c | 4 ++-- hw/display/vga-pci.c | 7 +++++-- hw/display/xlnx_dp.c | 4 ++-- hw/dma/sparc32_dma.c | 2 +- hw/gpio/aspeed_gpio.c | 2 +- hw/ide/macio.c | 4 +++- hw/ide/qdev.c | 4 ++-- hw/intc/apic_common.c | 2 +- hw/mem/nvdimm.c | 4 ++-- hw/misc/aspeed_sdmc.c | 2 +- hw/misc/edu.c | 3 ++- hw/misc/macio/macio.c | 4 ++-- hw/misc/macio/pmu.c | 3 ++- hw/misc/pca9552.c | 2 +- hw/misc/tmp105.c | 2 +- hw/misc/tmp421.c | 8 ++++---- hw/net/e1000.c | 3 ++- hw/net/lance.c | 3 ++- hw/net/lasi_i82596.c | 3 ++- hw/net/ne2000-isa.c | 4 ++-- hw/net/spapr_llan.c | 2 +- hw/net/virtio-net.c | 2 +- hw/pci-host/grackle.c | 2 +- hw/pci-host/i440fx.c | 8 ++++---- hw/pci-host/prep.c | 2 +- hw/pci-host/q35.c | 23 ++++++++++++++--------- hw/pci-host/sabre.c | 3 ++- hw/pci-host/uninorth.c | 9 +++++---- hw/pcmcia/pxa2xx.c | 3 ++- hw/ppc/spapr_drc.c | 6 +++--- hw/ppc/spapr_rng.c | 2 +- hw/riscv/sifive_u.c | 4 ++-- hw/s390x/event-facility.c | 6 +++--- hw/s390x/s390-ccw.c | 2 +- hw/s390x/s390-skeys.c | 4 ++-- hw/s390x/s390-stattrib.c | 4 ++-- hw/s390x/sclp.c | 2 +- hw/scsi/scsi-bus.c | 2 +- hw/ssi/xilinx_spips.c | 2 +- hw/usb/bus.c | 4 ++-- hw/usb/dev-network.c | 2 +- hw/usb/dev-storage.c | 4 ++-- hw/usb/host-libusb.c | 2 +- hw/usb/redirect.c | 2 +- hw/virtio/virtio-balloon.c | 4 ++-- net/dump.c | 4 ++-- net/filter-buffer.c | 2 +- net/filter-mirror.c | 10 +++++----- net/filter-rewriter.c | 3 ++- target/arm/cpu64.c | 4 ++-- target/i386/cpu.c | 23 ++++++++++++++--------- target/s390x/cpu.c | 3 ++- tests/check-qom-proplist.c | 7 ++++--- tests/test-qdev-global-props.c | 4 ++-- 65 files changed, 155 insertions(+), 126 deletions(-)backends/cryptodev-vhost-user.c +1
-1@@ -341,7 +341,7 @@ static void cryptodev_vhost_user_instance_int(Object *obj)object_property_add_str (obj,"chardev" , cryptodev_vhost_user_get_chardev, cryptodev_vhost_user_set_chardev, -NULL ); + &error_abort); }static void cryptodev_vhost_user_finalize (Object *obj)backends/rng-egd.c +1
-1@@ -139,7 +139,7 @@ static void rng_egd_init(Object *obj) {object_property_add_str (obj,"chardev" , rng_egd_get_chardev, rng_egd_set_chardev, -NULL ); + &error_abort); }static void rng_egd_finalize (Object *obj)backends/rng-random.c +1
-1@@ -111,7 +111,7 @@ static void rng_random_init(Object *obj)object_property_add_str (obj,"filename" , rng_random_get_filename, rng_random_set_filename, -NULL ); + &error_abort); s->filename =g_strdup ("/dev/urandom" ); s->fd =-1 ;backends/vhost-user.c +2
-1@@ -177,7 +177,8 @@ static char *get_chardev(Object *obj, Error **errp)static void vhost_user_backend_init (Object *obj) { -object_property_add_str (obj,"chardev" , get_chardev, set_chardev,NULL ); +object_property_add_str (obj,"chardev" , get_chardev, set_chardev, + &error_abort); }static void vhost_user_backend_finalize (Object *obj)hw/arm/bcm2835_peripherals.c +4
-2@@ -43,12 +43,14 @@ static void bcm2835_peripherals_init(Object *obj)/* Memory region for peripheral devices, which we export to our parent */ memory_region_init (&s->peri_mr, obj,"bcm2835-peripherals" ,0x1000000 ); -object_property_add_child (obj,"peripheral-io" ,OBJECT (&s->peri_mr),NULL ); +object_property_add_child (obj,"peripheral-io" ,OBJECT (&s->peri_mr), + &error_abort);sysbus_init_mmio (SYS_BUS_DEVICE (s), &s->peri_mr);/* Internal memory region for peripheral bus addresses (not exported) */ memory_region_init (&s->gpu_bus_mr, obj,"bcm2835-gpu" , (uint64_t )1 <<32 ); -object_property_add_child (obj,"gpu-bus" ,OBJECT (&s->gpu_bus_mr),NULL ); +object_property_add_child (obj,"gpu-bus" ,OBJECT (&s->gpu_bus_mr), + &error_abort);/* Internal memory region for request/response communication with * mailbox-addressable peripherals (not exported) hw/arm/vexpress.c +4
-4@@ -749,11 +749,11 @@ static void vexpress_instance_init(Object *obj)/* EL3 is enabled by default on vexpress */ vms->secure = true;object_property_add_bool (obj,"secure" , vexpress_get_secure, - vexpress_set_secure,NULL ); + vexpress_set_secure, &error_abort);object_property_set_description (obj,"secure" ,"Set on/off to enable/disable the ARM " "Security Extensions (TrustZone)" , -NULL ); + &error_abort); }static void vexpress_a15_instance_init (Object *obj)@@ -766,12 +766,12 @@ static void vexpress_a15_instance_init(Object *obj)*/ vms->virt = true;object_property_add_bool (obj,"virtualization" , vexpress_get_virt, - vexpress_set_virt,NULL ); + vexpress_set_virt, &error_abort);object_property_set_description (obj,"virtualization" ,"Set on/off to enable/disable the ARM " "Virtualization Extensions " "(defaults to same as 'secure')" , -NULL ); + &error_abort); }static void vexpress_a9_instance_init (Object *obj)hw/arm/xlnx-zcu102.c +4
-4@@ -178,21 +178,21 @@ static void xlnx_zcu102_machine_instance_init(Object *obj)/* Default to secure mode being disabled */ s->secure = false;object_property_add_bool (obj,"secure" , zcu102_get_secure, - zcu102_set_secure,NULL ); + zcu102_set_secure, &error_abort);object_property_set_description (obj,"secure" ,"Set on/off to enable/disable the ARM " "Security Extensions (TrustZone)" , -NULL ); + &error_abort);/* Default to virt (EL2) being disabled */ s->virt = false;object_property_add_bool (obj,"virtualization" , zcu102_get_virt, - zcu102_set_virt,NULL ); + zcu102_set_virt, &error_abort);object_property_set_description (obj,"virtualization" ,"Set on/off to enable/disable emulating a " "guest CPU which implements the ARM " "Virtualization Extensions" , -NULL ); + &error_abort); }static void xlnx_zcu102_machine_class_init (ObjectClass *oc,void *data)hw/block/fdc.c +2
-2@@ -2812,10 +2812,10 @@ static void isabus_fdc_instance_init(Object *obj)device_add_bootindex_property (obj, &isa->bootindexA,"bootindexA" ,"/floppy@0" , -DEVICE (obj),NULL ); +DEVICE (obj), &error_abort);device_add_bootindex_property (obj, &isa->bootindexB,"bootindexB" ,"/floppy@1" , -DEVICE (obj),NULL ); +DEVICE (obj), &error_abort); }static const TypeInfo isa_fdc_info = {hw/block/vhost-user-blk.c +1
-1@@ -477,7 +477,7 @@ static void vhost_user_blk_instance_init(Object *obj)VHostUserBlk *s =VHOST_USER_BLK (obj);device_add_bootindex_property (obj, &s->bootindex,"bootindex" , -"/disk@0,0" ,DEVICE (obj),NULL ); +"/disk@0,0" ,DEVICE (obj), &error_abort); }static const VMStateDescription vmstate_vhost_user_blk = {hw/block/virtio-blk.c +1
-1@@ -1248,7 +1248,7 @@ static void virtio_blk_instance_init(Object *obj)device_add_bootindex_property (obj, &s->conf.conf.bootindex,"bootindex" ,"/disk@0,0" , -DEVICE (obj),NULL ); +DEVICE (obj), &error_abort); }static const VMStateDescription vmstate_virtio_blk = {hw/core/machine.c +3
-3@@ -894,7 +894,7 @@ static void machine_initfn(Object *obj) &error_abort);object_property_set_description (obj,"nvdimm" ,"Set on/off to enable/disable " -"NVDIMM instantiation" ,NULL ); +"NVDIMM instantiation" , &error_abort); object_property_add_str(obj, "nvdimm-persistence", machine_get_nvdimm_persistence,@@ -903,7 +903,7 @@ static void machine_initfn(Object *obj)object_property_set_description (obj,"nvdimm-persistence" ,"Set NVDIMM persistence" "Valid values are cpu, mem-ctrl" , -NULL ); + &error_abort); }if (mc->cpu_index_to_instance_props && mc->get_default_cpu_node_id) {@@ -914,7 +914,7 @@ static void machine_initfn(Object *obj)object_property_set_description (obj,"hmat" ,"Set on/off to enable/disable " "ACPI Heterogeneous Memory Attribute " -"Table (HMAT)" ,NULL ); +"Table (HMAT)" , &error_abort); } object_property_add_str(obj, "memory-backend",hw/cpu/core.c +2
-2@@ -76,9 +76,9 @@ static void cpu_core_instance_init(Object *obj)CPUCore *core =CPU_CORE (obj);object_property_add (obj,"core-id" ,"int" , core_prop_get_core_id, - core_prop_set_core_id,NULL ,NULL ,NULL ); + core_prop_set_core_id,NULL ,NULL , &error_abort);object_property_add (obj,"nr-threads" ,"int" , core_prop_get_nr_threads, - core_prop_set_nr_threads,NULL ,NULL ,NULL ); + core_prop_set_nr_threads,NULL ,NULL , &error_abort); core->nr_threads = ms->smp.threads; }hw/display/vga-pci.c +5
-2@@ -25,6 +25,7 @@*/ #include "qemu/osdep.h" +#include "qapi/error.h" #include "hw/pci/pci.h" #include "hw/qdev-properties.h" #include "migration/vmstate.h" @@ -270,7 +271,8 @@ static void pci_std_vga_init(Object *obj) {/* Expose framebuffer byteorder via QOM */ object_property_add_bool (obj,"big-endian-framebuffer" , - vga_get_big_endian_fb, vga_set_big_endian_fb,NULL ); + vga_get_big_endian_fb, vga_set_big_endian_fb, + &error_abort); }static void pci_secondary_vga_realize (PCIDevice *dev,Error **errp)@@ -321,7 +323,8 @@ static void pci_secondary_vga_init(Object *obj) {/* Expose framebuffer byteorder via QOM */ object_property_add_bool (obj,"big-endian-framebuffer" , - vga_get_big_endian_fb, vga_set_big_endian_fb,NULL ); + vga_get_big_endian_fb, vga_set_big_endian_fb, + &error_abort); }static void pci_secondary_vga_reset (DeviceState *dev)hw/display/xlnx_dp.c +2
-2@@ -1249,11 +1249,11 @@ static void xlnx_dp_init(Object *obj)* Initialize DPCD and EDID.. */ s->dpcd =DPCD (aux_create_slave (s->aux_bus,"dpcd" )); -object_property_add_child (OBJECT (s),"dpcd" ,OBJECT (s->dpcd),NULL ); +object_property_add_child (OBJECT (s),"dpcd" ,OBJECT (s->dpcd), &error_abort); s->edid =I2CDDC (qdev_create (BUS (aux_get_i2c_bus (s->aux_bus)),"i2c-ddc" ));i2c_set_slave_address (I2C_SLAVE (s->edid),0x50 ); -object_property_add_child (OBJECT (s),"edid" ,OBJECT (s->edid),NULL ); +object_property_add_child (OBJECT (s),"edid" ,OBJECT (s->edid), &error_abort);fifo8_create (&s->rx_fifo,16 );fifo8_create (&s->tx_fifo,16 );hw/dma/sparc32_dma.c +1
-1@@ -264,7 +264,7 @@ static void sparc32_dma_device_init(Object *obj)object_property_add_link (OBJECT (dev),"iommu" ,TYPE_SUN4M_IOMMU , (Object **) &s->iommu, qdev_prop_allow_set_link_before_realize, -0 ,NULL ); +0 , &error_abort);qdev_init_gpio_in (dev, dma_set_irq,1 );qdev_init_gpio_out (dev, s->gpio,2 );hw/gpio/aspeed_gpio.c +1
-1@@ -873,7 +873,7 @@ static void aspeed_gpio_init(Object *obj) name =g_strdup_printf ("gpio%s%d" , props->group_label[group_idx], pin_idx %GPIOS_PER_GROUP );object_property_add (obj, name,"bool" , aspeed_gpio_get_pin, - aspeed_gpio_set_pin,NULL ,NULL ,NULL ); + aspeed_gpio_set_pin,NULL ,NULL , &error_abort);g_free (name); } }hw/ide/macio.c +3
-1@@ -24,6 +24,7 @@*/ #include "qemu/osdep.h" +#include "qapi/error.h" #include "hw/ppc/mac.h" #include "hw/ppc/mac_dbdma.h" #include "hw/qdev-properties.h" @@ -459,7 +460,8 @@ static void macio_ide_initfn(Object *obj)object_property_add_link (obj,"dbdma" ,TYPE_MAC_DBDMA , (Object **) &s->dbdma, - qdev_prop_allow_set_link_before_realize,0 ,NULL ); + qdev_prop_allow_set_link_before_realize,0 , + &error_abort); }static Property macio_ide_properties[] = {hw/ide/qdev.c +2
-2@@ -266,8 +266,8 @@ static void ide_dev_instance_init(Object *obj) {object_property_add (obj,"bootindex" ,"int32" , ide_dev_get_bootindex, - ide_dev_set_bootindex,NULL ,NULL ,NULL ); -object_property_set_int (obj,-1 ,"bootindex" ,NULL ); + ide_dev_set_bootindex,NULL ,NULL , &error_abort); +object_property_set_int (obj,-1 ,"bootindex" , &error_abort); }static void ide_hd_realize (IDEDevice *dev,Error **errp)hw/intc/apic_common.c +1
-1@@ -445,7 +445,7 @@ static void apic_common_initfn(Object *obj) s->id = s->initial_apic_id =-1 ;object_property_add (obj,"id" ,"uint32" , apic_common_get_id, - apic_common_set_id,NULL ,NULL ,NULL ); + apic_common_set_id,NULL ,NULL , &error_abort); }static void apic_common_class_init (ObjectClass *klass,void *data)hw/mem/nvdimm.c +2
-2@@ -110,10 +110,10 @@ static void nvdimm_init(Object *obj) {object_property_add (obj,NVDIMM_LABEL_SIZE_PROP ,"int" , nvdimm_get_label_size, nvdimm_set_label_size,NULL , -NULL ,NULL ); +NULL , &error_abort);object_property_add (obj,NVDIMM_UUID_PROP ,"QemuUUID" , nvdimm_get_uuid, - nvdimm_set_uuid,NULL ,NULL ,NULL ); + nvdimm_set_uuid,NULL ,NULL , &error_abort); }static void nvdimm_finalize (Object *obj)hw/misc/aspeed_sdmc.c +1
-1@@ -255,7 +255,7 @@ static void aspeed_sdmc_initfn(Object *obj) {object_property_add (obj,"ram-size" ,"int" , aspeed_sdmc_get_ram_size, aspeed_sdmc_set_ram_size, -NULL ,NULL ,NULL ); +NULL ,NULL , &error_abort); }static void aspeed_sdmc_realize (DeviceState *dev,Error **errp)hw/misc/edu.c +2
-1@@ -23,6 +23,7 @@*/ #include "qemu/osdep.h" +#include "qapi/error.h" #include "qemu/units.h" #include "hw/pci/pci.h" #include "hw/hw.h" @@ -403,7 +404,7 @@ static void edu_instance_init(Object *obj) edu->dma_mask = (1UL <<28 ) -1 ;object_property_add_uint64_ptr (obj,"dma_mask" , &edu->dma_mask,OBJ_PROP_FLAG_READWRITE , -NULL ); + &error_abort); }static void edu_class_init (ObjectClass *class,void *data)hw/misc/macio/macio.c +2
-2@@ -241,7 +241,7 @@ static void macio_oldworld_init(Object *obj)object_property_add_link (obj,"pic" ,TYPE_HEATHROW , (Object **) &os->pic, qdev_prop_allow_set_link_before_realize, -0 ,NULL ); +0 , &error_abort);macio_init_child_obj (s,"cuda" , &s->cuda,sizeof (s->cuda),TYPE_CUDA );@@ -401,7 +401,7 @@ static void macio_newworld_init(Object *obj)object_property_add_link (obj,"pic" ,TYPE_OPENPIC , (Object **) &ns->pic, qdev_prop_allow_set_link_before_realize, -0 ,NULL ); +0 , &error_abort);macio_init_child_obj (s,"gpio" , &ns->gpio,sizeof (ns->gpio),TYPE_MACIO_GPIO );hw/misc/macio/pmu.c +2
-1@@ -30,6 +30,7 @@#include "qemu/osdep.h" #include "qemu-common.h" +#include "qapi/error.h" #include "hw/ppc/mac.h" #include "hw/qdev-properties.h" #include "migration/vmstate.h" @@ -773,7 +774,7 @@ static void pmu_init(Object *obj)object_property_add_link (obj,"gpio" ,TYPE_MACIO_GPIO , (Object **) &s->gpio, qdev_prop_allow_set_link_before_realize, -0 ,NULL ); +0 , &error_abort);sysbus_init_child_obj (obj,"mos6522-pmu" , &s->mos6522_pmu,sizeof (s->mos6522_pmu),TYPE_MOS6522_PMU );hw/misc/pca9552.c +1
-1@@ -298,7 +298,7 @@ static void pca9552_initfn(Object *obj) name =g_strdup_printf ("led%d" , led);object_property_add (obj, name,"bool" , pca9552_get_led, pca9552_set_led, -NULL ,NULL ,NULL ); +NULL ,NULL , &error_abort);g_free (name); } }hw/misc/tmp105.c +1
-1@@ -245,7 +245,7 @@ static void tmp105_initfn(Object *obj) {object_property_add (obj,"temperature" ,"int" , tmp105_get_temperature, - tmp105_set_temperature,NULL ,NULL ,NULL ); + tmp105_set_temperature,NULL ,NULL , &error_abort); }static void tmp105_class_init (ObjectClass *klass,void *data)hw/misc/tmp421.c +4
-4@@ -347,16 +347,16 @@ static void tmp421_initfn(Object *obj) {object_property_add (obj,"temperature0" ,"int" , tmp421_get_temperature, - tmp421_set_temperature,NULL ,NULL ,NULL ); + tmp421_set_temperature,NULL ,NULL , &error_abort);object_property_add (obj,"temperature1" ,"int" , tmp421_get_temperature, - tmp421_set_temperature,NULL ,NULL ,NULL ); + tmp421_set_temperature,NULL ,NULL , &error_abort);object_property_add (obj,"temperature2" ,"int" , tmp421_get_temperature, - tmp421_set_temperature,NULL ,NULL ,NULL ); + tmp421_set_temperature,NULL ,NULL , &error_abort);object_property_add (obj,"temperature3" ,"int" , tmp421_get_temperature, - tmp421_set_temperature,NULL ,NULL ,NULL ); + tmp421_set_temperature,NULL ,NULL , &error_abort); }static void tmp421_class_init (ObjectClass *klass,void *data)hw/net/e1000.c +2
-1@@ -26,6 +26,7 @@#include "qemu/osdep.h" +#include "qapi/error.h" #include "hw/pci/pci.h" #include "hw/qdev-properties.h" #include "migration/vmstate.h" @@ -1774,7 +1775,7 @@ static void e1000_instance_init(Object *obj)E1000State *n =E1000 (obj);device_add_bootindex_property (obj, &n->conf.bootindex,"bootindex" ,"/ethernet-phy@0" , -DEVICE (n),NULL ); +DEVICE (n), &error_abort); }static const TypeInfo e1000_base_info = {hw/net/lance.c +2
-1@@ -38,6 +38,7 @@#include "qemu/osdep.h" #include "qemu/module.h" #include "qemu/timer.h" +#include "qapi/error.h" #include "hw/sparc/sparc32_dma.h" #include "migration/vmstate.h" #include "hw/net/lance.h" @@ -134,7 +135,7 @@ static void lance_instance_init(Object *obj)device_add_bootindex_property (obj, &s->conf.bootindex,"bootindex" ,"/ethernet-phy@0" , -DEVICE (obj),NULL ); +DEVICE (obj), &error_abort); }static Property lance_properties[] = {hw/net/lasi_i82596.c +2
-1@@ -11,6 +11,7 @@*/ #include "qemu/osdep.h" +#include "qapi/error.h" #include "qemu/timer.h" #include "hw/sysbus.h" #include "net/eth.h" @@ -152,7 +153,7 @@ static void lasi_82596_instance_init(Object *obj)device_add_bootindex_property (obj, &s->conf.bootindex,"bootindex" ,"/ethernet-phy@0" , -DEVICE (obj),NULL ); +DEVICE (obj), &error_abort); }static Property lasi_82596_properties[] = {hw/net/ne2000-isa.c +2
-2@@ -133,8 +133,8 @@ static void isa_ne2000_instance_init(Object *obj) {object_property_add (obj,"bootindex" ,"int32" , isa_ne2000_get_bootindex, - isa_ne2000_set_bootindex,NULL ,NULL ,NULL ); -object_property_set_int (obj,-1 ,"bootindex" ,NULL ); + isa_ne2000_set_bootindex,NULL ,NULL , &error_abort); +object_property_set_int (obj,-1 ,"bootindex" , &error_abort); }static const TypeInfo ne2000_isa_info = { .name =TYPE_ISA_NE2000 ,hw/net/spapr_llan.c +1
-1@@ -340,7 +340,7 @@ static void spapr_vlan_instance_init(Object *obj)device_add_bootindex_property (obj, &dev->nicconf.bootindex,"bootindex" ,"" , -DEVICE (dev),NULL ); +DEVICE (dev), &error_abort);if (dev->compat_flags &SPAPRVLAN_FLAG_RX_BUF_POOLS ) {for (i =0 ; i <RX_MAX_POOLS ; i++) {hw/net/virtio-net.c +1
-1@@ -3122,7 +3122,7 @@ static void virtio_net_instance_init(Object *obj) n->config_size =sizeof (struct virtio_net_config );device_add_bootindex_property (obj, &n->nic_conf.bootindex,"bootindex" ,"/ethernet-phy@0" , -DEVICE (n),NULL ); +DEVICE (n), &error_abort); }static int virtio_net_pre_save (void *opaque)hw/pci-host/grackle.c +1
-1@@ -109,7 +109,7 @@ static void grackle_init(Object *obj)object_property_add_link (obj,"pic" ,TYPE_HEATHROW , (Object **) &s->pic, qdev_prop_allow_set_link_before_realize, -0 ,NULL ); +0 , &error_abort);sysbus_init_mmio (sbd, &phb->conf_mem);sysbus_init_mmio (sbd, &phb->data_mem);hw/pci-host/i440fx.c +4
-4@@ -212,19 +212,19 @@ static void i440fx_pcihost_initfn(Object *obj)object_property_add (obj,PCI_HOST_PROP_PCI_HOLE_START ,"uint32" , i440fx_pcihost_get_pci_hole_start, -NULL ,NULL ,NULL ,NULL ); +NULL ,NULL ,NULL , &error_abort);object_property_add (obj,PCI_HOST_PROP_PCI_HOLE_END ,"uint32" , i440fx_pcihost_get_pci_hole_end, -NULL ,NULL ,NULL ,NULL ); +NULL ,NULL ,NULL , &error_abort);object_property_add (obj,PCI_HOST_PROP_PCI_HOLE64_START ,"uint64" , i440fx_pcihost_get_pci_hole64_start, -NULL ,NULL ,NULL ,NULL ); +NULL ,NULL ,NULL , &error_abort);object_property_add (obj,PCI_HOST_PROP_PCI_HOLE64_END ,"uint64" , i440fx_pcihost_get_pci_hole64_end, -NULL ,NULL ,NULL ,NULL ); +NULL ,NULL ,NULL , &error_abort); }static void i440fx_pcihost_realize (DeviceState *dev,Error **errp)hw/pci-host/prep.c +1
-1@@ -311,7 +311,7 @@ static void raven_pcihost_initfn(Object *obj) pci_dev =DEVICE (&s->pci_dev);qdev_set_parent_bus (pci_dev,BUS (&s->pci_bus));object_property_set_int (OBJECT (&s->pci_dev),PCI_DEVFN (0 ,0 ),"addr" , -NULL ); + &error_abort);qdev_prop_set_bit (pci_dev,"multifunction" , false); }hw/pci-host/q35.c +14
-9@@ -222,38 +222,43 @@ static void q35_host_initfn(Object *obj) Q35_PCI_HOST_HOLE64_SIZE_DEFAULT);object_property_add (obj,PCI_HOST_PROP_PCI_HOLE_START ,"uint32" , q35_host_get_pci_hole_start, -NULL ,NULL ,NULL ,NULL ); +NULL ,NULL ,NULL , &error_abort);object_property_add (obj,PCI_HOST_PROP_PCI_HOLE_END ,"uint32" , q35_host_get_pci_hole_end, -NULL ,NULL ,NULL ,NULL ); +NULL ,NULL ,NULL , &error_abort);object_property_add (obj,PCI_HOST_PROP_PCI_HOLE64_START ,"uint64" , q35_host_get_pci_hole64_start, -NULL ,NULL ,NULL ,NULL ); +NULL ,NULL ,NULL , &error_abort);object_property_add (obj,PCI_HOST_PROP_PCI_HOLE64_END ,"uint64" , q35_host_get_pci_hole64_end, -NULL ,NULL ,NULL ,NULL ); +NULL ,NULL ,NULL , &error_abort);object_property_add_uint64_ptr (obj,PCIE_HOST_MCFG_SIZE , - &pehb->size,OBJ_PROP_FLAG_READ ,NULL ); + &pehb->size,OBJ_PROP_FLAG_READ , + &error_abort);object_property_add_link (obj,MCH_HOST_PROP_RAM_MEM ,TYPE_MEMORY_REGION , (Object **) &s->mch.ram_memory, - qdev_prop_allow_set_link_before_realize,0 ,NULL ); + qdev_prop_allow_set_link_before_realize,0 , + &error_abort);object_property_add_link (obj,MCH_HOST_PROP_PCI_MEM ,TYPE_MEMORY_REGION , (Object **) &s->mch.pci_address_space, - qdev_prop_allow_set_link_before_realize,0 ,NULL ); + qdev_prop_allow_set_link_before_realize,0 , + &error_abort);object_property_add_link (obj,MCH_HOST_PROP_SYSTEM_MEM ,TYPE_MEMORY_REGION , (Object **) &s->mch.system_memory, - qdev_prop_allow_set_link_before_realize,0 ,NULL ); + qdev_prop_allow_set_link_before_realize,0 , + &error_abort);object_property_add_link (obj,MCH_HOST_PROP_IO_MEM ,TYPE_MEMORY_REGION , (Object **) &s->mch.address_space_io, - qdev_prop_allow_set_link_before_realize,0 ,NULL ); + qdev_prop_allow_set_link_before_realize,0 , + &error_abort); }static const TypeInfo q35_host_info = {hw/pci-host/sabre.c +2
-1@@ -25,6 +25,7 @@*/ #include "qemu/osdep.h" +#include "qapi/error.h" #include "hw/sysbus.h" #include "hw/pci/pci.h" #include "hw/pci/pci_host.h" @@ -442,7 +443,7 @@ static void sabre_init(Object *obj)object_property_add_link (obj,"iommu" ,TYPE_SUN4U_IOMMU , (Object **) &s->iommu, qdev_prop_allow_set_link_before_realize, -0 ,NULL ); +0 , &error_abort);/* sabre_config */ memory_region_init_io(&s->sabre_config, OBJECT(s), &sabre_config_ops, s,hw/pci-host/uninorth.c +5
-4@@ -23,6 +23,7 @@*/ #include "qemu/osdep.h" +#include "qapi/error.h" #include "hw/irq.h" #include "hw/ppc/mac.h" #include "hw/qdev-properties.h" @@ -175,7 +176,7 @@ static void pci_unin_main_init(Object *obj)object_property_add_link (obj,"pic" ,TYPE_OPENPIC , (Object **) &s->pic, qdev_prop_allow_set_link_before_realize, -0 ,NULL ); +0 , &error_abort);sysbus_init_mmio (sbd, &h->conf_mem);sysbus_init_mmio (sbd, &h->data_mem);@@ -223,7 +224,7 @@ static void pci_u3_agp_init(Object *obj)object_property_add_link (obj,"pic" ,TYPE_OPENPIC , (Object **) &s->pic, qdev_prop_allow_set_link_before_realize, -0 ,NULL ); +0 , &error_abort);sysbus_init_mmio (sbd, &h->conf_mem);sysbus_init_mmio (sbd, &h->data_mem);@@ -262,7 +263,7 @@ static void pci_unin_agp_init(Object *obj)object_property_add_link (obj,"pic" ,TYPE_OPENPIC , (Object **) &s->pic, qdev_prop_allow_set_link_before_realize, -0 ,NULL ); +0 , &error_abort);sysbus_init_mmio (sbd, &h->conf_mem);sysbus_init_mmio (sbd, &h->data_mem);@@ -299,7 +300,7 @@ static void pci_unin_internal_init(Object *obj)object_property_add_link (obj,"pic" ,TYPE_OPENPIC , (Object **) &s->pic, qdev_prop_allow_set_link_before_realize, -0 ,NULL ); +0 , &error_abort);sysbus_init_mmio (sbd, &h->conf_mem);sysbus_init_mmio (sbd, &h->data_mem);hw/pcmcia/pxa2xx.c +2
-1@@ -11,6 +11,7 @@*/ #include "qemu/osdep.h" +#include "qapi/error.h" #include "hw/irq.h" #include "hw/sysbus.h" #include "qemu/module.h" @@ -189,7 +190,7 @@ static void pxa2xx_pcmcia_initfn(Object *obj)object_property_add_link (obj,"card" ,TYPE_PCMCIA_CARD , (Object **)&s->card,NULL ,/* read-only property */ -0 ,NULL ); +0 , &error_abort); }/* Insert a new card into a slot */ hw/ppc/spapr_drc.c +3
-3@@ -584,11 +584,11 @@ static void spapr_dr_connector_instance_init(Object *obj)SpaprDrcClass *drck =SPAPR_DR_CONNECTOR_GET_CLASS (drc);object_property_add_uint32_ptr (obj,"id" , &drc->id,OBJ_PROP_FLAG_READ , -NULL ); + &error_abort);object_property_add (obj,"index" ,"uint32" , prop_get_index, -NULL ,NULL ,NULL ,NULL ); +NULL ,NULL ,NULL , &error_abort);object_property_add (obj,"fdt" ,"struct" , prop_get_fdt, -NULL ,NULL ,NULL ,NULL ); +NULL ,NULL ,NULL , &error_abort); drc->state = drck->empty_state; }hw/ppc/spapr_rng.c +1
-1@@ -104,7 +104,7 @@ static void spapr_rng_instance_init(Object *obj)object_property_set_description (obj,"rng" ,"ID of the random number generator backend" , -NULL ); + &error_abort); }static void spapr_rng_realize (DeviceState *dev,Error **errp)hw/riscv/sifive_u.c +2
-2@@ -487,11 +487,11 @@ static void riscv_sifive_u_machine_instance_init(Object *obj) s->start_in_flash = false;object_property_add_bool (obj,"start-in-flash" , sifive_u_get_start_in_flash, - sifive_u_set_start_in_flash,NULL ); + sifive_u_set_start_in_flash, &error_abort);object_property_set_description (obj,"start-in-flash" ,"Set on to tell QEMU's ROM to jump to " "flash. Otherwise QEMU will jump to DRAM" , -NULL ); + &error_abort); }static void riscv_sifive_u_soc_realize (DeviceState *dev,Error **errp)hw/s390x/event-facility.c +3
-3@@ -449,18 +449,18 @@ static void init_event_facility(Object *obj) event_facility->allow_all_mask_sizes = true;object_property_add_bool (obj,"allow_all_mask_sizes" , sclp_event_get_allow_all_mask_sizes, - sclp_event_set_allow_all_mask_sizes,NULL ); + sclp_event_set_allow_all_mask_sizes, &error_abort);/* Spawn a new bus for SCLP events */ qbus_create_inplace (&event_facility->sbus,sizeof (event_facility->sbus),TYPE_SCLP_EVENTS_BUS , sdev,NULL ); new =object_new (TYPE_SCLP_QUIESCE ); -object_property_add_child (obj,TYPE_SCLP_QUIESCE , new,NULL ); +object_property_add_child (obj,TYPE_SCLP_QUIESCE , new, &error_abort);object_unref (new);qdev_set_parent_bus (DEVICE (new),BUS (&event_facility->sbus)); new =object_new (TYPE_SCLP_CPU_HOTPLUG ); -object_property_add_child (obj,TYPE_SCLP_CPU_HOTPLUG , new,NULL ); +object_property_add_child (obj,TYPE_SCLP_CPU_HOTPLUG , new, &error_abort);object_unref (new);qdev_set_parent_bus (DEVICE (new),BUS (&event_facility->sbus));/* the facility will automatically realize the devices via the bus */ hw/s390x/s390-ccw.c +1
-1@@ -151,7 +151,7 @@ static void s390_ccw_instance_init(Object *obj)S390CCWDevice *dev =S390_CCW_DEVICE (obj);device_add_bootindex_property (obj, &dev->bootindex,"bootindex" , -"/disk@0,0" ,DEVICE (obj),NULL ); +"/disk@0,0" ,DEVICE (obj), &error_abort); }static void s390_ccw_class_init (ObjectClass *klass,void *data)hw/s390x/s390-skeys.c +2
-2@@ -400,8 +400,8 @@ static void s390_skeys_instance_init(Object *obj) {object_property_add_bool (obj,"migration-enabled" , s390_skeys_get_migration_enabled, - s390_skeys_set_migration_enabled,NULL ); -object_property_set_bool (obj, true,"migration-enabled" ,NULL ); + s390_skeys_set_migration_enabled, &error_abort); +object_property_set_bool (obj, true,"migration-enabled" , &error_abort); }static void s390_skeys_class_init (ObjectClass *oc,void *data)hw/s390x/s390-stattrib.c +2
-2@@ -387,8 +387,8 @@ static void s390_stattrib_instance_init(Object *obj)object_property_add_bool (obj,"migration-enabled" , s390_stattrib_get_migration_enabled, - s390_stattrib_set_migration_enabled,NULL ); -object_property_set_bool (obj, true,"migration-enabled" ,NULL ); + s390_stattrib_set_migration_enabled, &error_abort); +object_property_set_bool (obj, true,"migration-enabled" , &error_abort); sas->migration_cur_gfn =0 ; }hw/s390x/sclp.c +1
-1@@ -349,7 +349,7 @@ static void sclp_init(Object *obj)Object *new; new =object_new (TYPE_SCLP_EVENT_FACILITY ); -object_property_add_child (obj,TYPE_SCLP_EVENT_FACILITY , new,NULL ); +object_property_add_child (obj,TYPE_SCLP_EVENT_FACILITY , new, &error_abort);object_unref (new); sclp->event_facility =EVENT_FACILITY (new);hw/scsi/scsi-bus.c +1
-1@@ -1738,7 +1738,7 @@ static void scsi_dev_instance_init(Object *obj)device_add_bootindex_property (obj, &s->conf.bootindex,"bootindex" ,NULL , - &s->qdev,NULL ); + &s->qdev, &error_abort); }static const TypeInfo scsi_device_type_info = {hw/ssi/xilinx_spips.c +1
-1@@ -1361,7 +1361,7 @@ static void xlnx_zynqmp_qspips_init(Object *obj) (Object **)&rq->dma, object_property_allow_set_link,OBJ_PROP_LINK_STRONG , - NULL); + &error_abort); }static int xilinx_spips_post_load (void *opaque,int version_id)hw/usb/bus.c +2
-2@@ -754,11 +754,11 @@ static void usb_device_instance_init(Object *obj)if (klass->attached_settable) {object_property_add_bool (obj,"attached" , usb_get_attached, usb_set_attached, -NULL ); + &error_abort); }else {object_property_add_bool (obj,"attached" , usb_get_attached,NULL , -NULL ); + &error_abort); } }hw/usb/dev-network.c +1
-1@@ -1381,7 +1381,7 @@ static void usb_net_instance_init(Object *obj)device_add_bootindex_property (obj, &s->conf.bootindex,"bootindex" ,"/ethernet-phy@0" , - &dev->qdev,NULL ); + &dev->qdev, &error_abort); }static const VMStateDescription vmstate_usb_net = {hw/usb/dev-storage.c +2
-2@@ -753,8 +753,8 @@ static void usb_msd_instance_init(Object *obj) {object_property_add (obj,"bootindex" ,"int32" , usb_msd_get_bootindex, - usb_msd_set_bootindex,NULL ,NULL ,NULL ); -object_property_set_int (obj,-1 ,"bootindex" ,NULL ); + usb_msd_set_bootindex,NULL ,NULL , &error_abort); +object_property_set_int (obj,-1 ,"bootindex" , &error_abort); }static void usb_msd_class_bot_initfn (ObjectClass *klass,void *data)hw/usb/host-libusb.c +1
-1@@ -1101,7 +1101,7 @@ static void usb_host_instance_init(Object *obj)device_add_bootindex_property (obj, &s->bootindex,"bootindex" ,NULL , - &udev->qdev,NULL ); + &udev->qdev, &error_abort); }static void usb_host_unrealize (USBDevice *udev,Error **errp)hw/usb/redirect.c +1
-1@@ -2595,7 +2595,7 @@ static void usbredir_instance_init(Object *obj)device_add_bootindex_property (obj, &dev->bootindex,"bootindex" ,NULL , - &udev->qdev,NULL ); + &udev->qdev, &error_abort); }static const TypeInfo usbredir_dev_info = {hw/virtio/virtio-balloon.c +2
-2@@ -893,12 +893,12 @@ static void virtio_balloon_instance_init(Object *obj)VirtIOBalloon *s =VIRTIO_BALLOON (obj);object_property_add (obj,"guest-stats" ,"guest statistics" , - balloon_stats_get_all,NULL ,NULL , s,NULL ); + balloon_stats_get_all,NULL ,NULL , s, &error_abort);object_property_add (obj,"guest-stats-polling-interval" ,"int" , balloon_stats_get_poll_interval, balloon_stats_set_poll_interval, -NULL , s,NULL ); +NULL , s, &error_abort); }static const VMStateDescription vmstate_virtio_balloon = {net/dump.c +2
-2@@ -232,9 +232,9 @@ static void filter_dump_instance_init(Object *obj) nfds->maxlen =65536 ;object_property_add (obj,"maxlen" ,"uint32" , filter_dump_get_maxlen, - filter_dump_set_maxlen,NULL ,NULL ,NULL ); + filter_dump_set_maxlen,NULL ,NULL , &error_abort);object_property_add_str (obj,"file" , file_dump_get_filename, - file_dump_set_filename,NULL ); + file_dump_set_filename, &error_abort); }static void filter_dump_instance_finalize (Object *obj)net/filter-buffer.c +1
-1@@ -192,7 +192,7 @@ static void filter_buffer_init(Object *obj) {object_property_add (obj,"interval" ,"uint32" , filter_buffer_get_interval, - filter_buffer_set_interval,NULL ,NULL ,NULL ); + filter_buffer_set_interval,NULL ,NULL , &error_abort); }static const TypeInfo filter_buffer_info = {net/filter-mirror.c +5
-5@@ -392,12 +392,12 @@ static void filter_mirror_init(Object *obj)MirrorState *s =FILTER_MIRROR (obj);object_property_add_str (obj,"outdev" , filter_mirror_get_outdev, - filter_mirror_set_outdev,NULL ); + filter_mirror_set_outdev, &error_abort); s->vnet_hdr = false;object_property_add_bool (obj,"vnet_hdr_support" , filter_mirror_get_vnet_hdr, - filter_mirror_set_vnet_hdr,NULL ); + filter_mirror_set_vnet_hdr, &error_abort); }static void filter_redirector_init (Object *obj)@@ -405,14 +405,14 @@ static void filter_redirector_init(Object *obj)MirrorState *s =FILTER_REDIRECTOR (obj);object_property_add_str (obj,"indev" , filter_redirector_get_indev, - filter_redirector_set_indev,NULL ); + filter_redirector_set_indev, &error_abort);object_property_add_str (obj,"outdev" , filter_redirector_get_outdev, - filter_redirector_set_outdev,NULL ); + filter_redirector_set_outdev, &error_abort); s->vnet_hdr = false;object_property_add_bool (obj,"vnet_hdr_support" , filter_redirector_get_vnet_hdr, - filter_redirector_set_vnet_hdr,NULL ); + filter_redirector_set_vnet_hdr, &error_abort); }static void filter_mirror_fini (Object *obj)net/filter-rewriter.c +2
-1@@ -10,6 +10,7 @@*/ #include "qemu/osdep.h" +#include "qapi/error.h" #include "trace.h" #include "colo.h" #include "net/filter.h" @@ -413,7 +414,7 @@ static void filter_rewriter_init(Object *obj) s->failover_mode =FAILOVER_MODE_OFF ;object_property_add_bool (obj,"vnet_hdr_support" , filter_rewriter_get_vnet_hdr, - filter_rewriter_set_vnet_hdr,NULL ); + filter_rewriter_set_vnet_hdr, &error_abort); }static void colo_rewriter_class_init (ObjectClass *oc,void *data)target/arm/cpu64.c +2
-2@@ -782,11 +782,11 @@ static void aarch64_cpu_set_aarch64(Object *obj, bool value, Error **errp)static void aarch64_cpu_initfn (Object *obj) {object_property_add_bool (obj,"aarch64" , aarch64_cpu_get_aarch64, - aarch64_cpu_set_aarch64,NULL ); + aarch64_cpu_set_aarch64, &error_abort);object_property_set_description (obj,"aarch64" ,"Set on/off to enable/disable aarch64 " "execution state " , -NULL ); + &error_abort); }static void aarch64_cpu_finalizefn (Object *obj)target/i386/cpu.c +14
-9@@ -6905,28 +6905,32 @@ static void x86_cpu_initfn(Object *obj)object_property_add (obj,"family" ,"int" , x86_cpuid_version_get_family, - x86_cpuid_version_set_family,NULL ,NULL ,NULL ); + x86_cpuid_version_set_family,NULL ,NULL , + &error_abort);object_property_add (obj,"model" ,"int" , x86_cpuid_version_get_model, - x86_cpuid_version_set_model,NULL ,NULL ,NULL ); + x86_cpuid_version_set_model,NULL ,NULL , + &error_abort);object_property_add (obj,"stepping" ,"int" , x86_cpuid_version_get_stepping, - x86_cpuid_version_set_stepping,NULL ,NULL ,NULL ); + x86_cpuid_version_set_stepping,NULL ,NULL , + &error_abort);object_property_add_str (obj,"vendor" , x86_cpuid_get_vendor, - x86_cpuid_set_vendor,NULL ); + x86_cpuid_set_vendor, &error_abort);object_property_add_str (obj,"model-id" , x86_cpuid_get_model_id, - x86_cpuid_set_model_id,NULL ); + x86_cpuid_set_model_id, &error_abort);object_property_add (obj,"tsc-frequency" ,"int" , x86_cpuid_get_tsc_freq, - x86_cpuid_set_tsc_freq,NULL ,NULL ,NULL ); + x86_cpuid_set_tsc_freq,NULL ,NULL , &error_abort);object_property_add (obj,"feature-words" ,"X86CPUFeatureWordInfo" , x86_cpu_get_feature_words, -NULL ,NULL , (void *)env->features,NULL ); +NULL ,NULL , (void *)env->features, &error_abort);object_property_add (obj,"filtered-features" ,"X86CPUFeatureWordInfo" , x86_cpu_get_feature_words, -NULL ,NULL , (void *)cpu->filtered_features,NULL ); +NULL ,NULL , (void *)cpu->filtered_features, + &error_abort);/* * The "unavailable-features" property has the same semantics as * CpuDefinitionInfo.unavailable-features on the "query-cpu-definitions" @@ -6938,7 +6942,8 @@ static void x86_cpu_initfn(Object *obj) NULL, NULL, NULL, &error_abort);object_property_add (obj,"crash-information" ,"GuestPanicInformation" , - x86_cpu_get_crash_info_qom,NULL ,NULL ,NULL ,NULL ); + x86_cpu_get_crash_info_qom,NULL ,NULL ,NULL , + &error_abort);for (w =0 ; w <FEATURE_WORDS ; w++) {int bitnr;target/s390x/cpu.c +2
-1@@ -287,7 +287,8 @@ static void s390_cpu_initfn(Object *obj) cs->halted =1 ; cs->exception_index =EXCP_HLT ;object_property_add (obj,"crash-information" ,"GuestPanicInformation" , - s390_cpu_get_crash_info_qom,NULL ,NULL ,NULL ,NULL ); + s390_cpu_get_crash_info_qom,NULL ,NULL ,NULL , + &error_abort);s390_cpu_model_register_props (obj);#if !defined(CONFIG_USER_ONLY ) cpu->env.tod_timer =tests/check-qom-proplist.c +4
-3@@ -255,13 +255,14 @@ static void dummy_dev_init(Object *obj)DummyBus *bus =DUMMY_BUS (object_new (TYPE_DUMMY_BUS ));DummyBackend *backend =DUMMY_BACKEND (object_new (TYPE_DUMMY_BACKEND )); -object_property_add_child (obj,"bus" ,OBJECT (bus),NULL ); +object_property_add_child (obj,"bus" ,OBJECT (bus), &error_abort); dev->bus = bus; -object_property_add_child (OBJECT (bus),"backend" ,OBJECT (backend),NULL ); +object_property_add_child (OBJECT (bus),"backend" ,OBJECT (backend), + &error_abort); bus->backend = backend;object_property_add_link (obj,"backend" ,TYPE_DUMMY_BACKEND , - (Object **)&bus->backend,NULL ,0 ,NULL ); + (Object **)&bus->backend,NULL ,0 , &error_abort); }static void dummy_dev_unparent (Object *obj)tests/test-qdev-global-props.c +2
-2@@ -151,9 +151,9 @@ static void prop2_accessor(Object *obj, Visitor *v, const char *name,static void dynamic_instance_init (Object *obj) {object_property_add (obj,"prop1" ,"uint32" , prop1_accessor, prop1_accessor, -NULL ,NULL ,NULL ); +NULL ,NULL , &error_abort);object_property_add (obj,"prop2" ,"uint32" , prop2_accessor, prop2_accessor, -NULL ,NULL ,NULL ); +NULL ,NULL , &error_abort); }static void dynamic_class_init (ObjectClass *oc,void *data)
Re: [PATCH-for-5.1 v2 49/54] various: Use &error_abort in instance_init()
In reply to Philippe Mathieu-DaudéQuoted 68 lines · On Mon, 6 Apr 2020 19:47:38 +0200 Philippe Mathieu-Daudé <[email protected]>…
Patch created mechanically by running:
$ spatch \ --macro-file scripts/cocci-macro-file.h \ --include-headers --keep-comments --in-place \ --sp-file \ scripts/coccinelle/use-error_abort-in-instance_init.cocciSigned-off-by Philippe Mathieu-Daudé <[email protected]>--- backends/cryptodev-vhost-user.c | 2 +- backends/rng-egd.c | 2 +- backends/rng-random.c | 2 +- backends/vhost-user.c | 3 ++- hw/arm/bcm2835_peripherals.c | 6 ++++-- hw/arm/vexpress.c | 8 ++++---- hw/arm/xlnx-zcu102.c | 8 ++++---- hw/block/fdc.c | 4 ++-- hw/block/vhost-user-blk.c | 2 +- hw/block/virtio-blk.c | 2 +- hw/core/machine.c | 6 +++--- hw/cpu/core.c | 4 ++-- hw/display/vga-pci.c | 7 +++++-- hw/display/xlnx_dp.c | 4 ++-- hw/dma/sparc32_dma.c | 2 +- hw/gpio/aspeed_gpio.c | 2 +- hw/ide/macio.c | 4 +++- hw/ide/qdev.c | 4 ++-- hw/intc/apic_common.c | 2 +- hw/mem/nvdimm.c | 4 ++-- hw/misc/aspeed_sdmc.c | 2 +- hw/misc/edu.c | 3 ++- hw/misc/macio/macio.c | 4 ++-- hw/misc/macio/pmu.c | 3 ++- hw/misc/pca9552.c | 2 +- hw/misc/tmp105.c | 2 +- hw/misc/tmp421.c | 8 ++++---- hw/net/e1000.c | 3 ++- hw/net/lance.c | 3 ++- hw/net/lasi_i82596.c | 3 ++- hw/net/ne2000-isa.c | 4 ++-- hw/net/spapr_llan.c | 2 +- hw/net/virtio-net.c | 2 +- hw/pci-host/grackle.c | 2 +- hw/pci-host/i440fx.c | 8 ++++---- hw/pci-host/prep.c | 2 +- hw/pci-host/q35.c | 23 ++++++++++++++--------- hw/pci-host/sabre.c | 3 ++- hw/pci-host/uninorth.c | 9 +++++---- hw/pcmcia/pxa2xx.c | 3 ++- hw/ppc/spapr_drc.c | 6 +++--- hw/ppc/spapr_rng.c | 2 +- hw/riscv/sifive_u.c | 4 ++-- hw/s390x/event-facility.c | 6 +++--- hw/s390x/s390-ccw.c | 2 +- hw/s390x/s390-skeys.c | 4 ++-- hw/s390x/s390-stattrib.c | 4 ++-- hw/s390x/sclp.c | 2 +- hw/scsi/scsi-bus.c | 2 +- hw/ssi/xilinx_spips.c | 2 +- hw/usb/bus.c | 4 ++-- hw/usb/dev-network.c | 2 +- hw/usb/dev-storage.c | 4 ++-- hw/usb/host-libusb.c | 2 +- hw/usb/redirect.c | 2 +- hw/virtio/virtio-balloon.c | 4 ++-- net/dump.c | 4 ++-- net/filter-buffer.c | 2 +-
Quoted 9 lines
net/filter-mirror.c | 10 +++++----- net/filter-rewriter.c | 3 ++- target/arm/cpu64.c | 4 ++-- target/i386/cpu.c | 23 ++++++++++++++--------- target/s390x/cpu.c | 3 ++- tests/check-qom-proplist.c | 7 ++++--- tests/test-qdev-global-props.c | 4 ++-- 65 files changed, 155 insertions(+), 126 deletions(-)
s390 parts:
PATCH v2 50/54 scripts/coccinelle: Find eventually missing error_propagate() calls
In reply to Philippe Mathieu-DaudéIn some places in we put an error into a local Error*, but forget to use it. Add a Coccinelle patch to find such cases and report them.
--- .../find-missing-error_propagate.cocci | 53 +++++++++++++++++++ MAINTAINERS | 1 + 2 files changed, 54 insertions(+) create mode 100644 scripts/coccinelle/find-missing-error_propagate.cocci
scripts/coccinelle/find-missing-error_propagate.cocci new file +53 -0
@@ -0,0 +1,53 @@ +// Find places likely missing error-propagation code, but code is too +// complex for automatic transformation, so manual analysis is required. +// +// Copyright: (C) 2020 Philippe Mathieu-Daudé +// This work is licensed under the terms of the GNU GPLv2 or later. +// +// spatch \ +// --macro-file scripts/cocci-macro-file.h --include-headers \ +// --sp-file scripts/coccinelle/find-missing-error_propagate.cocci +// +// Inspired by https://www.mail-archive.com/[email protected]/msg691638.html + + +// First match two subsequent calls using local Error* +// in function provided a Error** argument +// +@discard_func_with_errp_argument@ +typedef Error; +Error *local_err; +identifier func, errp, errfunc1, errfunc2; +@@ +void func(..., Error **errp) +{ + <+... + errfunc1(..., &local_err); + ... when != local_err // local_err is not used between the calls + errfunc2(..., &local_err); + ...+> +} + + +// Again, match two subsequent calls using local Error* +// but ignoring within functions provided a Error** argument +// +@manual depends on never discard_func_with_errp_argument@ +Error *local_err; +identifier errfunc1, errfunc2; +position p; +@@ + errfunc1@p(..., &local_err); + ... when != local_err + errfunc2(..., &local_err); + + +// As it is likely too complex to transform, report the hit +// +@script:python@ +f << manual.errfunc1; +p << manual.p; +@@ +print("[[manual check required: " + "error_propagate() might be missing in {}() {}:{}:{}]]".format( + f, p[0].file, p[0].line, p[0].column))
MAINTAINERS +1 -0
@@ -2057,6 +2057,7 @@ F: scripts/coccinelle/add-missing-error_propagate.cocci F: scripts/coccinelle/err-bad-newline.cocci F: scripts/coccinelle/error-use-after-free.cocci F: scripts/coccinelle/error_propagate_null.cocci +F: scripts/coccinelle/find-missing-error_propagate.cocci F: scripts/coccinelle/remove_local_err.cocci F: scripts/coccinelle/simplify-init-realize-error_propagate.cocci F: scripts/coccinelle/use-error_abort-in-instance_init.cocci
Signature · 1 line
2.21.1
Re: [PATCH-for-5.1 v2 50/54] scripts/coccinelle: Find eventually missing error_propagate() calls
Quoted 43 lines · Philippe Mathieu-Daudé
In some places in we put an error into a local Error*, but forget to use it. Add a Coccinelle patch to find such cases and report them.
Inspired-by Peter Maydell <[email protected]>Signed-off-by Philippe Mathieu-Daudé <[email protected]>--- .../find-missing-error_propagate.cocci | 53 +++++++++++++++++++ MAINTAINERS | 1 + 2 files changed, 54 insertions(+)create mode 100644
scripts/coccinelle/find-missing-error_propagate.cocciscripts/coccinelle/find-missing-error_propagate.cocci new file +25
-0@@ -0,0 +1,53 @@ +// Find places likely missing error-propagation code, but code is too +// complex for automatic transformation, so manual analysis is required. +// +// Copyright: (C) 2020 Philippe Mathieu-Daudé +// This work is licensed under the terms of the GNU GPLv2 or later. +// +// spatch \ +// --macro-file scripts/cocci-macro-file.h --include-headers \ +// --sp-file scripts/coccinelle/find-missing-error_propagate.cocci +// +// Inspired by https://www.mail-archive.com/[email protected]/msg691638.html + + +// First match two subsequent calls using local Error* +// in function provided a Error** argument +// +@discard_func_with_errp_argument@ +typedef Error; +Error *local_err; +identifier func, errp, errfunc1, errfunc2; +@@ +void func(..., Error **errp) +{ + <+... + errfunc1(..., &local_err);
scripts/coccinelle/find-missing-error_propagate.cocci line 35
Quoted 10 lines
scripts/coccinelle/find-missing-error_propagate.cocci new file +10
-0+ ... when != local_err // local_err is not used between the calls + errfunc2(..., &local_err); + ...+> +} + + +// Again, match two subsequent calls using local Error* +// but ignoring within functions provided a Error** argument +// +@manual depends on never discard_func_with_errp_argument@
What depends on never does? As I can imagine, it checks that previous rule never matched in current file (or all files given to coccinelle as parameters?) ? Couldn't we miss interesting case that way? When both patterns are in one file?
Quoted 31 lines
scripts/coccinelle/find-missing-error_propagate.cocci new file +18
-0+Error *local_err; +identifier errfunc1, errfunc2; +position p; +@@ + errfunc1@p(..., &local_err); + ... when != local_err + errfunc2(..., &local_err); + + +// As it is likely too complex to transform, report the hit +// +@script:python@ +f << manual.errfunc1; +p << manual.p; +@@ +print("[[manual check required: " + "error_propagate() might be missing in {}() {}:{}:{}]]".format( + f, p[0].file, p[0].line, p[0].column))MAINTAINERS +1
-0@@ -2057,6 +2057,7 @@ F: scripts/coccinelle/add-missing-error_propagate.cocci F: scripts/coccinelle/err-bad-newline.cocci F: scripts/coccinelle/error-use-after-free.cocci F: scripts/coccinelle/error_propagate_null.cocci +F: scripts/coccinelle/find-missing-error_propagate.cocci F: scripts/coccinelle/remove_local_err.cocci F: scripts/coccinelle/simplify-init-realize-error_propagate.cocci F: scripts/coccinelle/use-error_abort-in-instance_init.cocci
Signature · 2 lines
Best regards, Vladimir
PATCH v2 51/54 migration/colo: Add missing error-propagation code
In reply to Philippe Mathieu-DaudéRunning the coccinelle script produced:
$ spatch \
--macro-file scripts/cocci-macro-file.h --include-headers \
--sp-file scripts/coccinelle/find-missing-error_propagate.cocci \
--keep-comments --smpl-spacing --dir .
HANDLING: ./migration/colo.c
[[manual check required: error_propagate() might be missing in migrate_set_block_enabled() ./migration/colo.c:439:4]]Add the missing error_propagate() after review.
--- migration/colo.c | 3 +++ 1 file changed, 3 insertions(+)
migration/colo.c +3 -0
@@ -437,6 +437,9 @@ static int colo_do_checkpoint_transaction(MigrationState *s,/* Disable block migration */ migrate_set_block_enabled (false, &local_err); +if (local_err) { + goto out; + }qemu_mutex_lock_iothread ();#ifdef CONFIG_REPLICATION
Signature · 1 line
2.21.1
Re: [PATCH-for-5.1 v2 51/54] migration/colo: Add missing error-propagation code
Quoted 9 lines · Philippe Mathieu-Daudé
Running the coccinelle script produced:
$ spatch \ --macro-file scripts/cocci-macro-file.h --include-headers \ --sp-file scripts/coccinelle/find-missing-error_propagate.cocci \ --keep-comments --smpl-spacing --dir . HANDLING: ./migration/colo.c [[manual check required: error_propagate() might be missing in migrate_set_block_enabled() ./migration/colo.c:439:4]]
Quoted 3 lines
Add the missing
error_propagate()after review.Signed-off-by Philippe Mathieu-Daudé <[email protected]>
Once there, all other uses of local_error on that file looks correct, and rest of calls to migrate_set_block_enabled() in the rest of qemu looks right.
Thanks, Juan.
PATCH v2 52/54 hw/mips/boston: Add missing error-propagation code
In reply to Philippe Mathieu-DaudéRunning the coccinelle script produced:
$ spatch \
--macro-file scripts/cocci-macro-file.h --include-headers \
--sp-file scripts/coccinelle/find-missing-error_propagate.cocci \
--keep-comments --smpl-spacing --dir .
HANDLING: ./hw/mips/boston.c
[[manual check required: error_propagate() might be missing in object_property_set_int() ./hw/mips/boston.c:462:4]]
[[manual check required: error_propagate() might be missing in object_property_set_str() ./hw/mips/boston.c:460:4]]Since the uses are inside a MachineClass::init() function, directly use &error_fatal instead of error_propagate().
--- hw/mips/boston.c | 17 ++++++----------- 1 file changed, 6 insertions(+), 11 deletions(-)
hw/mips/boston.c +6 -11
@@ -426,7 +426,6 @@ static void boston_mach_init(MachineState *machine) {DeviceState *dev;BostonState *s; -Error *err =NULL ;MemoryRegion *flash, *ddr_low_alias, *lcd, *platreg;MemoryRegion *sys_mem =get_system_memory ();XilinxPCIEHost *pcie2;
@@ -458,19 +457,15 @@ static void boston_mach_init(MachineState *machine)sysbus_init_child_obj (OBJECT (machine),"cps" ,OBJECT (&s->cps),sizeof (s->cps),TYPE_MIPS_CPS );object_property_set_str (OBJECT (&s->cps), machine->cpu_type,"cpu-type" , - &err); -object_property_set_int (OBJECT (&s->cps), machine->smp.cpus,"num-vp" , &err); -object_property_set_bool (OBJECT (&s->cps), true,"realized" , &err); - -if (err !=NULL ) { -error_report ("%s" ,error_get_pretty (err)); -exit (1 ); - } - + &error_fatal); +object_property_set_int (OBJECT (&s->cps), machine->smp.cpus,"num-vp" , + &error_fatal); +object_property_set_bool (OBJECT (&s->cps), true,"realized" , &error_fatal);sysbus_mmio_map_overlap (SYS_BUS_DEVICE (&s->cps),0 ,0 ,1 ); flash =g_new (MemoryRegion,1 ); -memory_region_init_rom (flash,NULL ,"boston.flash" ,128 * MiB, &err); +memory_region_init_rom (flash,NULL ,"boston.flash" ,128 * MiB, + &error_fatal);memory_region_add_subregion_overlap (sys_mem,0x18000000 , flash,0 );memory_region_add_subregion_overlap (sys_mem,0x80000000 , machine->ram,0 );
Signature · 1 line
2.21.1
PATCH v2 53/54 hw/mips/mips_malta: Add missing error-propagation code
In reply to Philippe Mathieu-DaudéRunning the coccinelle script produced:
$ spatch \
--macro-file scripts/cocci-macro-file.h --include-headers \
--sp-file scripts/coccinelle/find-missing-error_propagate.cocci \
--keep-comments --smpl-spacing --dir .
HANDLING: ./hw/mips/mips_malta.c
[[manual check required: error_propagate() might be missing in object_property_set_int() ./hw/mips/mips_malta.c:1193:4]]
[[manual check required: error_propagate() might be missing in object_property_set_str() ./hw/mips/mips_malta.c:1192:4]]Add the missing error_propagate() after review by adding a Error* parameter to create_cps().
--- hw/mips/mips_malta.c | 19 ++++++++++++++----- 1 file changed, 14 insertions(+), 5 deletions(-)
hw/mips/mips_malta.c +14 -5
@@ -1183,18 +1183,27 @@ static void create_cpu_without_cps(MachineState *ms, }static void create_cps (MachineState *ms,MaltaState *s, -qemu_irq *cbus_irq,qemu_irq *i8259_irq) +qemu_irq *cbus_irq,qemu_irq *i8259_irq, +Error **errp) {Error *err =NULL ;sysbus_init_child_obj (OBJECT (s),"cps" ,OBJECT (&s->cps),sizeof (s->cps),TYPE_MIPS_CPS );object_property_set_str (OBJECT (&s->cps), ms->cpu_type,"cpu-type" , &err); +if (err) { +error_propagate (errp, err); +return ; + }object_property_set_int (OBJECT (&s->cps), ms->smp.cpus,"num-vp" , &err); +if (err) { +error_propagate (errp, err); +return ; + }object_property_set_bool (OBJECT (&s->cps), true,"realized" , &err); -if (err !=NULL ) { -error_report ("%s" ,error_get_pretty (err)); -exit (1 ); +if (err) { +error_propagate (errp, err); +return ; }sysbus_mmio_map_overlap (SYS_BUS_DEVICE (&s->cps),0 ,0 ,1 );
@@ -1207,7 +1216,7 @@ static void mips_create_cpu(MachineState *ms, MaltaState *s, qemu_irq *cbus_irq, qemu_irq *i8259_irq) {if ((ms->smp.cpus >1 ) &&cpu_supports_cps_smp (ms->cpu_type)) { -create_cps (ms, s, cbus_irq, i8259_irq); +create_cps (ms, s, cbus_irq, i8259_irq, &error_fatal); }else {create_cpu_without_cps (ms, cbus_irq, i8259_irq); }
Signature · 1 line
2.21.1
Re: [PATCH-for-5.1 v2 53/54] hw/mips/mips_malta: Add missing error-propagation code
Quoted 58 lines · Philippe Mathieu-Daudé
Running the coccinelle script produced:
$ spatch \ --macro-file scripts/cocci-macro-file.h --include-headers \ --sp-file scripts/coccinelle/find-missing-error_propagate.cocci \ --keep-comments --smpl-spacing --dir . HANDLING: ./hw/mips/mips_malta.c [[manual check required: error_propagate() might be missing in object_property_set_int() ./hw/mips/mips_malta.c:1193:4]] [[manual check required: error_propagate() might be missing in object_property_set_str() ./hw/mips/mips_malta.c:1192:4]]Add the missing
error_propagate()after review by adding a Error* parameter tocreate_cps().Reviewed-by Peter Maydell <[email protected]>Reviewed-by Aleksandar Markovic <[email protected]>Signed-off-by Philippe Mathieu-Daudé <[email protected]>--- hw/mips/mips_malta.c | 19 ++++++++++++++----- 1 file changed, 14 insertions(+), 5 deletions(-)hw/mips/mips_malta.c +13
-4@@ -1183,18 +1183,27 @@ static void create_cpu_without_cps(MachineState *ms, }static void create_cps (MachineState *ms,MaltaState *s, -qemu_irq *cbus_irq,qemu_irq *i8259_irq) +qemu_irq *cbus_irq,qemu_irq *i8259_irq, +Error **errp) {Error *err =NULL ;sysbus_init_child_obj (OBJECT (s),"cps" ,OBJECT (&s->cps),sizeof (s->cps),TYPE_MIPS_CPS );object_property_set_str (OBJECT (&s->cps), ms->cpu_type,"cpu-type" , &err); +if (err) { +error_propagate (errp, err); +return ; + }object_property_set_int (OBJECT (&s->cps), ms->smp.cpus,"num-vp" , &err); +if (err) { +error_propagate (errp, err); +return ; + }object_property_set_bool (OBJECT (&s->cps), true,"realized" , &err); -if (err !=NULL ) { -error_report ("%s" ,error_get_pretty (err)); -exit (1 ); +if (err) { +error_propagate (errp, err); +return ; }sysbus_mmio_map_overlap (SYS_BUS_DEVICE (&s->cps),0 ,0 ,1 );
hw/mips/mips_malta.c static void mips_create_cpu(MachineState *ms, MaltaState *s, · line 1222
Quoted 8 lines
hw/mips/mips_malta.c +1
-1@@ -1207,7 +1216,7 @@ static void mips_create_cpu(MachineState *ms, MaltaState *s, qemu_irq *cbus_irq, qemu_irq *i8259_irq) {if ((ms->smp.cpus >1 ) &&cpu_supports_cps_smp (ms->cpu_type)) { -create_cps (ms, s, cbus_irq, i8259_irq); +create_cps (ms, s, cbus_irq, i8259_irq, &error_fatal); }else {create_cpu_without_cps (ms, cbus_irq, i8259_irq); }
This patch also requires:
-- >8 --
@@ -1241,7 +1241,7 @@ void mips_malta_init(MachineState *machine)
int64_t kernel_entry, bootloader_run_addr;
PCIBus *pci_bus;
ISABus *isa_bus;
- qemu_irq cbus_irq, i8259_irq;
+ qemu_irq cbus_irq, i8259_irq = NULL;
I2CBus *smbus;
DriveInfo *dinfo;
int fl_idx = 0;---
else it fails building with gcc -O3:
hw/mips/mips_malta.c: In function ‘mips_malta_init’:hw/mips/mips_malta.c:1419:5: warning: ‘i8259_irq’ may be used uninitialized in this function [-Wmaybe-uninitialized]
1419 | qdev_connect_gpio_out_named(dev, "intr", 0, i8259_irq);
| ^~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~Re: [PATCH-for-5.1 v2 53/54] hw/mips/mips_malta: Add missing error-propagation code
In reply to Philippe Mathieu-DaudéQuoted 57 lines · Philippe Mathieu-Daudé
Running the coccinelle script produced:
$ spatch \ --macro-file scripts/cocci-macro-file.h --include-headers \ --sp-file scripts/coccinelle/find-missing-error_propagate.cocci \ --keep-comments --smpl-spacing --dir . HANDLING: ./hw/mips/mips_malta.c [[manual check required: error_propagate() might be missing in object_property_set_int() ./hw/mips/mips_malta.c:1193:4]] [[manual check required: error_propagate() might be missing in object_property_set_str() ./hw/mips/mips_malta.c:1192:4]]Add the missing
error_propagate()after review by adding a Error* parameter tocreate_cps().Reviewed-by Peter Maydell <[email protected]>Reviewed-by Aleksandar Markovic <[email protected]>Signed-off-by Philippe Mathieu-Daudé <[email protected]>--- hw/mips/mips_malta.c | 19 ++++++++++++++----- 1 file changed, 14 insertions(+), 5 deletions(-)hw/mips/mips_malta.c +13
-4@@ -1183,18 +1183,27 @@ static void create_cpu_without_cps(MachineState *ms, }static void create_cps (MachineState *ms,MaltaState *s, -qemu_irq *cbus_irq,qemu_irq *i8259_irq) +qemu_irq *cbus_irq,qemu_irq *i8259_irq, +Error **errp) {Error *err =NULL ;sysbus_init_child_obj (OBJECT (s),"cps" ,OBJECT (&s->cps),sizeof (s->cps),TYPE_MIPS_CPS );object_property_set_str (OBJECT (&s->cps), ms->cpu_type,"cpu-type" , &err); +if (err) { +error_propagate (errp, err); +return ; + }object_property_set_int (OBJECT (&s->cps), ms->smp.cpus,"num-vp" , &err); +if (err) { +error_propagate (errp, err); +return ; + }object_property_set_bool (OBJECT (&s->cps), true,"realized" , &err); -if (err !=NULL ) { -error_report ("%s" ,error_get_pretty (err)); -exit (1 ); +if (err) { +error_propagate (errp, err); +return ; }sysbus_mmio_map_overlap (SYS_BUS_DEVICE (&s->cps),0 ,0 ,1 );
hw/mips/mips_malta.c static void mips_create_cpu(MachineState *ms, MaltaState *s, · line 1219
Quoted 5 lines
hw/mips/mips_malta.c +1
-1@@ -1207,7 +1216,7 @@ static void mips_create_cpu(MachineState *ms, MaltaState *s, qemu_irq *cbus_irq, qemu_irq *i8259_irq) {if ((ms->smp.cpus >1 ) &&cpu_supports_cps_smp (ms->cpu_type)) { -create_cps (ms, s, cbus_irq, i8259_irq); +create_cps (ms, s, cbus_irq, i8259_irq, &error_fatal);
Are you going to replace this with something else later? Otherwise it doesn't seem useful to add the argument here, as opposed to using error_fatal in create_cpus()
r~
Re: [PATCH-for-5.1 v2 53/54] hw/mips/mips_malta: Add missing error-propagation code
Quoted 56 lines · Richard Henderson
Quoted 55 lines · Philippe Mathieu-Daudé
Running the coccinelle script produced:
$ spatch \ --macro-file scripts/cocci-macro-file.h --include-headers \ --sp-file scripts/coccinelle/find-missing-error_propagate.cocci \ --keep-comments --smpl-spacing --dir . HANDLING: ./hw/mips/mips_malta.c [[manual check required: error_propagate() might be missing in object_property_set_int() ./hw/mips/mips_malta.c:1193:4]] [[manual check required: error_propagate() might be missing in object_property_set_str() ./hw/mips/mips_malta.c:1192:4]]Add the missing
error_propagate()after review by adding a Error* parameter tocreate_cps().Reviewed-by Peter Maydell <[email protected]>Reviewed-by Aleksandar Markovic <[email protected]>Signed-off-by Philippe Mathieu-Daudé <[email protected]>--- hw/mips/mips_malta.c | 19 ++++++++++++++----- 1 file changed, 14 insertions(+), 5 deletions(-)hw/mips/mips_malta.c +13
-4@@ -1183,18 +1183,27 @@ static void create_cpu_without_cps(MachineState *ms, }static void create_cps (MachineState *ms,MaltaState *s, -qemu_irq *cbus_irq,qemu_irq *i8259_irq) +qemu_irq *cbus_irq,qemu_irq *i8259_irq, +Error **errp) {Error *err =NULL ;sysbus_init_child_obj (OBJECT (s),"cps" ,OBJECT (&s->cps),sizeof (s->cps),TYPE_MIPS_CPS );object_property_set_str (OBJECT (&s->cps), ms->cpu_type,"cpu-type" , &err); +if (err) { +error_propagate (errp, err); +return ; + }object_property_set_int (OBJECT (&s->cps), ms->smp.cpus,"num-vp" , &err); +if (err) { +error_propagate (errp, err); +return ; + }object_property_set_bool (OBJECT (&s->cps), true,"realized" , &err); -if (err !=NULL ) { -error_report ("%s" ,error_get_pretty (err)); -exit (1 ); +if (err) { +error_propagate (errp, err); +return ; }
Quoted 9 lines
hw/mips/mips_malta.c static void mips_create_cpu(MachineState *ms, MaltaState *s, · line 1219
Quoted 7 lines
hw/mips/mips_malta.c +1
-1sysbus_mmio_map_overlap (SYS_BUS_DEVICE (&s->cps),0 ,0 ,1 );@@ -1207,7 +1216,7 @@ static void mips_create_cpu(MachineState *ms, MaltaState *s, qemu_irq *cbus_irq, qemu_irq *i8259_irq) {if ((ms->smp.cpus >1 ) &&cpu_supports_cps_smp (ms->cpu_type)) { -create_cps (ms, s, cbus_irq, i8259_irq); +create_cps (ms, s, cbus_irq, i8259_irq, &error_fatal);Are you going to replace this with something else later?
No, indeed.
Quoted 2 lines
Otherwise it doesn't seem useful to add the argument here, as opposed to using
error_fatalincreate_cpus()
Good suggestion, thanks!
PATCH v2 54/54 qga/commands-win32: Add missing error-propagation code
In reply to Philippe Mathieu-DaudéRunning the coccinelle script produced:
$ spatch \
--macro-file scripts/cocci-macro-file.h --include-headers \
--sp-file scripts/coccinelle/find-missing-error_propagate.cocci \
--keep-comments --smpl-spacing --dir .
HANDLING: ./qga/commands-win32.c
[[manual check required: error_propagate() might be missing in acquire_privilege() ./qga/commands-win32.c:1344:4]]
[[manual check required: error_propagate() might be missing in acquire_privilege() ./qga/commands-win32.c:1360:4]]
[[manual check required: error_propagate() might be missing in check_suspend_mode() ./qga/commands-win32.c:1343:4]]
[[manual check required: error_propagate() might be missing in check_suspend_mode() ./qga/commands-win32.c:1359:4]]Add the missing error_propagate() after review.
--- qga/commands-win32.c | 26 ++++++++++++++++++-------- 1 file changed, 18 insertions(+), 8 deletions(-)
qga/commands-win32.c +18 -8
@@ -1341,13 +1341,18 @@ void qmp_guest_suspend_disk(Error **errp) *mode =GUEST_SUSPEND_MODE_DISK ;check_suspend_mode (*mode, &local_err); +if (local_err) { + goto out; + }acquire_privilege (SE_SHUTDOWN_NAME , &local_err); +if (local_err) { + goto out; + }execute_async (do_suspend, mode, &local_err); -if (local_err) { -error_propagate (errp, local_err); -g_free (mode); - } +out: +error_propagate (errp, local_err); +g_free (mode); }void qmp_guest_suspend_ram (Error **errp)
@@ -1357,13 +1362,18 @@ void qmp_guest_suspend_ram(Error **errp) *mode =GUEST_SUSPEND_MODE_RAM ;check_suspend_mode (*mode, &local_err); +if (local_err) { + goto out; + }acquire_privilege (SE_SHUTDOWN_NAME , &local_err); +if (local_err) { + goto out; + }execute_async (do_suspend, mode, &local_err); -if (local_err) { -error_propagate (errp, local_err); -g_free (mode); - } +out: +error_propagate (errp, local_err); +g_free (mode); }void qmp_guest_suspend_hybrid (Error **errp)
Signature · 1 line
2.21.1
Patchew URL: https://patchew.org/QEMU/[email protected]/
Patchew URL: https://patchew.org/QEMU/[email protected]/
Hi,
This series failed the asan build test. Please find the testing commands and their output below. If you have Docker installed, you can probably reproduce it locally.
=== TEST SCRIPT BEGIN ===
#!/bin/bash
export ARCH=x86_64
make docker-image-fedora V=1 NETWORK=1
time make docker-test-debug@fedora TARGET_LIST=x86_64-softmmu J=14 NETWORK=1 === TEST SCRIPT END ===
clang -iquote /tmp/qemu-test/build/. -iquote . -iquote /tmp/qemu-test/src/tcg/i386 -isystem /tmp/qemu-test/src/linux-headers -isystem /tmp/qemu-test/build/linux-headers -iquote . -iquote /tmp/qemu-test/src -iquote /tmp/qemu-test/src/accel/tcg -iquote /tmp/qemu-test/src/include -iquote /tmp/qemu-test/src/disas/libvixl -I/tmp/qemu-test/src/tests/fp -I/tmp/qemu-test/src/tests/fp/berkeley-softfloat-3/source/include -I/tmp/qemu-test/src/tests/fp/berkeley-softfloat-3/source/8086-SSE -I/tmp/qemu-test/src/tests/fp/berkeley-testfloat-3/source -I/usr/include/pixman-1 -Werror -fsanitize=undefined -fsanitize=address -pthread -I/usr/include/glib-2.0 -I/usr/lib64/glib-2.0/include -fPIE -DPIE -m64 -mcx16 -D_GNU_SOURCE -D_FILE_OFFSET_BITS=64 -D_LARGEFILE_SOURCE -Wstrict-prototypes -Wredundant-decls -Wall -Wundef -Wwrite-strings -Wmissing-prototypes -fno-strict-aliasing -fno-common -fwrapv -std=gnu99 -Wno-string-plus-int -Wno-typedef-redefinition -Wno-initializer-overrides -Wexpansion-to-defined -Wendif-labels -Wno-shift-negative-value -Wno-missing-include-dirs -Wempty-body -Wnested-externs -Wformat-security -Wformat-y2k -Winit-self -Wignored-qualifiers -Wold-style-definition -Wtype-limits -fstack-protector-strong -I/usr/include/p11-kit-1 -DLEGACY_RDMA_REG_MR -DSTRUCT_IOVEC_DEFINED -I/usr/include/libpng16 -I/usr/include/spice-1 -I/usr/include/spice-server -I/usr/include/cacard -I/usr/include/glib-2.0 -I/usr/lib64/glib-2.0/include -I/usr/include/nss3 -I/usr/include/nspr4 -pthread -I/usr/include/libmount -I/usr/include/blkid -I/usr/include/uuid -I/usr/include/pixman-1 -DHW_POISON_H -DTARGET_ARM -DSOFTFLOAT_ROUND_ODD -DINLINE_LEVEL=5 -DSOFTFLOAT_FAST_DIV32TO16 -DSOFTFLOAT_FAST_DIV64TO32 -DSOFTFLOAT_FAST_INT64 -DFLOAT16 -DFLOAT64 -DEXTFLOAT80 -DFLOAT128 -DFLOAT_ROUND_ODD -DLONG_DOUBLE_IS_EXTFLOAT80 -Wno-strict-prototypes -Wno-unknown-pragmas -Wno-uninitialized -Wno-missing-prototypes -Wno-return-type -Wno-unused-function -Wno-error -MMD -MP -MT verCases_common.o -MF ./verCases_common.d -g -c -o verCases_common.o /tmp/qemu-test/src/tests/fp/berkeley-testfloat-3/source/verCases_common.c
clang -iquote /tmp/qemu-test/build/. -iquote . -iquote /tmp/qemu-test/src/tcg/i386 -isystem /tmp/qemu-test/src/linux-headers -isystem /tmp/qemu-test/build/linux-headers -iquote . -iquote /tmp/qemu-test/src -iquote /tmp/qemu-test/src/accel/tcg -iquote /tmp/qemu-test/src/include -iquote /tmp/qemu-test/src/disas/libvixl -I/tmp/qemu-test/src/tests/fp -I/tmp/qemu-test/src/tests/fp/berkeley-softfloat-3/source/include -I/tmp/qemu-test/src/tests/fp/berkeley-softfloat-3/source/8086-SSE -I/tmp/qemu-test/src/tests/fp/berkeley-testfloat-3/source -I/usr/include/pixman-1 -Werror -fsanitize=undefined -fsanitize=address -pthread -I/usr/include/glib-2.0 -I/usr/lib64/glib-2.0/include -fPIE -DPIE -m64 -mcx16 -D_GNU_SOURCE -D_FILE_OFFSET_BITS=64 -D_LARGEFILE_SOURCE -Wstrict-prototypes -Wredundant-decls -Wall -Wundef -Wwrite-strings -Wmissing-prototypes -fno-strict-aliasing -fno-common -fwrapv -std=gnu99 -Wno-string-plus-int -Wno-typedef-redefinition -Wno-initializer-overrides -Wexpansion-to-defined -Wendif-labels -Wno-shift-negative-value -Wno-missing-include-dirs -Wempty-body -Wnested-externs -Wformat-security -Wformat-y2k -Winit-self -Wignored-qualifiers -Wold-style-definition -Wtype-limits -fstack-protector-strong -I/usr/include/p11-kit-1 -DLEGACY_RDMA_REG_MR -DSTRUCT_IOVEC_DEFINED -I/usr/include/libpng16 -I/usr/include/spice-1 -I/usr/include/spice-server -I/usr/include/cacard -I/usr/include/glib-2.0 -I/usr/lib64/glib-2.0/include -I/usr/include/nss3 -I/usr/include/nspr4 -pthread -I/usr/include/libmount -I/usr/include/blkid -I/usr/include/uuid -I/usr/include/pixman-1 -DHW_POISON_H -DTARGET_ARM -DSOFTFLOAT_ROUND_ODD -DINLINE_LEVEL=5 -DSOFTFLOAT_FAST_DIV32TO16 -DSOFTFLOAT_FAST_DIV64TO32 -DSOFTFLOAT_FAST_INT64 -DFLOAT16 -DFLOAT64 -DEXTFLOAT80 -DFLOAT128 -DFLOAT_ROUND_ODD -DLONG_DOUBLE_IS_EXTFLOAT80 -Wno-strict-prototypes -Wno-unknown-pragmas -Wno-uninitialized -Wno-missing-prototypes -Wno-return-type -Wno-unused-function -Wno-error -MMD -MP -MT verCases_writeFunctionName.o -MF ./verCases_writeFunctionName.d -g -c -o verCases_writeFunctionName.o /tmp/qemu-test/src/tests/fp/berkeley-testfloat-3/source/verCases_writeFunctionName.c
clang -iquote /tmp/qemu-test/build/tests/qtest/libqos -iquote tests/qtest/libqos -iquote /tmp/qemu-test/src/tcg/i386 -isystem /tmp/qemu-test/src/linux-headers -isystem /tmp/qemu-test/build/linux-headers -iquote . -iquote /tmp/qemu-test/src -iquote /tmp/qemu-test/src/accel/tcg -iquote /tmp/qemu-test/src/include -iquote /tmp/qemu-test/src/disas/libvixl -I/usr/include/pixman-1 -Werror -fsanitize=undefined -fsanitize=address -pthread -I/usr/include/glib-2.0 -I/usr/lib64/glib-2.0/include -fPIE -DPIE -m64 -mcx16 -D_GNU_SOURCE -D_FILE_OFFSET_BITS=64 -D_LARGEFILE_SOURCE -Wstrict-prototypes -Wredundant-decls -Wall -Wundef -Wwrite-strings -Wmissing-prototypes -fno-strict-aliasing -fno-common -fwrapv -std=gnu99 -Wno-string-plus-int -Wno-typedef-redefinition -Wno-initializer-overrides -Wexpansion-to-defined -Wendif-labels -Wno-shift-negative-value -Wno-missing-include-dirs -Wempty-body -Wnested-externs -Wformat-security -Wformat-y2k -Winit-self -Wignored-qualifiers -Wold-style-definition -Wtype-limits -fstack-protector-strong -I/usr/include/p11-kit-1 -DLEGACY_RDMA_REG_MR -DSTRUCT_IOVEC_DEFINED -I/usr/include/libpng16 -I/usr/include/spice-1 -I/usr/include/spice-server -I/usr/include/cacard -I/usr/include/glib-2.0 -I/usr/lib64/glib-2.0/include -I/usr/include/nss3 -I/usr/include/nspr4 -pthread -I/usr/include/libmount -I/usr/include/blkid -I/usr/include/uuid -I/usr/include/pixman-1 -I/tmp/qemu-test/src/tests -I/tmp/qemu-test/src/tests/qtest -MMD -MP -MT tests/qtest/libqos/arm-virt-machine.o -MF tests/qtest/libqos/arm-virt-machine.d -g -c -o tests/qtest/libqos/arm-virt-machine.o /tmp/qemu-test/src/tests/qtest/libqos/arm-virt-machine.c/tmp/qemu-test/src/tests/test-qdev-global-props.c:154:38: error: use of undeclared identifier 'error_abort'
NULL, NULL, &error_abort);
^
/tmp/qemu-test/src/tests/test-qdev-global-props.c:156:38: error: use of undeclared identifier 'error_abort'
NULL, NULL, &error_abort);
^2 errors generated.
make: *** [/tmp/qemu-test/src/rules.mak:69: tests/test-qdev-global-props.o] Error 1
make: *** Waiting for unfinished jobs....
clang -iquote /tmp/qemu-test/build/. -iquote . -iquote /tmp/qemu-test/src/tcg/i386 -isystem /tmp/qemu-test/src/linux-headers -isystem /tmp/qemu-test/build/linux-headers -iquote . -iquote /tmp/qemu-test/src -iquote /tmp/qemu-test/src/accel/tcg -iquote /tmp/qemu-test/src/include -iquote /tmp/qemu-test/src/disas/libvixl -I/tmp/qemu-test/src/tests/fp -I/tmp/qemu-test/src/tests/fp/berkeley-softfloat-3/source/include -I/tmp/qemu-test/src/tests/fp/berkeley-softfloat-3/source/8086-SSE -I/tmp/qemu-test/src/tests/fp/berkeley-testfloat-3/source -I/usr/include/pixman-1 -Werror -fsanitize=undefined -fsanitize=address -pthread -I/usr/include/glib-2.0 -I/usr/lib64/glib-2.0/include -fPIE -DPIE -m64 -mcx16 -D_GNU_SOURCE -D_FILE_OFFSET_BITS=64 -D_LARGEFILE_SOURCE -Wstrict-prototypes -Wredundant-decls -Wall -Wundef -Wwrite-strings -Wmissing-prototypes -fno-strict-aliasing -fno-common -fwrapv -std=gnu99 -Wno-string-plus-int -Wno-typedef-redefinition -Wno-initializer-overrides -Wexpansion-to-defined -Wendif-labels -Wno-shift-negative-value -Wno-missing-include-dirs -Wempty-body -Wnested-externs -Wformat-security -Wformat-y2k -Winit-self -Wignored-qualifiers -Wold-style-definition -Wtype-limits -fstack-protector-strong -I/usr/include/p11-kit-1 -DLEGACY_RDMA_REG_MR -DSTRUCT_IOVEC_DEFINED -I/usr/include/libpng16 -I/usr/include/spice-1 -I/usr/include/spice-server -I/usr/include/cacard -I/usr/include/glib-2.0 -I/usr/lib64/glib-2.0/include -I/usr/include/nss3 -I/usr/include/nspr4 -pthread -I/usr/include/libmount -I/usr/include/blkid -I/usr/include/uuid -I/usr/include/pixman-1 -DHW_POISON_H -DTARGET_ARM -DSOFTFLOAT_ROUND_ODD -DINLINE_LEVEL=5 -DSOFTFLOAT_FAST_DIV32TO16 -DSOFTFLOAT_FAST_DIV64TO32 -DSOFTFLOAT_FAST_INT64 -DFLOAT16 -DFLOAT64 -DEXTFLOAT80 -DFLOAT128 -DFLOAT_ROUND_ODD -DLONG_DOUBLE_IS_EXTFLOAT80 -Wno-strict-prototypes -Wno-unknown-pragmas -Wno-uninitialized -Wno-missing-prototypes -Wno-return-type -Wno-unused-function -Wno-error -MMD -MP -MT readHex.o -MF ./readHex.d -g -c -o readHex.o /tmp/qemu-test/src/tests/fp/berkeley-testfloat-3/source/readHex.c
clang -iquote /tmp/qemu-test/build/. -iquote . -iquote /tmp/qemu-test/src/tcg/i386 -isystem /tmp/qemu-test/src/linux-headers -isystem /tmp/qemu-test/build/linux-headers -iquote . -iquote /tmp/qemu-test/src -iquote /tmp/qemu-test/src/accel/tcg -iquote /tmp/qemu-test/src/include -iquote /tmp/qemu-test/src/disas/libvixl -I/tmp/qemu-test/src/tests/fp -I/tmp/qemu-test/src/tests/fp/berkeley-softfloat-3/source/include -I/tmp/qemu-test/src/tests/fp/berkeley-softfloat-3/source/8086-SSE -I/tmp/qemu-test/src/tests/fp/berkeley-testfloat-3/source -I/usr/include/pixman-1 -Werror -fsanitize=undefined -fsanitize=address -pthread -I/usr/include/glib-2.0 -I/usr/lib64/glib-2.0/include -fPIE -DPIE -m64 -mcx16 -D_GNU_SOURCE -D_FILE_OFFSET_BITS=64 -D_LARGEFILE_SOURCE -Wstrict-prototypes -Wredundant-decls -Wall -Wundef -Wwrite-strings -Wmissing-prototypes -fno-strict-aliasing -fno-common -fwrapv -std=gnu99 -Wno-string-plus-int -Wno-typedef-redefinition -Wno-initializer-overrides -Wexpansion-to-defined -Wendif-labels -Wno-shift-negative-value -Wno-missing-include-dirs -Wempty-body -Wnested-externs -Wformat-security -Wformat-y2k -Winit-self -Wignored-qualifiers -Wold-style-definition -Wtype-limits -fstack-protector-strong -I/usr/include/p11-kit-1 -DLEGACY_RDMA_REG_MR -DSTRUCT_IOVEC_DEFINED -I/usr/include/libpng16 -I/usr/include/spice-1 -I/usr/include/spice-server -I/usr/include/cacard -I/usr/include/glib-2.0 -I/usr/lib64/glib-2.0/include -I/usr/include/nss3 -I/usr/include/nspr4 -pthread -I/usr/include/libmount -I/usr/include/blkid -I/usr/include/uuid -I/usr/include/pixman-1 -DHW_POISON_H -DTARGET_ARM -DSOFTFLOAT_ROUND_ODD -DINLINE_LEVEL=5 -DSOFTFLOAT_FAST_DIV32TO16 -DSOFTFLOAT_FAST_DIV64TO32 -DSOFTFLOAT_FAST_INT64 -DFLOAT16 -DFLOAT64 -DEXTFLOAT80 -DFLOAT128 -DFLOAT_ROUND_ODD -DLONG_DOUBLE_IS_EXTFLOAT80 -Wno-strict-prototypes -Wno-unknown-pragmas -Wno-uninitialized -Wno-missing-prototypes -Wno-return-type -Wno-unused-function -Wno-error -MMD -MP -MT writeHex.o -MF ./writeHex.d -g -c -o writeHex.o /tmp/qemu-test/src/tests/fp/berkeley-testfloat-3/source/writeHex.c
---
raise CalledProcessError(retcode, cmd)
subprocess.CalledProcessError: Command '['sudo', '-n', 'docker', 'run', '--label', 'com.qemu.instance.uuid=f473f0005c1842bab0cbe67aad77cfbe', '-u', '1001', '--security-opt', 'seccomp=unconfined', '--rm', '-e', 'TARGET_LIST=x86_64-softmmu', '-e', 'EXTRA_CONFIGURE_OPTS=', '-e', 'V=', '-e', 'J=14', '-e', 'DEBUG=', '-e', 'SHOW_ENV=', '-e', 'CCACHE_DIR=/var/tmp/ccache', '-v', '/home/patchew/.cache/qemu-docker-ccache:/var/tmp/ccache:z', '-v', '/var/tmp/patchew-tester-tmp-myvo9b9l/src/docker-src.2020-04-06-16.30.15.31389:/var/tmp/qemu:z,ro', 'qemu:fedora', '/var/tmp/qemu/run', 'test-debug']' returned non-zero exit status 2. filter=--filter=label=com.qemu.instance.uuid=f473f0005c1842bab0cbe67aad77cfbe
make[1]: *** [docker-run] Error 1
make[1]: Leaving directory `/var/tmp/patchew-tester-tmp-myvo9b9l/src'
make: *** [docker-run-test-debug@fedora] Error 2
real 4m20.094s
user 0m9.258s
The full log is available at
http://patchew.org/logs/[email protected]/testing.asan/?type=message.
---
Email generated automatically by Patchew [https://patchew.org/].
Please send your feedback to [email protected]
Patchew URL: https://patchew.org/QEMU/[email protected]/
Patchew URL: https://patchew.org/QEMU/[email protected]/
Hi,
This series failed the docker-quick@centos7 build test. Please find the testing commands and their output below. If you have Docker installed, you can probably reproduce it locally.
=== TEST SCRIPT BEGIN ===
#!/bin/bash
make docker-image-centos7 V=1 NETWORK=1
time make docker-test-quick@centos7 SHOW_ENV=1 J=14 NETWORK=1 === TEST SCRIPT END ===
BUILD fp-test
CC tests/qtest/endianness-test.o/tmp/qemu-test/src/tests/test-qdev-global-props.c: In function 'dynamic_instance_init':/tmp/qemu-test/src/tests/test-qdev-global-props.c:154:38: error: 'error_abort' undeclared (first use in this function)
NULL, NULL, &error_abort);
^/tmp/qemu-test/src/tests/test-qdev-global-props.c:154:38: note: each undeclared identifier is reported only once for each function it appears in
make: *** [tests/test-qdev-global-props.o] Error 1
make: *** Waiting for unfinished jobs....
CC fp-test.o
CC slowfloat.o
---
raise CalledProcessError(retcode, cmd)
subprocess.CalledProcessError: Command '['sudo', '-n', 'docker', 'run', '--label', 'com.qemu.instance.uuid=c834ecdcff4e47c596ebdcf857245223', '-u', '1001', '--security-opt', 'seccomp=unconfined', '--rm', '-e', 'TARGET_LIST=', '-e', 'EXTRA_CONFIGURE_OPTS=', '-e', 'V=', '-e', 'J=14', '-e', 'DEBUG=', '-e', 'SHOW_ENV=1', '-e', 'CCACHE_DIR=/var/tmp/ccache', '-v', '/home/patchew/.cache/qemu-docker-ccache:/var/tmp/ccache:z', '-v', '/var/tmp/patchew-tester-tmp-12shpxs0/src/docker-src.2020-04-06-16.36.57.9698:/var/tmp/qemu:z,ro', 'qemu:centos7', '/var/tmp/qemu/run', 'test-quick']' returned non-zero exit status 2. filter=--filter=label=com.qemu.instance.uuid=c834ecdcff4e47c596ebdcf857245223
make[1]: *** [docker-run] Error 1
make[1]: Leaving directory `/var/tmp/patchew-tester-tmp-12shpxs0/src'
make: *** [docker-run-test-quick@centos7] Error 2
real 2m47.727s
user 0m8.997s
The full log is available at
http://patchew.org/logs/[email protected]/testing.docker-quick@centos7/?type=message.
---
Email generated automatically by Patchew [https://patchew.org/].
Please send your feedback to [email protected]