hw/misc: Fix some bad printf format specifiers
cover hw/misc: Fix some bad printf format specifiers
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(-)
Signature · 1 line
2.19.1
PATCH 1/5 i.MX25: Fix bad printf format specifiers
We should use printf format specifier "%u" instead of "%d" for argument of type "unsigned int".
--- hw/misc/imx25_ccm.c | 12 ++++++------ 1 file changed, 6 insertions(+), 6 deletions(-)
hw/misc/imx25_ccm.c +6 -6
@@ -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; }
Signature · 1 line
2.19.1
PATCH 2/5 i.MX31: Fix bad printf format specifiers
In reply to Alex ChenWe should use printf format specifier "%u" instead of "%d" for argument of type "unsigned int".
--- hw/misc/imx31_ccm.c | 14 +++++++------- hw/misc/imx_ccm.c | 4 ++-- 2 files changed, 9 insertions(+), 9 deletions(-)
hw/misc/imx31_ccm.c +7 -7
@@ -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; }
hw/misc/imx_ccm.c +2 -2
@@ -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;
Signature · 1 line
2.19.1
PATCH 3/5 i.MX6: Fix bad printf format specifiers
In reply to Alex ChenWe should use printf format specifier "%u" instead of "%d" for argument of type "unsigned int".
--- hw/misc/imx6_ccm.c | 20 ++++++++++---------- hw/misc/imx6_src.c | 2 +- 2 files changed, 11 insertions(+), 11 deletions(-)
hw/misc/imx6_ccm.c +10 -10
@@ -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; }
hw/misc/imx6_src.c +1 -1
@@ -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; } }
Signature · 1 line
2.19.1
PATCH 4/5 i.MX6ul: Fix bad printf format specifiers
In reply to Alex ChenWe should use printf format specifier "%u" instead of "%d" for argument of type "unsigned int".
--- hw/misc/imx6ul_ccm.c | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-)
hw/misc/imx6ul_ccm.c +2 -2
@@ -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; } }
Signature · 1 line
2.19.1
PATCH 5/5 misc/omap_sdrc: Fix bad printf format specifiers
In reply to Alex ChenWe should use printf format specifier "%u" instead of "%d" for argument of type "unsigned int".
--- hw/misc/omap_sdrc.c | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-)
hw/misc/omap_sdrc.c +1 -1
@@ -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);
Signature · 1 line
2.19.1
Peter Maydell
AppliedQuoted 9 lines · Alex Chen
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