IMHO at least the activation check is a valid case. It just check the
status flag and returns EINVAL without setting errno:

292         if (!device_active(dev))
293                 return -EINVAL;

Thanks,
-Yuxiao



On Wed, Aug 26, 2026 at 1:02 PM Tom Rini <[email protected]> wrote:

> 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
>

Reply via email to