Re: [PATCH] u-boot: fix error check in eth init
Tom Rini <[email protected]>
| Newsgroups | org.u-boot-project.lists.u-boot |
|---|---|
| Message-ID | <20260826200207.GB3959812@bill-the-cat> |
On Wed, Aug 26, 2026 at 11:14:19AM -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 <[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"); > } Is it a valid case for eth_start_udev to have failed and not set eth_errno? -- Tom
signature.asc
(application/pgp-signature, 228 B)
-----BEGIN PGP SIGNATURE----- iHUEABYKAB0WIQTzzqh0PWDgGS+bTHor4qD1Cr/kCgUCao9GPwAKCRAr4qD1Cr/k CjloAQD0KvwH0u5SND3+TBPI0/sjpe84MmoDF9u/85TZ2rmbKwEArPD93k6PHQay IJCq2DFaBL3BcprNXmK3kjfei3UkNA4= =g9uH -----END PGP SIGNATURE-----