diff options
author | Zhao Liu <zhao1.liu@intel.com> | 2024-03-27 18:39:49 +0800 |
---|---|---|
committer | Paolo Bonzini <pbonzini@redhat.com> | 2024-04-23 17:35:26 +0200 |
commit | 7502ffb2f3240247e9426fd73b8422e5be54501a (patch) | |
tree | 31867e75442c655475a881d9711a063b145b12fa /target | |
parent | 565f4768bb9cf840b2f8cca41483bb91aa3196a3 (diff) |
target/i386/host-cpu: Consolidate the use of warn_report_once()
Use warn_report_once() to get rid of the static local variable "warned".
Signed-off-by: Zhao Liu <zhao1.liu@intel.com>
Message-ID: <20240327103951.3853425-2-zhao1.liu@linux.intel.com>
Signed-off-by: Paolo Bonzini <pbonzini@redhat.com>
Diffstat (limited to 'target')
-rw-r--r-- | target/i386/host-cpu.c | 11 |
1 files changed, 4 insertions, 7 deletions
diff --git a/target/i386/host-cpu.c b/target/i386/host-cpu.c index 92ecb7254b..280e427c01 100644 --- a/target/i386/host-cpu.c +++ b/target/i386/host-cpu.c @@ -55,18 +55,15 @@ static uint32_t host_cpu_adjust_phys_bits(X86CPU *cpu) { uint32_t host_phys_bits = host_cpu_phys_bits(); uint32_t phys_bits = cpu->phys_bits; - static bool warned; /* * Print a warning if the user set it to a value that's not the * host value. */ - if (phys_bits != host_phys_bits && phys_bits != 0 && - !warned) { - warn_report("Host physical bits (%u)" - " does not match phys-bits property (%u)", - host_phys_bits, phys_bits); - warned = true; + if (phys_bits != host_phys_bits && phys_bits != 0) { + warn_report_once("Host physical bits (%u)" + " does not match phys-bits property (%u)", + host_phys_bits, phys_bits); } if (cpu->host_phys_bits) { |