Skip to content

Commit 639b31d

Browse files
committed
clk: at91: clk-generated: check best_rate against ranges
Check best_rate against available clock ranges. Fixes: df70aee ("clk: at91: add generated clock driver") Signed-off-by: Claudiu Beznea <claudiu.beznea@microchip.com> Reviewed-by: Alexandre Belloni <alexandre.belloni@bootlin.com> Link: https://lore.kernel.org/r/1595403506-8209-3-git-send-email-claudiu.beznea@microchip.com Signed-off-by: Stephen Boyd <sboyd@kernel.org>
1 parent 7305399 commit 639b31d

1 file changed

Lines changed: 2 additions & 2 deletions

File tree

drivers/clk/at91/clk-generated.c

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -185,8 +185,8 @@ static int clk_generated_determine_rate(struct clk_hw *hw,
185185
__clk_get_name((req->best_parent_hw)->clk),
186186
req->best_parent_rate);
187187

188-
if (best_rate < 0)
189-
return best_rate;
188+
if (best_rate < 0 || (gck->range.max && best_rate > gck->range.max))
189+
return -EINVAL;
190190

191191
req->rate = best_rate;
192192
return 0;

0 commit comments

Comments
 (0)