All of lore.kernel.org
 help / color / mirror / Atom feed
* [PATCH 0/5] hw/misc: Fix some bad printf format specifiers
@ 2020-11-26 11:11 Alex Chen
  2020-11-26 11:11 ` [PATCH 1/5] i.MX25: Fix " Alex Chen
                   ` (5 more replies)
  0 siblings, 6 replies; 7+ messages in thread
From: Alex Chen @ 2020-11-26 11:11 UTC (permalink / raw)
  To: peter.maydell, jcd, peter.chubb
  Cc: alex.chen, qemu-trivial, qemu-arm, qemu-devel, zhang.zhanghailiang

Find a lot of bad printf format specifiers in hw/misc, fix them.

Alex Chen (5):
  i.MX25: Fix bad printf format specifiers
  i.MX31: Fix bad printf format specifiers
  i.MX6: Fix bad printf format specifiers
  i.MX6ul: Fix bad printf format specifiers
  misc/omap_sdrc: Fix bad printf format specifiers

 hw/misc/imx25_ccm.c  | 12 ++++++------
 hw/misc/imx31_ccm.c  | 14 +++++++-------
 hw/misc/imx6_ccm.c   | 20 ++++++++++----------
 hw/misc/imx6_src.c   |  2 +-
 hw/misc/imx6ul_ccm.c |  4 ++--
 hw/misc/imx_ccm.c    |  4 ++--
 hw/misc/omap_sdrc.c  |  2 +-
 7 files changed, 29 insertions(+), 29 deletions(-)

-- 
2.19.1



^ permalink raw reply	[flat|nested] 7+ messages in thread

* [PATCH 1/5] i.MX25: Fix bad printf format specifiers
  2020-11-26 11:11 [PATCH 0/5] hw/misc: Fix some bad printf format specifiers Alex Chen
@ 2020-11-26 11:11 ` Alex Chen
  2020-11-26 11:11 ` [PATCH 2/5] i.MX31: " Alex Chen
                   ` (4 subsequent siblings)
  5 siblings, 0 replies; 7+ messages in thread
From: Alex Chen @ 2020-11-26 11:11 UTC (permalink / raw)
  To: peter.maydell, jcd, peter.chubb
  Cc: alex.chen, qemu-trivial, qemu-arm, qemu-devel, zhang.zhanghailiang

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

Reported-by: Euler Robot <euler.robot@huawei.com>
Signed-off-by: Alex Chen <alex.chen@huawei.com>
---
 hw/misc/imx25_ccm.c | 12 ++++++------
 1 file changed, 6 insertions(+), 6 deletions(-)

diff --git a/hw/misc/imx25_ccm.c b/hw/misc/imx25_ccm.c
index d3107e5ca2..ff996e2f2c 100644
--- a/hw/misc/imx25_ccm.c
+++ b/hw/misc/imx25_ccm.c
@@ -91,7 +91,7 @@ static const char *imx25_ccm_reg_name(uint32_t reg)
     case IMX25_CCM_LPIMR1_REG:
         return "lpimr1";
     default:
-        sprintf(unknown, "[%d ?]", reg);
+        sprintf(unknown, "[%u ?]", reg);
         return unknown;
     }
 }
@@ -118,7 +118,7 @@ static uint32_t imx25_ccm_get_mpll_clk(IMXCCMState *dev)
         freq = imx_ccm_calc_pll(s->reg[IMX25_CCM_MPCTL_REG], CKIH_FREQ);
     }
 
-    DPRINTF("freq = %d\n", freq);
+    DPRINTF("freq = %u\n", freq);
 
     return freq;
 }
@@ -136,7 +136,7 @@ static uint32_t imx25_ccm_get_mcu_clk(IMXCCMState *dev)
 
     freq = freq / (1 + EXTRACT(s->reg[IMX25_CCM_CCTL_REG], ARM_CLK_DIV));
 
-    DPRINTF("freq = %d\n", freq);
+    DPRINTF("freq = %u\n", freq);
 
     return freq;
 }
@@ -149,7 +149,7 @@ static uint32_t imx25_ccm_get_ahb_clk(IMXCCMState *dev)
     freq = imx25_ccm_get_mcu_clk(dev)
            / (1 + EXTRACT(s->reg[IMX25_CCM_CCTL_REG], AHB_CLK_DIV));
 
-    DPRINTF("freq = %d\n", freq);
+    DPRINTF("freq = %u\n", freq);
 
     return freq;
 }
@@ -160,7 +160,7 @@ static uint32_t imx25_ccm_get_ipg_clk(IMXCCMState *dev)
 
     freq = imx25_ccm_get_ahb_clk(dev) / 2;
 
-    DPRINTF("freq = %d\n", freq);
+    DPRINTF("freq = %u\n", freq);
 
     return freq;
 }
@@ -186,7 +186,7 @@ static uint32_t imx25_ccm_get_clock_frequency(IMXCCMState *dev, IMXClk clock)
         break;
     }
 
-    DPRINTF("Clock = %d) = %d\n", clock, freq);
+    DPRINTF("Clock = %d) = %u\n", clock, freq);
 
     return freq;
 }
-- 
2.19.1



^ permalink raw reply related	[flat|nested] 7+ messages in thread

* [PATCH 2/5] i.MX31: Fix bad printf format specifiers
  2020-11-26 11:11 [PATCH 0/5] hw/misc: Fix some bad printf format specifiers Alex Chen
  2020-11-26 11:11 ` [PATCH 1/5] i.MX25: Fix " Alex Chen
