From: Paolo Bonzini Date: Thu, 10 Apr 2025 16:17:22 +0000 (+0200) Subject: hw/riscv: Fix type conflict of GLib function pointers X-Git-Url: http://git.ipfire.org/?a=commitdiff_plain;h=56cde18d048e1e1f889e31f7553e1f39f03eeec5;p=thirdparty%2Fqemu.git 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 Signed-off-by: Paolo Bonzini Reviewed-by: Alistair Francis Reviewed-by: Kohei Tokunaga Reviewed-by: Philippe Mathieu-Daudé Message-ID: <20250410161722.595634-1-pbonzini@redhat.com> Signed-off-by: Alistair Francis Cc: qemu-stable@nongnu.org --- diff --git a/hw/riscv/riscv_hart.c b/hw/riscv/riscv_hart.c index ac6539bd3e..333083a4f1 100644 --- a/hw/riscv/riscv_hart.c +++ b/hw/riscv/riscv_hart.c @@ -104,8 +104,11 @@ static bool csr_qtest_callback(CharBackend *chr, gchar **words) static void riscv_cpu_register_csr_qtest_callback(void) { - static GOnce once; - g_once(&once, (GThreadFunc)qtest_set_command_cb, csr_qtest_callback); + static bool first = true; + if (first) { + first = false; + qtest_set_command_cb(csr_qtest_callback); + } } #endif