[PATCH v2 15/16] clk: Detect failure to set defaults

Simon Glass sjg at chromium.org
Fri May 14 03:39:31 CEST 2021


When the default clocks cannot be set, the clock is silently probed and
the error is ignored. This is incorrect, since having the clocks at the
correct speed may be important for operation of the system.

Fix it by checking the return code.

Signed-off-by: Simon Glass <sjg at chromium.org>
---

(no changes since v1)

 drivers/clk/clk-uclass.c | 6 +++++-
 1 file changed, 5 insertions(+), 1 deletion(-)

diff --git a/drivers/clk/clk-uclass.c b/drivers/clk/clk-uclass.c
index 4ab3c402ed8..2a2e1cfbd61 100644
--- a/drivers/clk/clk-uclass.c
+++ b/drivers/clk/clk-uclass.c
@@ -796,13 +796,17 @@ void devm_clk_put(struct udevice *dev, struct clk *clk)
 
 int clk_uclass_post_probe(struct udevice *dev)
 {
+	int ret;
+
 	/*
 	 * when a clock provider is probed. Call clk_set_defaults()
 	 * also after the device is probed. This takes care of cases
 	 * where the DT is used to setup default parents and rates
 	 * using assigned-clocks
 	 */
-	clk_set_defaults(dev, 1);
+	ret = clk_set_defaults(dev, 1);
+	if (ret)
+		return log_ret(ret);
 
 	return 0;
 }
-- 
2.31.1.751.gd2f1c929bd-goog



More information about the U-Boot mailing list