Patchwork ioapic: fix build with DEBUG_IOAPIC

login
register
mail settings
Submitter Jason Wang
Date March 8, 2012, 2:05 a.m.
Message ID <20120308020522.24053.8087.stgit@amd-6168-8-1.englab.nay.redhat.com>
Download mbox | patch
Permalink /patch/145431/
State New
Headers show

Comments

Jason Wang - March 8, 2012, 2:05 a.m.
ioapic.c:198: error: format ‘%08x’ expects type ‘unsigned int’, but argument 3 has type ‘uint64_t’

Signed-off-by: Jason Wang <jasowang@redhat.com>
---
 hw/ioapic.c |    2 +-
 1 files changed, 1 insertions(+), 1 deletions(-)
Stefan Hajnoczi - March 15, 2012, 8:22 a.m.
On Thu, Mar 08, 2012 at 10:05:22AM +0800, Jason Wang wrote:
> ioapic.c:198: error: format ‘%08x’ expects type ‘unsigned int’, but argument 3 has type ‘uint64_t’
> 
> Signed-off-by: Jason Wang <jasowang@redhat.com>
> ---
>  hw/ioapic.c |    2 +-
>  1 files changed, 1 insertions(+), 1 deletions(-)
> 
> diff --git a/hw/ioapic.c b/hw/ioapic.c
> index 3fee011..2b0e6e9 100644
> --- a/hw/ioapic.c
> +++ b/hw/ioapic.c
> @@ -195,7 +195,7 @@ ioapic_mem_write(void *opaque, target_phys_addr_t addr, uint64_t val,
>          if (size != 4) {
>              break;
>          }
> -        DPRINTF("write: %08x = %08x\n", s->ioregsel, val);
> +        DPRINTF("write: %08x = %lx\n", s->ioregsel, val);

Please use PRIx64 since the argument is uint64_t.  On a 32-bit host the
%lx format string will be wrong and the compiler may issue a warning.

Stefan

Patch

diff --git a/hw/ioapic.c b/hw/ioapic.c
index 3fee011..2b0e6e9 100644
--- a/hw/ioapic.c
+++ b/hw/ioapic.c
@@ -195,7 +195,7 @@  ioapic_mem_write(void *opaque, target_phys_addr_t addr, uint64_t val,
         if (size != 4) {
             break;
         }
-        DPRINTF("write: %08x = %08x\n", s->ioregsel, val);
+        DPRINTF("write: %08x = %lx\n", s->ioregsel, val);
         switch (s->ioregsel) {
         case IOAPIC_REG_ID:
             s->id = (val >> IOAPIC_ID_SHIFT) & IOAPIC_ID_MASK;