dm: core: Call clk_set_defaults() during probe() only for a valid ofnode
authorBin Meng <bmeng.cn@gmail.com>
Fri, 5 Jul 2019 16:23:16 +0000 (09:23 -0700)
committerSimon Glass <sjg@chromium.org>
Wed, 24 Jul 2019 19:54:08 +0000 (12:54 -0700)
Without a valid ofnode, it's meaningless to call clk_set_defaults()
to process various properties.

Signed-off-by: Bin Meng <bmeng.cn@gmail.com>
Reviewed-by: Simon Glass <sjg@chromium.org>
drivers/core/device.c

index 0d15e5062b66123cd364bd9803e076db7e7dd97c..37d89bcd1d21dce8bf3755a653d4121a746db7ae 100644 (file)
@@ -409,10 +409,16 @@ int device_probe(struct udevice *dev)
                        goto fail;
        }
 
-       /* Process 'assigned-{clocks/clock-parents/clock-rates}' properties */
-       ret = clk_set_defaults(dev);
-       if (ret)
-               goto fail;
+       /* Only handle devices that have a valid ofnode */
+       if (dev_of_valid(dev)) {
+               /*
+                * Process 'assigned-{clocks/clock-parents/clock-rates}'
+                * properties
+                */
+               ret = clk_set_defaults(dev);
+               if (ret)
+                       goto fail;
+       }
 
        if (drv->probe) {
                ret = drv->probe(dev);