We reference the return value of cpu before checking whether it is NULL,
The checking code is after that which violates code style.
It makes no difference if the cpu is NULL, qemu process will terminate.
But one will be 'Segmentation fault' and the other will report a error
which is what we want.
Signed-off-by: zhanghailiang <[email protected]>
Reviewed-by: Bastian Koppelmann <[email protected]>
Signed-off-by: Michael Tokarev <[email protected]>
machine->cpu_model = "tc1796";
}
cpu = cpu_tricore_init(machine->cpu_model);
- env = &cpu->env;
if (!cpu) {
error_report("Unable to find CPU definition");
exit(1);
}
+ env = &cpu->env;
memory_region_init_ram(ext_cram, NULL, "powerlink_ext_c.ram", 2*1024*1024, &error_abort);
vmstate_register_ram_global(ext_cram);
memory_region_init_ram(ext_dram, NULL, "powerlink_ext_d.ram", 4*1024*1024, &error_abort);