eth_start_udev can fail but errno could still be zero which causes the
function ignores the error silently. This fix catches the error
properly.

Signed-off-by: Yuxiao Zhang <[email protected]>
---

 net/eth-uclass.c | 4 +++-
 1 file changed, 3 insertions(+), 1 deletion(-)

diff --git a/net/eth-uclass.c b/net/eth-uclass.c
index 5c437143a30..07ec59b97f0 100644
--- a/net/eth-uclass.c
+++ b/net/eth-uclass.c
@@ -289,8 +289,10 @@ int eth_start_udev(struct udevice *dev)
        if (priv->running)
                return 0;
 
-       if (!device_active(dev))
+       if (!device_active(dev)) {
+               eth_errno = -EINVAL;
                return -EINVAL;
+       }
 
        ret = eth_get_ops(dev)->start(dev);
        if (ret < 0)
---
base-commit: 3f19667468fb93bcb5702d23aa057b72639e3ac8
branch: main

-- 
2.55.0.966.g6673acef38-goog

Reply via email to