Commit 69916d96 authored by Ray Jui's avatar Ray Jui Committed by Stephen Boyd

clk: iproc: fix bit manipulation arithmetic

A 32-bit variable should be type casted to 64-bit before arithmetic
operation and assigning it to a 64-bit variable
Reported-by: default avatarDan Carpenter <dan.carpenter@oracle.com>
Signed-off-by: default avatarRay Jui <rjui@broadcom.com>
Fixes: 5fe225c1 ("clk: iproc: add initial common clock support")
Signed-off-by: default avatarStephen Boyd <sboyd@codeaurora.org>
parent 45a481c2
...@@ -366,7 +366,7 @@ static unsigned long iproc_pll_recalc_rate(struct clk_hw *hw, ...@@ -366,7 +366,7 @@ static unsigned long iproc_pll_recalc_rate(struct clk_hw *hw,
val = readl(pll->pll_base + ctrl->ndiv_int.offset); val = readl(pll->pll_base + ctrl->ndiv_int.offset);
ndiv_int = (val >> ctrl->ndiv_int.shift) & ndiv_int = (val >> ctrl->ndiv_int.shift) &
bit_mask(ctrl->ndiv_int.width); bit_mask(ctrl->ndiv_int.width);
ndiv = ndiv_int << ctrl->ndiv_int.shift; ndiv = (u64)ndiv_int << ctrl->ndiv_int.shift;
if (ctrl->flags & IPROC_CLK_PLL_HAS_NDIV_FRAC) { if (ctrl->flags & IPROC_CLK_PLL_HAS_NDIV_FRAC) {
val = readl(pll->pll_base + ctrl->ndiv_frac.offset); val = readl(pll->pll_base + ctrl->ndiv_frac.offset);
...@@ -374,7 +374,8 @@ static unsigned long iproc_pll_recalc_rate(struct clk_hw *hw, ...@@ -374,7 +374,8 @@ static unsigned long iproc_pll_recalc_rate(struct clk_hw *hw,
bit_mask(ctrl->ndiv_frac.width); bit_mask(ctrl->ndiv_frac.width);
if (ndiv_frac != 0) if (ndiv_frac != 0)
ndiv = (ndiv_int << ctrl->ndiv_int.shift) | ndiv_frac; ndiv = ((u64)ndiv_int << ctrl->ndiv_int.shift) |
ndiv_frac;
} }
val = readl(pll->pll_base + ctrl->pdiv.offset); val = readl(pll->pll_base + ctrl->pdiv.offset);
......
Markdown is supported
0%
or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment