[PATCH] u-boot: fix error check in eth init
Yuxiao Zhang <[email protected]>
| Newsgroups | org.u-boot-project.lists.u-boot |
|---|---|
| Message-ID | <[email protected]> |
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 | 11 ++++++----- 1 file changed, 6 insertions(+), 5 deletions(-) diff --git a/net/eth-uclass.c b/net/eth-uclass.c index 5c437143a30..5518268bd68 100644 --- a/net/eth-uclass.c +++ b/net/eth-uclass.c @@ -347,12 +347,13 @@ int eth_init(void) debug("Trying %s\n", current->name); ret = eth_start_udev(current); - if (ret < 0) - ret = eth_errno; - else + if (ret < 0) { + if (eth_errno < 0) + ret = eth_errno; + debug("%s start failed (ret=%d)\n", current->name, ret); + } else { break; - - debug("FAIL\n"); + } } else { debug("PROBE FAIL\n"); } --- base-commit: 4d499701629ec07d32e3dacbf9d9bd43d9e8032f branch: main -- 2.55.0.887.g758fc8c411-goog