Skip to content
Snippets Groups Projects
Commit b6d9766d authored by Jia Liu's avatar Jia Liu
Browse files

hw/openrisc: Avoid using uninitialised variable 'entry'


clang warns that cpu_openrisc_load_kernel() can use 'entry' uninitialized:

hw/openrisc/openrisc_sim.c:69:9: error: variable 'entry' is used uninitialized
whenever '&&' condition is false [-Werror,-Wsometimes-uninitialized]

    if (kernel_filename && !qtest_enabled()) {
        ^~~~~~~~~~~~~~~
hw/openrisc/openrisc_sim.c:91:19: note: uninitialized use occurs here
    cpu->env.pc = entry;
                  ^~~~~

Fix this by not attempting to change the CPU's starting PC unless
we actually loaded a kernel.

Signed-off-by: default avatarPeter Maydell <peter.maydell@linaro.org>
Reviewed-by: default avatarJia Liu <proljc@gmail.com>
parent ecfe10c9
No related branches found
No related tags found
No related merge requests found
......@@ -86,9 +86,8 @@ static void cpu_openrisc_load_kernel(ram_addr_t ram_size,
kernel_filename);
exit(1);
}
cpu->env.pc = entry;
}
cpu->env.pc = entry;
}
static void openrisc_sim_init(QEMUMachineInitArgs *args)
......
0% Loading or .
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment