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]>
---
 net/net_rand.h | 2 +-
 1 file changed, 1 insertion(+), 1 deletion(-)

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;
-- 
2.47.3

Reply via email to