lib: utils/timer: Skip initialize timer when dt is not enabled
authorXiang W <wxjstz@126.com>
Tue, 11 Jun 2024 11:19:29 +0000 (19:19 +0800)
committerAnup Patel <anup@brainfault.org>
Thu, 13 Jun 2024 13:01:40 +0000 (18:31 +0530)
When the dt node has a status property and the value is not ok or
okay, skip initializing timer.

Signed-off-by: Xiang W <wxjstz@126.com>
Reviewed-by: Anup Patel <anup@brainfault.org>
lib/utils/timer/fdt_timer.c

index 62426a70fb0ab0fc1a2a9056494e4dff01debc1d..f4687304d65cf8594b94e4d8b51ffd4107c1c8f3 100644 (file)
@@ -44,6 +44,9 @@ static int fdt_timer_cold_init(void)
                noff = -1;
                while ((noff = fdt_find_match(fdt, noff,
                                        drv->match_table, &match)) >= 0) {
+                       if (!fdt_node_is_enabled(fdt, noff))
+                               continue;
+
                        /* drv->cold_init must not be NULL */
                        if (drv->cold_init == NULL)
                                return SBI_EFAIL;