[PATCH] clk: sifive: check wrpll_configure_for_rate() return value

Heinrich Schuchardt heinrich.schuchardt at canonical.com
Fri Feb 16 18:06:01 CET 2024


wrpll_configure_for_rate() might fail. We should check the return value.

Fixes: d56d79ed27c6 ("drivers: clk: add fu740 support")
Signed-off-by: Heinrich Schuchardt <heinrich.schuchardt at canonical.com>
---
 drivers/clk/sifive/sifive-prci.c | 4 +++-
 1 file changed, 3 insertions(+), 1 deletion(-)

diff --git a/drivers/clk/sifive/sifive-prci.c b/drivers/clk/sifive/sifive-prci.c
index c8fb6002907..a950736f11b 100644
--- a/drivers/clk/sifive/sifive-prci.c
+++ b/drivers/clk/sifive/sifive-prci.c
@@ -209,7 +209,9 @@ unsigned long sifive_prci_wrpll_round_rate(struct __prci_clock *pc,
 
 	memcpy(&c, &pwd->c, sizeof(c));
 
-	wrpll_configure_for_rate(&c, rate, *parent_rate);
+	r = wrpll_configure_for_rate(&c, rate, *parent_rate);
+	if (r)
+		return r;
 
 	return wrpll_calc_output_rate(&c, *parent_rate);
 }
-- 
2.43.0



More information about the U-Boot mailing list