[PATCH RFC 07/20] timer-uclass: Tolerate failure to get clock rate in pre_probe

Lubomir Rintel lkundrak at v3.sk
Tue Nov 17 22:00:05 CET 2020


Pre-probe merely guesses that the first clock is the right one -- a
different one might actually be picked by probe(). In case it does not,
post_probe() already has a check that will fail.

Signed-off-by: Lubomir Rintel <lkundrak at v3.sk>
---
 drivers/timer/timer-uclass.c | 8 +++++---
 1 file changed, 5 insertions(+), 3 deletions(-)

diff --git a/drivers/timer/timer-uclass.c b/drivers/timer/timer-uclass.c
index 62d0e860e80..f734fa8b405 100644
--- a/drivers/timer/timer-uclass.c
+++ b/drivers/timer/timer-uclass.c
@@ -61,9 +61,11 @@ static int timer_pre_probe(struct udevice *dev)
 	if (!err) {
 		ret = clk_get_rate(&timer_clk);
 		if (IS_ERR_VALUE(ret))
-			return ret;
-		uc_priv->clock_rate = ret;
-	} else {
+			err = ret;
+		else
+			uc_priv->clock_rate = ret;
+	}
+	if (err) {
 		uc_priv->clock_rate =
 			dev_read_u32_default(dev, "clock-frequency", 0);
 	}
-- 
2.28.0



More information about the U-Boot mailing list