@samitouri / QOSamiQemu / commits / 07a965e6b7

virtio-mem: use warn_report_err_once()

Signed-off-by: Marc-André Lureau <marcandre.lureau@redhat.com> Reviewed-by: Cédric Le Goater <clg@redhat.com> Reviewed-by: Peter Xu <peterx@redhat.com> Acked-by: David Hildenbrand (Arm) <david@kernel.org> Link: https://lore.kernel.org/r/20260226140001.3622334-4-marcandre.lureau@redhat.com Signed-off-by: Peter Xu <peterx@redhat.com>

Marc-André Lureau committed Feb 26, 2026 at 14:59 UTC 07a965e6b7d75b08fbc6e59bf00c3fd26359307a
1 file changed +1 -12
hw/virtio/virtio-mem.c
+1 -12
@@ -594,18 +594,7 @@ static int virtio_mem_set_block_state(VirtIOMEM *vmem, uint64_t start_gpa,
594 Error *local_err = NULL;
595
596 if (!qemu_prealloc_mem(fd, area, size, 1, NULL, false, &local_err)) {
597 - static bool warned;
598 -
599 - /*
600 - * Warn only once, we don't want to fill the log with these
601 - * warnings.
602 - */
603 - if (!warned) {
604 - warn_report_err(local_err);
605 - warned = true;
606 - } else {
607 - error_free(local_err);
608 - }
597 + warn_report_err_once(local_err);
598 ret = -EBUSY;
599 }
600 }