@ 2020-11-26 11:11 ` Alex Chen
  2020-11-26 11:11 ` [PATCH 3/5] i.MX6: " Alex Chen
                   ` (3 subsequent siblings)
  5 siblings, 0 replies; 7+ messages in thread
From: Alex Chen @ 2020-11-26 11:11 UTC (permalink / raw)
  To: peter.maydell, jcd, peter.chubb
  Cc: alex.chen, qemu-trivial, qemu-arm, qemu-devel, zhang.zhanghailiang

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

Reported-by: Euler Robot <euler.robot@huawei.com>
Signed-off-by: Alex Chen <alex.chen@huawei.com>
---
 hw/misc/imx31_ccm.c | 14 +++++++-------
 hw/misc/imx_ccm.c   |  4 ++--
 2 files changed, 9 insertions(+), 9 deletions(-)

diff --git a/hw/misc/imx31_ccm.c b/hw/misc/imx31_ccm.c
index 6e246827ab..ad30a4b2c0 100644
--- a/hw/misc/imx31_ccm.c
+++ b/hw/misc/imx31_ccm.c
@@ -89,7 +89,7 @@ static const char *imx31_ccm_reg_name(uint32_t reg)
     case IMX31_CCM_PDR2_REG:
         return "PDR2";
     default:
-        sprintf(unknown, "[%d ?]", reg);
+        sprintf(unknown, "[%u ?]", reg);
         return unknown;
     }
 }
@@ -120,7 +120,7 @@ static uint32_t imx31_ccm_get_pll_ref_clk(IMXCCMState *dev)
         freq = CKIH_FREQ;
     }
 
-    DPRINTF("freq = %d\n", freq);
+    DPRINTF("freq = %u\n", freq);
 
     return freq;
 }
@@ -133,7 +133,7 @@ static uint32_t imx31_ccm_get_mpll_clk(IMXCCMState *dev)
     freq = imx_ccm_calc_pll(s->reg[IMX31_CCM_MPCTL_REG],
                             imx31_ccm_get_pll_ref_clk(dev));
 
-    DPRINTF("freq = %d\n", freq);
+    DPRINTF("freq = %u\n", freq);
 
     return freq;
 }
@@ -150,7 +150,7 @@ static uint32_t imx31_ccm_get_mcu_main_clk(IMXCCMState *dev)
         freq = imx31_ccm_get_mpll_clk(dev);
     }
 
-    DPRINTF("freq = %d\n", freq);
+    DPRINTF("freq = %u\n", freq);
 
     return freq;
 }
@@ -163,7 +163,7 @@ static uint32_t imx31_ccm_get_hclk_clk(IMXCCMState *dev)
     freq = imx31_ccm_get_mcu_main_clk(dev)
            / (1 + EXTRACT(s->reg[IMX31_CCM_PDR0_REG], MAX));
 
-    DPRINTF("freq = %d\n", freq);
+    DPRINTF("freq = %u\n", freq);
 
     return freq;
 }
@@ -176,7 +176,7 @@ static uint32_t imx31_ccm_get_ipg_clk(IMXCCMState *dev)
     freq = imx31_ccm_get_hclk_clk(dev)
            / (1 + EXTRACT(s->reg[IMX31_CCM_PDR0_REG], IPG));
 
-    DPRINTF("freq = %d\n", freq);
+    DPRINTF("freq = %u\n", freq);
 
     return freq;
 }
@@ -201,7 +201,7 @@ static uint32_t imx31_ccm_get_clock_frequency(IMXCCMState *dev, IMXClk clock)
         break;
     }
 
-    DPRINTF("Clock = %d) = %d\n", clock, freq);
+    DPRINTF("Clock = %d) = %u\n", clock, freq);
 
     return freq;
 }
diff --git a/hw/misc/imx_ccm.c b/hw/misc/imx_ccm.c
index 52882071d3..08a50ee4c8 100644
--- a/hw/misc/imx_ccm.c
+++ b/hw/misc/imx_ccm.c
@@ -38,7 +38,7 @@ uint32_t imx_ccm_get_clock_frequency(IMXCCMState *dev, IMXClk clock)
         freq = klass->get_clock_frequency(dev, clock);
     }
 
-    DPRINTF("(clock = %d) = %d\n", clock, freq);
+    DPRINTF("(clock = %d) = %u\n", clock, freq);
 
     return freq;
 }
@@ -65,7 +65,7 @@ uint32_t imx_ccm_calc_pll(uint32_t pllreg, uint32_t base_freq)
     freq = ((2 * (base_freq >> 10) * (mfi * mfd + mfn)) /
             (mfd * pd)) << 10;
 
-    DPRINTF("(pllreg = 0x%08x, base_freq = %d) = %d\n", pllreg, base_freq,
+    DPRINTF("(pllreg = 0x%08x, base_freq = %u) = %d\n", pllreg, base_freq,
             freq);
 
     return freq;
-- 
2.19.1



^ permalink raw reply related	[flat|nested] 7+ messages in thread

* [PATCH 3/5] i.MX6: Fix bad printf format specifiers
  2020-11-26 11:11 [PATCH 0/5] hw/misc: Fix some bad printf format specifiers Alex Chen
  2020-11-26 11:11 ` [PATCH 1/5] i.MX25: Fix " Alex Chen
  2020-11-26 11:11 ` [PATCH 2/5] i.MX31: " Alex Chen
@ 2020-11-26 11:11 ` Alex Chen
  2020-11-26 11:11 ` [PATCH 4/5] i.MX6ul: " Alex Chen
                   ` (2 subsequent siblings)
  5 siblings, 0 replies; 7+ messages in thread
