diff options
author | zhanghailiang <zhang.zhanghailiang@huawei.com> | 2014-10-30 10:03:28 +0800 |
---|---|---|
committer | Michael Tokarev <mjt@tls.msk.ru> | 2014-11-02 10:04:34 +0300 |
commit | 8ef2b256b94696a3a4bd8aa69a2b0fd7bc246f07 (patch) | |
tree | 57fac7b02fdbb2a6d7095eb8bc3b9d05c598e5b6 /hw/tricore | |
parent | 44d8d2b2ddbaa3ee4125ec6cb2e8691e6348b01e (diff) | |
download | hqemu-8ef2b256b94696a3a4bd8aa69a2b0fd7bc246f07.zip hqemu-8ef2b256b94696a3a4bd8aa69a2b0fd7bc246f07.tar.gz |
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>
Diffstat (limited to 'hw/tricore')
-rw-r--r-- | hw/tricore/tricore_testboard.c | 2 |
1 files changed, 1 insertions, 1 deletions
diff --git a/hw/tricore/tricore_testboard.c b/hw/tricore/tricore_testboard.c index eeb4922..a059a20 100644 --- a/hw/tricore/tricore_testboard.c +++ b/hw/tricore/tricore_testboard.c @@ -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); |