Skip to content

Commit

Permalink
i.MX31: Fix bad printf format specifiers
Browse files Browse the repository at this point in the history
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>
Message-id: 20201126111109.112238-3-alex.chen@huawei.com
Reviewed-by: Peter Maydell <peter.maydell@linaro.org>
Signed-off-by: Peter Maydell <peter.maydell@linaro.org>
  • Loading branch information
Alex Chen authored and pm215 committed Dec 10, 2020
1 parent 26c6909 commit a88ae03
Show file tree
Hide file tree
Showing 2 changed files with 9 additions and 9 deletions.
14 changes: 7 additions & 7 deletions hw/misc/imx31_ccm.c
Expand Up @@ -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;
}
}
Expand Down Expand Up @@ -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;
}
Expand All @@ -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;
}
Expand All @@ -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;
}
Expand All @@ -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;
}
Expand All @@ -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;
}
Expand All @@ -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;
}
Expand Down
4 changes: 2 additions & 2 deletions hw/misc/imx_ccm.c
Expand Up @@ -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;
}
Expand All @@ -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;
Expand Down

0 comments on commit a88ae03

Please sign in to comment.