diff mbox series

accel/tcg/icount-common: Consolidate the use of warn_report_once()

Message ID 20240418100716.1085491-1-zhao1.liu@linux.intel.com
State New
Headers show
Series accel/tcg/icount-common: Consolidate the use of warn_report_once() | expand

Commit Message

Zhao Liu April 18, 2024, 10:07 a.m. UTC
From: Zhao Liu <zhao1.liu@intel.com>

Use warn_report_once() to get rid of the static local variable "notified".

Signed-off-by: Zhao Liu <zhao1.liu@intel.com>
---
Note: After cleaning up similar uses in x86, only icount-common.c and
virtio-mem.c still have "only once" usage with static variables.
However, virtio-mem.c uses warn_report_err() and has no associated
*_err_once variant, so it does not need to be cleaned up.
---
 accel/tcg/icount-common.c | 6 ++----
 1 file changed, 2 insertions(+), 4 deletions(-)

Comments

Paolo Bonzini April 18, 2024, 10:06 a.m. UTC | #1
Queued, thanks.

Paolo
diff mbox series

Patch

diff --git a/accel/tcg/icount-common.c b/accel/tcg/icount-common.c
index a4a747d1dc99..8d3d3a7e9dc9 100644
--- a/accel/tcg/icount-common.c
+++ b/accel/tcg/icount-common.c
@@ -336,10 +336,8 @@  void icount_start_warp_timer(void)
     deadline = qemu_clock_deadline_ns_all(QEMU_CLOCK_VIRTUAL,
                                           ~QEMU_TIMER_ATTR_EXTERNAL);
     if (deadline < 0) {
-        static bool notified;
-        if (!icount_sleep && !notified) {
-            warn_report("icount sleep disabled and no active timers");
-            notified = true;
+        if (!icount_sleep) {
+            warn_report_once("icount sleep disabled and no active timers");
         }
         return;
     }