[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]
[Qemu-trivial] [PULL 15/22] hw/timer/mt48t59: Fix bit-rotten NVRAM_PRINT
From: |
Michael Tokarev |
Subject: |
[Qemu-trivial] [PULL 15/22] hw/timer/mt48t59: Fix bit-rotten NVRAM_PRINTF format strings |
Date: |
Sun, 20 May 2018 09:15:01 +0300 |
From: Thomas Huth <address@hidden>
When compiling with NVRAM_PRINTF enabled, gcc currently bails out with:
CC hw/timer/m48t59.o
CC hw/timer/m48t59-isa.o
hw/timer/m48t59.c: In function ‘NVRAM_writeb’:
hw/timer/m48t59.c:460:5: error: format ‘%x’ expects argument of type ‘unsigned
int’, but argument 3 has type ‘hwaddr’ [-Werror=format=]
NVRAM_PRINTF("%s: 0x%08x => 0x%08x\n", __func__, addr, val);
^
hw/timer/m48t59.c:460:5: error: format ‘%x’ expects argument of type ‘unsigned
int’, but argument 4 has type ‘uint64_t’ [-Werror=format=]
hw/timer/m48t59.c: In function ‘NVRAM_readb’:
hw/timer/m48t59.c:492:5: error: format ‘%x’ expects argument of type ‘unsigned
int’, but argument 3 has type ‘hwaddr’ [-Werror=format=]
NVRAM_PRINTF("%s: 0x%08x <= 0x%08x\n", __func__, addr, retval);
Fix it by using the correct format strings and while we're at it,
also change the definition of NVRAM_PRINTF so that this can not
bit-rot so easily again.
Signed-off-by: Thomas Huth <address@hidden>
Reviewed-by: Mark Cave-Ayland <address@hidden>
Signed-off-by: Michael Tokarev <address@hidden>
---
hw/timer/m48t59-internal.h | 9 +++------
hw/timer/m48t59.c | 4 ++--
2 files changed, 5 insertions(+), 8 deletions(-)
diff --git a/hw/timer/m48t59-internal.h b/hw/timer/m48t59-internal.h
index 32ae957805..d0f0caf3c7 100644
--- a/hw/timer/m48t59-internal.h
+++ b/hw/timer/m48t59-internal.h
@@ -25,13 +25,10 @@
#ifndef HW_M48T59_INTERNAL_H
#define HW_M48T59_INTERNAL_H 1
-//#define DEBUG_NVRAM
+#define M48T59_DEBUG 0
-#if defined(DEBUG_NVRAM)
-#define NVRAM_PRINTF(fmt, ...) do { printf(fmt , ## __VA_ARGS__); } while (0)
-#else
-#define NVRAM_PRINTF(fmt, ...) do { } while (0)
-#endif
+#define NVRAM_PRINTF(fmt, ...) do { \
+ if (M48T59_DEBUG) { printf(fmt , ## __VA_ARGS__); } } while (0)
/*
* The M48T02, M48T08 and M48T59 chips are very similar. The newer '59 has
diff --git a/hw/timer/m48t59.c b/hw/timer/m48t59.c
index 742c576443..f2991762ab 100644
--- a/hw/timer/m48t59.c
+++ b/hw/timer/m48t59.c
@@ -456,7 +456,7 @@ static void NVRAM_writeb(void *opaque, hwaddr addr,
uint64_t val,
{
M48t59State *NVRAM = opaque;
- NVRAM_PRINTF("%s: 0x%08x => 0x%08x\n", __func__, addr, val);
+ NVRAM_PRINTF("%s: 0x%"HWADDR_PRIx" => 0x%"PRIx64"\n", __func__, addr, val);
switch (addr) {
case 0:
NVRAM->addr &= ~0x00FF;
@@ -488,7 +488,7 @@ static uint64_t NVRAM_readb(void *opaque, hwaddr addr,
unsigned size)
retval = -1;
break;
}
- NVRAM_PRINTF("%s: 0x%08x <= 0x%08x\n", __func__, addr, retval);
+ NVRAM_PRINTF("%s: 0x%"HWADDR_PRIx" <= 0x%08x\n", __func__, addr, retval);
return retval;
}
--
2.11.0
- [Qemu-trivial] [PULL 00/22] Trivial patches for 2018-05-20, Michael Tokarev, 2018/05/20
- [Qemu-trivial] [PULL 04/22] qemu-option-trace: -trace enable= is a pattern, not a file, Michael Tokarev, 2018/05/20
- [Qemu-trivial] [PULL 13/22] trivial: Do not include pci.h if it is not necessary, Michael Tokarev, 2018/05/20
- [Qemu-trivial] [PULL 01/22] tcg: fix s/compliment/complement/ typos, Michael Tokarev, 2018/05/20
- [Qemu-trivial] [PULL 03/22] slirp/debug: Print IP addresses in human readable form, Michael Tokarev, 2018/05/20
- [Qemu-trivial] [PULL 02/22] misc, ide: remove use of HWADDR_PRIx in trace events, Michael Tokarev, 2018/05/20
- [Qemu-trivial] [PULL 17/22] typedefs: Remove PcGuestInfo from qemu/typedefs.h, Michael Tokarev, 2018/05/20
- [Qemu-trivial] [PULL 15/22] hw/timer/mt48t59: Fix bit-rotten NVRAM_PRINTF format strings,
Michael Tokarev <=
- [Qemu-trivial] [PULL 06/22] qemu-img-commands.hx: argument ordering fixups, Michael Tokarev, 2018/05/20
- [Qemu-trivial] [PULL 20/22] gdbstub: Handle errors in gdb_accept(), Michael Tokarev, 2018/05/20
- [Qemu-trivial] [PULL 08/22] qemu-img: remove references to GEN_DOCS, Michael Tokarev, 2018/05/20
- [Qemu-trivial] [PULL 07/22] qemu-img.texi: fix command ordering, Michael Tokarev, 2018/05/20
- [Qemu-trivial] [PULL 22/22] acpi: fix a comment about aml_call0(), Michael Tokarev, 2018/05/20
- [Qemu-trivial] [PULL 10/22] qemu-img-cmds.hx: add passive-aggressive note, Michael Tokarev, 2018/05/20
- [Qemu-trivial] [PULL 21/22] qapi/net.json: Fix the version number of the "vlan" removal, Michael Tokarev, 2018/05/20
- [Qemu-trivial] [PULL 05/22] HACKING: document preference for g_new instead of g_malloc, Michael Tokarev, 2018/05/20