diff mbox series

u-boot: fix error check in eth init

Message ID 20260901175210.482943-1-yuxiaozhang@google.com
State New
Delegated to: Jerome Forissier
Headers show
Series u-boot: fix error check in eth init | expand

Commit Message

Yuxiao Zhang Sept. 1, 2026, 5:51 p.m. UTC
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 <yuxiaozhang@google.com>
---

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

---
base-commit: 3f19667468fb93bcb5702d23aa057b72639e3ac8
branch: main

Comments

Tom Rini Sept. 5, 2026, 2:28 p.m. UTC | #1
On Tue, Sep 01, 2026 at 10:51:42AM -0700, Yuxiao Zhang wrote:

> 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 <yuxiaozhang@google.com>

Thanks.

Reviewed-by: Tom Rini <trini@konsulko.com>
diff mbox series

Patch

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)