summaryrefslogtreecommitdiffstats
path: root/drivers/clk
diff options
context:
space:
mode:
authorClaudiu Beznea <claudiu.beznea@microchip.com>2020-07-22 10:38:10 +0300
committerStephen Boyd <sboyd@kernel.org>2020-07-24 02:18:47 -0700
commit83331bfcc021a24da79f38a2452e86182c7ae94b (patch)
tree8746cdae7c25de2ff33c5da2f3dea3728f313545 /drivers/clk
parent3a5c42b18a6ddc0de77dde017baf45262fbf1ced (diff)
downloadlinux-83331bfcc021a24da79f38a2452e86182c7ae94b.tar.bz2
clk: at91: clk-generated: check best_rate against ranges
Check best_rate against available clock ranges. Fixes: df70aeef6083 ("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>
Diffstat (limited to 'drivers/clk')
-rw-r--r--drivers/clk/at91/clk-generated.c4
1 files changed, 2 insertions, 2 deletions
diff --git a/drivers/clk/at91/clk-generated.c b/drivers/clk/at91/clk-generated.c
index 995a13133cfb..f8e557e0e1b8 100644
--- a/drivers/clk/at91/clk-generated.c
+++ b/drivers/clk/at91/clk-generated.c
@@ -185,8 +185,8 @@ end:
__clk_get_name((req->best_parent_hw)->clk),
req->best_parent_rate);
- if (best_rate < 0)
- return best_rate;
+ if (best_rate < 0 || (gck->range.max && best_rate > gck->range.max))
+ return -EINVAL;
req->rate = best_rate;
return 0;