summaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
authorNicolas Pitre <nicolas.pitre@linaro.org>2015-11-03 20:01:40 -0500
committerNicolas Pitre <nicolas.pitre@linaro.org>2015-11-16 12:37:54 -0500
commit4471f9a4db2d8dfdc79618502fafb1172ab40f05 (patch)
tree17ba196307180ea24f1a7097a978364c8b2d6fb5
parent6a0078c8520697ab3e32180ede2df35e7630d94b (diff)
downloadop-kernel-dev-4471f9a4db2d8dfdc79618502fafb1172ab40f05.zip
op-kernel-dev-4471f9a4db2d8dfdc79618502fafb1172ab40f05.tar.gz
imx/clk-pllv2: fix wrong do_div() usage
do_div() is meant to be used with an unsigned dividend. Signed-off-by: Nicolas Pitre <nico@linaro.org>
-rw-r--r--drivers/clk/imx/clk-pllv2.c9
1 files changed, 5 insertions, 4 deletions
diff --git a/drivers/clk/imx/clk-pllv2.c b/drivers/clk/imx/clk-pllv2.c
index b18f875..4aeda56 100644
--- a/drivers/clk/imx/clk-pllv2.c
+++ b/drivers/clk/imx/clk-pllv2.c
@@ -79,7 +79,7 @@ static unsigned long __clk_pllv2_recalc_rate(unsigned long parent_rate,
{
long mfi, mfn, mfd, pdf, ref_clk;
unsigned long dbl;
- s64 temp;
+ u64 temp;
dbl = dp_ctl & MXC_PLL_DP_CTL_DPDCK0_2_EN;
@@ -98,8 +98,9 @@ static unsigned long __clk_pllv2_recalc_rate(unsigned long parent_rate,
temp = (u64) ref_clk * abs(mfn);
do_div(temp, mfd + 1);
if (mfn < 0)
- temp = -temp;
- temp = (ref_clk * mfi) + temp;
+ temp = (ref_clk * mfi) - temp;
+ else
+ temp = (ref_clk * mfi) + temp;
return temp;
}
@@ -126,7 +127,7 @@ static int __clk_pllv2_set_rate(unsigned long rate, unsigned long parent_rate,
{
u32 reg;
long mfi, pdf, mfn, mfd = 999999;
- s64 temp64;
+ u64 temp64;
unsigned long quad_parent_rate;
quad_parent_rate = 4 * parent_rate;
OpenPOWER on IntegriCloud