mirror of
https://github.com/Motorhead1991/qemu.git
synced 2025-08-04 08:13:54 -06:00
target-tricore: check return value before using it
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 <zhang.zhanghailiang@huawei.com> Reviewed-by: Bastian Koppelmann <kbastian@mail.uni-paderborn.de> Signed-off-by: Michael Tokarev <mjt@tls.msk.ru>
This commit is contained in:
parent
44d8d2b2dd
commit
8ef2b256b9
1 changed files with 1 additions and 1 deletions
|
@ -71,11 +71,11 @@ static void tricore_testboard_init(MachineState *machine, int board_id)
|
|||
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);
|
||||
|
|
Loading…
Add table
Add a link
Reference in a new issue