[PATCH] net: srand_mac(): fix -ENODEV crash with CONFIG_DM_RNG

Graeme Smecher <[email protected]>
Newsgroups gmane.comp.boot-loaders.u-boot.general,gmane.comp.boot-loaders.u-boot
Message-ID <[email protected]>
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
lmpx.com only provides a reader for public news (NNTP) servers. It is not affiliated with the servers or forums shown here and is not responsible for the content of articles, which is written by their respective authors.