diff mbox series

[01/19] clk: at91: clk-generated: continue if __clk_determine_rate() returns error

Message ID 1594812267-6697-2-git-send-email-claudiu.beznea@microchip.com (mailing list archive)
State New, archived
Headers show
Series clk: at91: add sama7g5 clock support | expand

Commit Message

Claudiu Beznea July 15, 2020, 11:24 a.m. UTC
__clk_determine_rate() may return error. Skip the current step
in case of error.

Fixes: 1a1a36d72e3d3 ("clk: at91: clk-generated: make gclk determine audio_pll rate")
Signed-off-by: Claudiu Beznea <claudiu.beznea@microchip.com>
---
 drivers/clk/at91/clk-generated.c | 3 ++-
 1 file changed, 2 insertions(+), 1 deletion(-)

Comments

Alexandre Belloni July 17, 2020, 9:09 a.m. UTC | #1
On 15/07/2020 14:24:09+0300, Claudiu Beznea wrote:
> __clk_determine_rate() may return error. Skip the current step
> in case of error.
> 
> Fixes: 1a1a36d72e3d3 ("clk: at91: clk-generated: make gclk determine audio_pll rate")
> Signed-off-by: Claudiu Beznea <claudiu.beznea@microchip.com>
Reviewed-by: Alexandre Belloni <alexandre.belloni@bootlin.com>

> ---
>  drivers/clk/at91/clk-generated.c | 3 ++-
>  1 file changed, 2 insertions(+), 1 deletion(-)
> 
> diff --git a/drivers/clk/at91/clk-generated.c b/drivers/clk/at91/clk-generated.c
> index 44a46dcc0518..995a13133cfb 100644
> --- a/drivers/clk/at91/clk-generated.c
> +++ b/drivers/clk/at91/clk-generated.c
> @@ -170,7 +170,8 @@ static int clk_generated_determine_rate(struct clk_hw *hw,
>  
>  	for (div = 1; div < GENERATED_MAX_DIV + 2; div++) {
>  		req_parent.rate = req->rate * div;
> -		__clk_determine_rate(parent, &req_parent);
> +		if (__clk_determine_rate(parent, &req_parent))
> +			continue;
>  		clk_generated_best_diff(req, parent, req_parent.rate, div,
>  					&best_diff, &best_rate);
>  
> -- 
> 2.7.4
>
diff mbox series

Patch

diff --git a/drivers/clk/at91/clk-generated.c b/drivers/clk/at91/clk-generated.c
index 44a46dcc0518..995a13133cfb 100644
--- a/drivers/clk/at91/clk-generated.c
+++ b/drivers/clk/at91/clk-generated.c
@@ -170,7 +170,8 @@  static int clk_generated_determine_rate(struct clk_hw *hw,
 
 	for (div = 1; div < GENERATED_MAX_DIV + 2; div++) {
 		req_parent.rate = req->rate * div;
-		__clk_determine_rate(parent, &req_parent);
+		if (__clk_determine_rate(parent, &req_parent))
+			continue;
 		clk_generated_best_diff(req, parent, req_parent.rate, div,
 					&best_diff, &best_rate);