sandbox: Only call timer_timebase_fallback() if present
authorSimon Glass <sjg@chromium.org>
Mon, 15 Mar 2021 05:11:06 +0000 (18:11 +1300)
committerSimon Glass <sjg@chromium.org>
Sat, 27 Mar 2021 02:04:31 +0000 (15:04 +1300)
This function only exists if CPU is enabled. Update the code to take
account of this, so that it does not have to be enabled on all sandbox
builds.

Signed-off-by: Simon Glass <sjg@chromium.org>
Reviewed-by: Sean Anderson <seanga2@gmail.com>
drivers/timer/sandbox_timer.c

index 2075cd4..c846bfb 100644 (file)
@@ -38,7 +38,8 @@ static int sandbox_timer_probe(struct udevice *dev)
 {
        struct timer_dev_priv *uc_priv = dev_get_uclass_priv(dev);
 
-       if (dev_read_bool(dev, "sandbox,timebase-frequency-fallback"))
+       if (CONFIG_IS_ENABLED(CPU) &&
+           dev_read_bool(dev, "sandbox,timebase-frequency-fallback"))
                return timer_timebase_fallback(dev);
        else if (!uc_priv->clock_rate)
                uc_priv->clock_rate = SANDBOX_TIMER_RATE;