diff options
| author | Rajan Vaja <[email protected]> | 2020-03-02 13:50:40 -0800 |
|---|---|---|
| committer | Stephen Boyd <[email protected]> | 2020-05-26 17:58:59 -0700 |
| commit | 0541e0217ac8daef32650ba8477ff0a55f9a94b1 (patch) | |
| tree | 2f50ff428f7bc508537e75d1ca0bb446f0f1f9fb | |
| parent | 8f3d9f354286745c751374f5f1fcafee6b3f3136 (diff) | |
clk: zynqmp: Limit bestdiv with maxdiv
Clock divider value should not be greater than maximum divider value.
So use minimum of best divider or maximum divider value.
Signed-off-by: Rajan Vaja <[email protected]>
Signed-off-by: Jolly Shah <[email protected]>
Link: https://lkml.kernel.org/r/[email protected]
Signed-off-by: Stephen Boyd <[email protected]>
| -rw-r--r-- | drivers/clk/zynqmp/divider.c | 2 |
1 files changed, 2 insertions, 0 deletions
diff --git a/drivers/clk/zynqmp/divider.c b/drivers/clk/zynqmp/divider.c index 4be2cc76aa2e..5c41ddbee646 100644 --- a/drivers/clk/zynqmp/divider.c +++ b/drivers/clk/zynqmp/divider.c @@ -197,6 +197,8 @@ static long zynqmp_clk_divider_round_rate(struct clk_hw *hw, if ((clk_hw_get_flags(hw) & CLK_SET_RATE_PARENT) && divider->is_frac) bestdiv = rate % *prate ? 1 : bestdiv; + + bestdiv = min_t(u32, bestdiv, divider->max_div); *prate = rate * bestdiv; return rate; |