Skip to contentSkip to conversation

ssi: Fix bad printf format specifiers

PATCH Applied AlexChen 4 participants 4 messages Nov 4, 2020

Subsystems (2)
lore
Share & tools
lore

AlexChen

author
#0 lore raw

PATCH 1/1 ssi: Fix bad printf format specifiers

We should use printf format specifier "%u" instead of "%d" for argument of type "unsigned int".

---
 hw/ssi/imx_spi.c    | 2 +-
 hw/ssi/xilinx_spi.c | 2 +-
 2 files changed, 2 insertions(+), 2 deletions(-)
hw/ssi/imx_spi.c +1 -1
index 7f703d8328..d8885ae454 100644
@@ -53,7 +53,7 @@ static const char *imx_spi_reg_name(uint32_t reg)
     case ECSPI_MSGDATA:
         return  "ECSPI_MSGDATA";
     default:
-        sprintf(unknown, "%d ?", reg);
+        sprintf(unknown, "%u ?", reg);
         return unknown;
     }
 }
hw/ssi/xilinx_spi.c +1 -1
index fec8817d94..49ff275593 100644
@@ -142,7 +142,7 @@ static void xlx_spi_update_irq(XilinxSPI *s)
        irq chain unless things really changed.  */
     if (pending != s->irqline) {
         s->irqline = pending;
-        DB_PRINT("irq_change of state %d ISR:%x IER:%X\n",
+        DB_PRINT("irq_change of state %u ISR:%x IER:%X\n",
                     pending, s->regs[R_IPISR], s->regs[R_IPIER]);
         qemu_set_irq(s->irq, pending);
     }
Signature · 1 line
2.19.1
Reviewed-by on v1 1/1
#1 lore raw
Quoted 6 lines · AlexChen

We should use printf format specifier "%u" instead of "%d" for argument of type "unsigned int".

Alistair

Quoted 34 lines
---
 hw/ssi/imx_spi.c    | 2 +-
 hw/ssi/xilinx_spi.c | 2 +-
 2 files changed, 2 insertions(+), 2 deletions(-)
hw/ssi/imx_spi.c +1 -1
index 7f703d8328..d8885ae454 100644
@@ -53,7 +53,7 @@ static const char *imx_spi_reg_name(uint32_t reg)
     case ECSPI_MSGDATA:
         return  "ECSPI_MSGDATA";
     default:
-        sprintf(unknown, "%d ?", reg);
+        sprintf(unknown, "%u ?", reg);
         return unknown;
     }
 }
hw/ssi/xilinx_spi.c +1 -2
index fec8817d94..49ff275593 100644
@@ -142,7 +142,7 @@ static void xlx_spi_update_irq(XilinxSPI *s)
        irq chain unless things really changed.  */
     if (pending != s->irqline) {
         s->irqline = pending;
-        DB_PRINT("irq_change of state %d ISR:%x IER:%X\n",
+        DB_PRINT("irq_change of state %u ISR:%x IER:%X\n",
                     pending, s->regs[R_IPISR], s->regs[R_IPIER]);
         qemu_set_irq(s->irq, pending);
     }
--

2.19.1

#3 lore raw
In reply to AlexChen
Quoted 1 line
Quoted 1 line
Quoted 1 line
Quoted 1 line
Quoted 1 line

"AlexChen" == AlexChen <[email protected]> writes:

AlexChen> We should use printf format specifier "%u" instead of "%d" AlexChen> for argument of type "unsigned int".

AlexChen> Reported-by: Euler Robot <[email protected]> AlexChen>Signed-off-by: Alex Chen <[email protected]> ---

LGTM,
add

Signature · 2 lines
Peter Chubb            Tel: +61 2 9490 5852      http://ts.data61.csiro.au/
Trustworthy Systems Group                                    CSIRO's Data61