[PATCH] clocksource: omit seeding of RNG in PBL

Ahmad Fatoum a.fatoum at pengutronix.de
Thu Apr 24 01:48:33 PDT 2025


We do not maintain a PRNG in the PBL, so we should omit the call to
srand_xor in PBL, otherwise it expands to BUG() and breaks the newly
introduced PBL clocksource support.

Signed-off-by: Ahmad Fatoum <a.fatoum at pengutronix.de>
---
 common/clock.c | 3 ++-
 1 file changed, 2 insertions(+), 1 deletion(-)

diff --git a/common/clock.c b/common/clock.c
index 517116e3b9a3..50941fb00822 100644
--- a/common/clock.c
+++ b/common/clock.c
@@ -228,7 +228,8 @@ int init_clock(struct clocksource *cs)
 	cs->cycle_last = cs->read() & cs->mask;
 	current_clock = cs;
 
-	srand_xor(cs->cycle_last);
+	if (IN_PROPER)
+		srand_xor(cs->cycle_last);
 
 	return 0;
 }
-- 
2.39.5




More information about the barebox mailing list