]> Git Repo - linux.git/commitdiff
clk: at91: clk-generated: Limit the requested rate to our range
authorCodrin Ciubotariu <[email protected]>
Wed, 7 Jul 2021 13:12:13 +0000 (16:12 +0300)
committerStephen Boyd <[email protected]>
Sun, 29 Aug 2021 05:28:24 +0000 (22:28 -0700)
On clk_generated_determine_rate(), the requested rate could be outside
of clk's range. Limit the rate to the clock's range to not return an
error.

Fixes: df70aeef6083 ("clk: at91: add generated clock driver")
Signed-off-by: Codrin Ciubotariu <[email protected]>
Link: https://lore.kernel.org/r/[email protected]
Acked-by: Nicolas Ferre <[email protected]>
Signed-off-by: Stephen Boyd <[email protected]>
drivers/clk/at91/clk-generated.c

index b4fc8d71daf20fefeec201ac380984b99afa2d44..b656d25a97678335124babe97eb05b802fdad8cb 100644 (file)
@@ -128,6 +128,12 @@ static int clk_generated_determine_rate(struct clk_hw *hw,
        int i;
        u32 div;
 
+       /* do not look for a rate that is outside of our range */
+       if (gck->range.max && req->rate > gck->range.max)
+               req->rate = gck->range.max;
+       if (gck->range.min && req->rate < gck->range.min)
+               req->rate = gck->range.min;
+
        for (i = 0; i < clk_hw_get_num_parents(hw); i++) {
                if (gck->chg_pid == i)
                        continue;
This page took 0.056225 seconds and 4 git commands to generate.