* [PATCH] cpuid: use unsigned for max cpuid
@ 2022-01-25 19:24 Michael S. Tsirkin
2022-01-25 20:33 ` Philippe Mathieu-Daudé via
0 siblings, 1 reply; 2+ messages in thread
From: Michael S. Tsirkin @ 2022-01-25 19:24 UTC (permalink / raw)
To: qemu-devel; +Cc: Paolo Bonzini, Richard Henderson, Richard Henderson
__get_cpuid_max returns an unsigned value.
For consistency, store the result in an unsigned variable.
Found by running ./configure --extra-cflags=-Wconversion
Cc: Paolo Bonzini <pbonzini@redhat.com>
Cc: Richard Henderson <rth@twiddle.net>
Signed-off-by: Michael S. Tsirkin <mst@redhat.com>
---
Richard, if appropriate pls queue this.
Thanks!
configure | 2 +-
util/bufferiszero.c | 2 +-
tcg/i386/tcg-target.c.inc | 2 +-
3 files changed, 3 insertions(+), 3 deletions(-)
diff --git a/configure b/configure
index e1a31fb332..938f43a59a 100755
--- a/configure
+++ b/configure
@@ -2768,7 +2768,7 @@ cat > $TMPC << EOF
#include <cpuid.h>
int main(void) {
unsigned a, b, c, d;
- int max = __get_cpuid_max(0, 0);
+ unsigned max = __get_cpuid_max(0, 0);
if (max >= 1) {
__cpuid(1, a, b, c, d);
diff --git a/util/bufferiszero.c b/util/bufferiszero.c
index 695bb4ce28..ec3cd4ca15 100644
--- a/util/bufferiszero.c
+++ b/util/bufferiszero.c
@@ -272,7 +272,7 @@ static void init_accel(unsigned cache)
static void __attribute__((constructor)) init_cpuid_cache(void)
{
- int max = __get_cpuid_max(0, NULL);
+ unsigned max = __get_cpuid_max(0, NULL);
int a, b, c, d;
unsigned cache = 0;
diff --git a/tcg/i386/tcg-target.c.inc b/tcg/i386/tcg-target.c.inc
index 875311f795..4dab09f265 100644
--- a/tcg/i386/tcg-target.c.inc
+++ b/tcg/i386/tcg-target.c.inc
@@ -3747,7 +3747,7 @@ static void tcg_target_init(TCGContext *s)
{
#ifdef CONFIG_CPUID_H
unsigned a, b, c, d, b7 = 0;
- int max = __get_cpuid_max(0, 0);
+ unsigned max = __get_cpuid_max(0, 0);
if (max >= 7) {
/* BMI1 is available on AMD Piledriver and Intel Haswell CPUs. */
--
MST
^ permalink raw reply related [flat|nested] 2+ messages in thread
* Re: [PATCH] cpuid: use unsigned for max cpuid
2022-01-25 19:24 [PATCH] cpuid: use unsigned for max cpuid Michael S. Tsirkin
@ 2022-01-25 20:33 ` Philippe Mathieu-Daudé via
0 siblings, 0 replies; 2+ messages in thread
From: Philippe Mathieu-Daudé via @ 2022-01-25 20:33 UTC (permalink / raw)
To: Michael S. Tsirkin, qemu-devel
Cc: Paolo Bonzini, Richard Henderson, Richard Henderson
On 25/1/22 20:24, Michael S. Tsirkin wrote:
> __get_cpuid_max returns an unsigned value.
> For consistency, store the result in an unsigned variable.
>
> Found by running ./configure --extra-cflags=-Wconversion
>
> Cc: Paolo Bonzini <pbonzini@redhat.com>
> Cc: Richard Henderson <rth@twiddle.net>
> Signed-off-by: Michael S. Tsirkin <mst@redhat.com>
> ---
>
> Richard, if appropriate pls queue this.
> Thanks!
>
> configure | 2 +-
> util/bufferiszero.c | 2 +-
> tcg/i386/tcg-target.c.inc | 2 +-
> 3 files changed, 3 insertions(+), 3 deletions(-)
Reviewed-by: Philippe Mathieu-Daudé <f4bug@amsat.org>
^ permalink raw reply [flat|nested] 2+ messages in thread
end of thread, other threads:[~2022-01-25 20:35 UTC | newest]
Thread overview: 2+ messages (download: mbox.gz / follow: Atom feed)
-- links below jump to the message on this page --
2022-01-25 19:24 [PATCH] cpuid: use unsigned for max cpuid Michael S. Tsirkin
2022-01-25 20:33 ` Philippe Mathieu-Daudé via
This is an external index of several public inboxes,
see mirroring instructions on how to clone and mirror
all data and code used by this external index.