Skip to content

Commit 83331bf

Browse files
claudiubezneabebarino
authored andcommitted
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 <[email protected]> Reviewed-by: Alexandre Belloni <[email protected]> Link: https://lore.kernel.org/r/[email protected] Signed-off-by: Stephen Boyd <[email protected]>
1 parent 3a5c42b commit 83331bf

File tree

1 file changed

+2
-2
lines changed

1 file changed

+2
-2
lines changed

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)