From: Marc-André Lureau Date: Thu, 26 Feb 2026 13:59:48 +0000 (+0100) Subject: virtio-mem: use warn_report_err_once() X-Git-Tag: v11.0.0-rc0~22^2~6 X-Git-Url: http://git.ipfire.org/gitweb.cgi?a=commitdiff_plain;h=07a965e6b7d75b08fbc6e59bf00c3fd26359307a;p=thirdparty%2Fqemu.git virtio-mem: use warn_report_err_once() Signed-off-by: Marc-André Lureau Reviewed-by: Cédric Le Goater Reviewed-by: Peter Xu Acked-by: David Hildenbrand (Arm) Link: https://lore.kernel.org/r/20260226140001.3622334-4-marcandre.lureau@redhat.com Signed-off-by: Peter Xu --- diff --git a/hw/virtio/virtio-mem.c b/hw/virtio/virtio-mem.c index 251d1d50aaa..a4b71974a1c 100644 --- a/hw/virtio/virtio-mem.c +++ b/hw/virtio/virtio-mem.c @@ -594,18 +594,7 @@ static int virtio_mem_set_block_state(VirtIOMEM *vmem, uint64_t start_gpa, Error *local_err = NULL; if (!qemu_prealloc_mem(fd, area, size, 1, NULL, false, &local_err)) { - static bool warned; - - /* - * Warn only once, we don't want to fill the log with these - * warnings. - */ - if (!warned) { - warn_report_err(local_err); - warned = true; - } else { - error_free(local_err); - } + warn_report_err_once(local_err); ret = -EBUSY; } }