From: Alex Chen @ 2020-11-26 11:11 UTC (permalink / raw)
  To: peter.maydell, jcd, peter.chubb
  Cc: alex.chen, qemu-trivial, qemu-arm, qemu-devel, zhang.zhanghailiang

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

Reported-by: Euler Robot <euler.robot@huawei.com>
Signed-off-by: Alex Chen <alex.chen@huawei.com>
---
 hw/misc/imx6_ccm.c | 20 ++++++++++----------
 hw/misc/imx6_src.c |  2 +-
 2 files changed, 11 insertions(+), 11 deletions(-)

diff --git a/hw/misc/imx6_ccm.c b/hw/misc/imx6_ccm.c
index 7fec8f0a47..cb740427ec 100644
--- a/hw/misc/imx6_ccm.c
+++ b/hw/misc/imx6_ccm.c
@@ -96,7 +96,7 @@ static const char *imx6_ccm_reg_name(uint32_t reg)
     case CCM_CMEOR:
         return "CMEOR";
     default:
-        sprintf(unknown, "%d ?", reg);
+        sprintf(unknown, "%u ?", reg);
         return unknown;
     }
 }
@@ -235,7 +235,7 @@ static const char *imx6_analog_reg_name(uint32_t reg)
     case USB_ANALOG_DIGPROG:
         return "USB_ANALOG_DIGPROG";
     default:
-        sprintf(unknown, "%d ?", reg);
+        sprintf(unknown, "%u ?", reg);
         return unknown;
     }
 }
@@ -263,7 +263,7 @@ static uint64_t imx6_analog_get_pll2_clk(IMX6CCMState *dev)
         freq *= 20;
     }
 
-    DPRINTF("freq = %d\n", (uint32_t)freq);
+    DPRINTF("freq = %u\n", (uint32_t)freq);
 
     return freq;
 }
@@ -275,7 +275,7 @@ static uint64_t imx6_analog_get_pll2_pfd0_clk(IMX6CCMState *dev)
     freq = imx6_analog_get_pll2_clk(dev) * 18
            / EXTRACT(dev->analog[CCM_ANALOG_PFD_528], PFD0_FRAC);
 
-    DPRINTF("freq = %d\n", (uint32_t)freq);
+    DPRINTF("freq = %u\n", (uint32_t)freq);
 
     return freq;
 }
@@ -287,7 +287,7 @@ static uint64_t imx6_analog_get_pll2_pfd2_clk(IMX6CCMState *dev)
     freq = imx6_analog_get_pll2_clk(dev) * 18
            / EXTRACT(dev->analog[CCM_ANALOG_PFD_528], PFD2_FRAC);
 
