summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorGraeme Smecher <[email protected]>2026-08-06 13:43:42 -0700
committerJerome Forissier <[email protected]>2026-08-12 17:02:50 +0200
commitb752e4417900ae51d4d8fda879a5594db7025698 (patch)
tree4f258572d65a0782a9f059727b2c50a4e07d9470
parent5eb45fb2917c7d46282cd6dd6e05d41b84f67105 (diff)
net: srand_mac(): fix -ENODEV crash with CONFIG_DM_RNG
The uclass_get_device() return-value check was inverted, resulting in a synchronous abort when -ENODEV was returned. Signed-off-by: Graeme Smecher <[email protected]> Reviewed-by: Simon Glass <[email protected]>
-rw-r--r--net/net_rand.h2
1 files changed, 1 insertions, 1 deletions
diff --git a/net/net_rand.h b/net/net_rand.h
index e21dff8569b..18ff7b68056 100644
--- a/net/net_rand.h
+++ b/net/net_rand.h
@@ -44,7 +44,7 @@ static inline void srand_mac(void)
if (CONFIG_IS_ENABLED(DM_RNG)) {
ret = uclass_get_device(UCLASS_RNG, 0, &devp);
- if (ret) {
+ if (!ret) {
ret = dm_rng_read(devp, &randv, sizeof(randv));
if (ret < 0)
randv = 0;