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.Timeout
While 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(). Signed-off-by: Philippe Mathieu-Daudé <f4...@amsat.org> --- hw/arm/fsl-imx6.c | 8 ++------ 1 file changed, 2 insertions(+), 6 deletions(-) diff --git a/hw/arm/fsl-imx6.c b/hw/arm/fsl-imx6.c index 13f1bf23a6..3d37352b08 100644 --- a/hw/arm/fsl-imx6.c +++ b/hw/arm/fsl-imx6.c @@ -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 */ -- 2.21.1