Skip to content

Commit 02d7bd1

Browse files
Kevin Groeneveldbebarino
authored andcommitted
clk: imx: pll14xx: fix recalc_rate for negative kdiv
kdiv is a signed 16 bit value in the DEV_CTL1 register. Commit 53990cf ("clk: imx: pll14xx: consolidate rate calculation") changed the kdiv variable from a short int to just int. When the value read from the DIV_CTL1 register is assigned directly to an int the sign of the value is lost resulting in incorrect results when the value is negative. Adding a s16 cast to the register value fixes the issue. Fixes: 53990cf ("clk: imx: pll14xx: consolidate rate calculation") Signed-off-by: Kevin Groeneveld <[email protected]> Link: https://lore.kernel.org/r/[email protected] Reviewed-by: Abel Vesa <[email protected]> Signed-off-by: Stephen Boyd <[email protected]>
1 parent e45dbb8 commit 02d7bd1

File tree

1 file changed

+1
-1
lines changed

1 file changed

+1
-1
lines changed

drivers/clk/imx/clk-pll14xx.c

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -256,7 +256,7 @@ static unsigned long clk_pll14xx_recalc_rate(struct clk_hw *hw,
256256

257257
if (pll->type == PLL_1443X) {
258258
pll_div_ctl1 = readl_relaxed(pll->base + DIV_CTL1);
259-
kdiv = FIELD_GET(KDIV_MASK, pll_div_ctl1);
259+
kdiv = (s16)FIELD_GET(KDIV_MASK, pll_div_ctl1);
260260
} else {
261261
kdiv = 0;
262262
}

0 commit comments

Comments
 (0)