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 <gsmecher@t0.technology> Reviewed-by: Simon Glass <sjg@chromium.org>
This commit is contained in:
committed by
Jerome Forissier
parent
5eb45fb291
commit
b752e44179
+1
-1
@@ -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;
|
||||
|
||||
Reference in New Issue
Block a user