dm: timer: Skip device that does not have a valid ofnode in pre_probe()
authorBin Meng <bmeng.cn@gmail.com>
Fri, 5 Jul 2019 16:23:15 +0000 (09:23 -0700)
committerSimon Glass <sjg@chromium.org>
Wed, 24 Jul 2019 19:54:08 +0000 (12:54 -0700)
It is possible that a timer device has a null ofnode, hence there is
no need to further parse DT for the clock rate.

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

index 12ee6eb80434130eeeada1a9739e027b8d3580f1..97a4c7485189bbb5877681268f70ea8b6cadadcb 100644 (file)
@@ -48,6 +48,10 @@ static int timer_pre_probe(struct udevice *dev)
        int err;
        ulong ret;
 
+       /* It is possible that a timer device has a null ofnode */
+       if (!dev_of_valid(dev))
+               return 0;
+
        err = clk_get_by_index(dev, 0, &timer_clk);
        if (!err) {
                ret = clk_get_rate(&timer_clk);