-    DPRINTF("freq = %d\n", (uint32_t)freq);
+    DPRINTF("freq = %u\n", (uint32_t)freq);
 
     return freq;
 }
@@ -315,7 +315,7 @@ static uint64_t imx6_analog_get_periph_clk(IMX6CCMState *dev)
         break;
     }
 
-    DPRINTF("freq = %d\n", (uint32_t)freq);
+    DPRINTF("freq = %u\n", (uint32_t)freq);
 
     return freq;
 }
@@ -327,7 +327,7 @@ static uint64_t imx6_ccm_get_ahb_clk(IMX6CCMState *dev)
     freq = imx6_analog_get_periph_clk(dev)
            / (1 + EXTRACT(dev->ccm[CCM_CBCDR], AHB_PODF));
 
-    DPRINTF("freq = %d\n", (uint32_t)freq);
+    DPRINTF("freq = %u\n", (uint32_t)freq);
 
     return freq;
 }
@@ -339,7 +339,7 @@ static uint64_t imx6_ccm_get_ipg_clk(IMX6CCMState *dev)
     freq = imx6_ccm_get_ahb_clk(dev)
            / (1 + EXTRACT(dev->ccm[CCM_CBCDR], IPG_PODF));
 
-    DPRINTF("freq = %d\n", (uint32_t)freq);
+    DPRINTF("freq = %u\n", (uint32_t)freq);
 
     return freq;
 }
@@ -351,7 +351,7 @@ static uint64_t imx6_ccm_get_per_clk(IMX6CCMState *dev)
     freq = imx6_ccm_get_ipg_clk(dev)
            / (1 + EXTRACT(dev->ccm[CCM_CSCMR1], PERCLK_PODF));
 
-    DPRINTF("freq = %d\n", (uint32_t)freq);
+    DPRINTF("freq = %u\n", (uint32_t)freq);
 
     return freq;
 }
@@ -385,7 +385,7 @@ static uint32_t imx6_ccm_get_clock_frequency(IMXCCMState *dev, IMXClk clock)
         break;
     }
 
-    DPRINTF("Clock = %d) = %d\n", clock, freq);
+    DPRINTF("Clock = %d) = %u\n", clock, freq);
 
     return freq;
 }
diff --git a/hw/misc/imx6_src.c b/hw/misc/imx6_src.c
index dd99cc7acf..79f4375911 100644
--- a/hw/misc/imx6_src.c
+++ b/hw/misc/imx6_src.c
@@ -68,7 +68,7 @@ static const char *imx6_src_reg_name(uint32_t reg)
     case SRC_GPR10:
         return "SRC_GPR10";
     default:
-        sprintf(unknown, "%d ?", reg);
+        sprintf(unknown, "%u ?", reg);
         return unknown;
     }
 }
-- 
2.19.1



^ permalink raw reply related	[flat|nested] 7+ messages in thread

* [PATCH 4/5] i.MX6ul: Fix bad printf format specifiers
  2020-11-26 11:11 [PATCH 0/5] hw/misc: Fix some bad printf format specifiers Alex Chen
                   ` (2 preceding siblings ...)
  2020-11-26 11:11 ` [PATCH 3/5] i.MX6: " Alex Chen
