Skip to content

Commit b76d4a5

Browse files
bonziniMichael Tokarev
authored andcommitted
hw/riscv: Fix type conflict of GLib function pointers
qtest_set_command_cb passed to g_once should match GThreadFunc, which it does not. But using g_once is actually unnecessary, because the function is called by riscv_harts_realize() under the Big QEMU Lock. Reported-by: Kohei Tokunaga <[email protected]> Signed-off-by: Paolo Bonzini <[email protected]> Reviewed-by: Alistair Francis <[email protected]> Reviewed-by: Kohei Tokunaga <[email protected]> Reviewed-by: Philippe Mathieu-Daudé <[email protected]> Message-ID: <[email protected]> Signed-off-by: Alistair Francis <[email protected]> Cc: [email protected] (cherry picked from commit 56cde18) Signed-off-by: Michael Tokarev <[email protected]>
1 parent bc15a8d commit b76d4a5

File tree

1 file changed

+5
-2
lines changed

1 file changed

+5
-2
lines changed

hw/riscv/riscv_hart.c

Lines changed: 5 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -104,8 +104,11 @@ static bool csr_qtest_callback(CharBackend *chr, gchar **words)
104104

105105
static void riscv_cpu_register_csr_qtest_callback(void)
106106
{
107-
static GOnce once;
108-
g_once(&once, (GThreadFunc)qtest_set_command_cb, csr_qtest_callback);
107+
static bool first = true;
108+
if (first) {
109+
first = false;
110+
qtest_set_command_cb(csr_qtest_callback);
111+
}
109112
}
110113
#endif
111114

0 commit comments

Comments
 (0)