clk: Detect failure to set defaults
authorSimon Glass <sjg@chromium.org>
Fri, 14 May 2021 01:39:31 +0000 (19:39 -0600)
committerTom Rini <trini@konsulko.com>
Thu, 15 Jul 2021 22:42:40 +0000 (18:42 -0400)
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@chromium.org>
drivers/clk/clk-uclass.c

index f049e36..cea38a4 100644 (file)
@@ -847,13 +847,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, CLK_DEFAULTS_POST);
+       ret = clk_set_defaults(dev, CLK_DEFAULTS_POST);
+       if (ret)
+               return log_ret(ret);
 
        return 0;
 }