@ 2020-11-26 11:11 ` Alex Chen
  2020-11-26 11:11 ` [PATCH 5/5] misc/omap_sdrc: " Alex Chen
  2020-11-30 13:40 ` [PATCH 0/5] hw/misc: Fix some " Peter Maydell
  5 siblings, 0 replies; 7+ messages in thread
From: Alex Chen @ 2020-11-26 11:11 UTC (permalink / raw)
  To: peter.maydell, jcd, peter.chubb
  Cc: alex.chen, qemu-trivial, qemu-arm, qemu-devel, zhang.zhanghailiang

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

Reported-by: Euler Robot <euler.robot@huawei.com>
Signed-off-by: Alex Chen <alex.chen@huawei.com>
---
 hw/misc/imx6ul_ccm.c | 4 ++--
 1 file changed, 2 insertions(+), 2 deletions(-)

diff --git a/hw/misc/imx6ul_ccm.c b/hw/misc/imx6ul_ccm.c
index 5e0661dacf..a65d031455 100644
--- a/hw/misc/imx6ul_ccm.c
+++ b/hw/misc/imx6ul_ccm.c
@@ -143,7 +143,7 @@ static const char *imx6ul_ccm_reg_name(uint32_t reg)
     case CCM_CMEOR:
         return "CMEOR";
     default:
-        sprintf(unknown, "%d ?", reg);
+        sprintf(unknown, "%u ?", reg);
         return unknown;
     }
 }
@@ -274,7 +274,7 @@ static const char *imx6ul_analog_reg_name(uint32_t reg)
     case USB_ANALOG_DIGPROG:
         return "USB_ANALOG_DIGPROG";
     default:
-        sprintf(unknown, "%d ?", reg);
+        sprintf(unknown, "%u ?", reg);
         return unknown;
     }
 }
-- 
2.19.1



^ permalink raw reply related	[flat|nested] 7+ messages in thread

* [PATCH 5/5] misc/omap_sdrc: Fix bad printf format specifiers
  2020-11-26 11:11 [PATCH 0/5] hw/misc: Fix some bad printf format specifiers Alex Chen
                   ` (3 preceding siblings ...)
  2020-11-26 11:11 ` [PATCH 4/5] i.MX6ul: " Alex Chen
@ 2020-11-26 11:11 ` Alex Chen
  2020-11-30 13:40 ` [PATCH 0/5] hw/misc: Fix some " Peter Maydell
  5 siblings, 0 replies; 7+ messages in thread
From: Alex Chen @ 2020-11-26 11:11 UTC (permalink / raw)
  To: peter.maydell, jcd, peter.chubb
  Cc: alex.chen, qemu-trivial, qemu-arm, qemu-devel, zhang.zhanghailiang

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

Reported-by: Euler Robot <euler.robot@huawei.com>
Signed-off-by: Alex Chen <alex.chen@huawei.com>
---
 hw/misc/omap_sdrc.c | 2 +-
 1 file changed, 1 insertion(+), 1 deletion(-)

diff --git a/hw/misc/omap_sdrc.c b/hw/misc/omap_sdrc.c
index f2f72f6810..c142fe0882 100644
--- a/hw/misc/omap_sdrc.c
+++ b/hw/misc/omap_sdrc.c
@@ -107,7 +107,7 @@ static void omap_sdrc_write(void *opaque, hwaddr addr,
 
     case 0x10:	/* SDRC_SYSCONFIG */
         if ((value >> 3) != 0x2)
-            fprintf(stderr, "%s: bad SDRAM idle mode %i\n",
+            fprintf(stderr, "%s: bad SDRAM idle mode %u\n",
                     __func__, (unsigned)value >> 3);
         if (value & 2)
             omap_sdrc_reset(s);
-- 
2.19.1



^ permalink raw reply related	[flat|nested] 7+ messages in thread

* Re: [PATCH 0/5] hw/misc: Fix some bad printf format specifiers
  2020-11-26 11:11 [PATCH 0/5] hw/misc: Fix some bad printf format specifiers Alex Chen
                   ` (4 preceding siblings ...)
  2020-11-26 11:11 ` [PATCH 5/5] misc/omap_sdrc: " Alex Chen
@ 2020-11-30 13:40 ` Peter Maydell
  5 siblings, 0 replies; 7+ messages in thread
From: Peter Maydell @ 2020-11-30 13:40 UTC (permalink / raw)
  To: Alex Chen
  Cc: zhanghailiang, QEMU Trivial, QEMU Developers,
	Jean-Christophe DUBOIS, qemu-arm, Peter Chubb

On Thu, 26 Nov 2020 at 11:23, Alex Chen <alex.chen@huawei.com> wrote:
>
> Find a lot of bad printf format specifiers in hw/misc, fix them.
>
> Alex Chen (5):
>   i.MX25: Fix bad printf format specifiers
>   i.MX31: Fix bad printf format specifiers
>   i.MX6: Fix bad printf format specifiers
>   i.MX6ul: Fix bad printf format specifiers
>   misc/omap_sdrc: Fix bad printf format specifiers



Applied to target-arm.next for 6.0, thanks.

-- PMM


^ permalink raw reply	[flat|nested] 7+ messages in thread

end of thread, other threads:[~2020-11-30 13:46 UTC | newest]

Thread overview: 7+ messages (download: mbox.gz / follow: Atom feed)
-- links below jump to the message on this page --
2020-11-26 11:11 [PATCH 0/5] hw/misc: Fix some bad printf format specifiers Alex Chen
2020-11-26 11:11 ` [PATCH 1/5] i.MX25: Fix " Alex Chen
2020-11-26 11:11 ` [PATCH 2/5] i.MX31: " Alex Chen
2020-11-26 11:11 ` [PATCH 3/5] i.MX6: " Alex Chen
2020-11-26 11:11 ` [PATCH 4/5] i.MX6ul: " Alex Chen
2020-11-26 11:11 ` [PATCH 5/5] misc/omap_sdrc: " Alex Chen
2020-11-30 13:40 ` [PATCH 0/5] hw/misc: Fix some " Peter Maydell

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.