🚀 go-pugleaf

RetroBBS NetNews Server

Inspired by RockSolid Light RIP Retro Guy

Thread View: linux.kernel.netdev
2 messages
2 total messages Started by Andrew Lunn Tue, 01 Dec 2026 01:30
Re: [PATCH v5 3/5] net: of_net: Derive MAC addresses from a unique device ID
#24891
Author: Andrew Lunn
Date: Tue, 01 Dec 2026 01:30
21 lines
9352 bytes
> @@ -142,7 +239,11 @@ int of_get_mac_address(struct device_node *np, u8 *addr)
>  	if (!ret)
>  		return 0;
>  
> -	return of_get_mac_address_nvmem(np, addr);
> +	ret = of_get_mac_address_nvmem(np, addr);
> +	if (!ret || ret == -EPROBE_DEFER)
> +		return ret;

You need to be careful here. There might be devices which currently
work because they return EPROBE_DEFER here and try again later.

Also, none of the other sources of the MAC address in this function
special case it.


    Andrew

---
pw-bot: cr
Re: [PATCH v5 3/5] net: of_net: Derive MAC addresses from a unique device ID
#25279
Author: Andrew Lunn
Date: Tue, 01 Dec 2026 13:05
43 lines
10745 bytes
On Tue, Dec 01, 2026 at 08:17:03AM +0400, Alexey Charkov wrote:
> On Tue, Dec 1, 2026 at 5:30 AM Andrew Lunn <andrew@lunn.ch> wrote:
> >
> > > @@ -142,7 +239,11 @@ int of_get_mac_address(struct device_node *np, u8 *addr)
> > >       if (!ret)
> > >               return 0;
> > >
> > > -     return of_get_mac_address_nvmem(np, addr);
> > > +     ret = of_get_mac_address_nvmem(np, addr);
> > > +     if (!ret || ret == -EPROBE_DEFER)
> > > +             return ret;
> >
> > You need to be careful here. There might be devices which currently
> > work because they return EPROBE_DEFER here and try again later.
> 
> But that's exactly why I'm catching EPROBE_DEFER and returning it
> immediately, so that the driver core can retry once the NVMEM cell
> appears, instead of falling through to the next case. Am I missing
> anything?
> 
> > Also, none of the other sources of the MAC address in this function
> > special case it.
> 
> I don't think any of the others can defer, because they don't rely on
> an external provider. While NVMEM relies on the nvmem driver, which
> might be a module.

Ah, this function is not great. Generally we consider real errors as
fatal and return them. EIO, ETIMEDOUT, EINVAL etc indicate something
has gone wrong. EPROBE_DEFER would also fall into that class. Errors
like ENODEV would indicate the property does not exist, and we should
try the next.

However, this code does not do that. All errors are ignored, and the
next source is tried.

So your change is correct, in this context. And it is probably too
late to add proper error handling.

Reviewed-by: Andrew Lunn <andrew@lunn.ch>

    Andrew
Thread Navigation

This is a paginated view of messages in the thread with full content displayed inline.

Messages are displayed in chronological order, with the original post highlighted in green.

Use pagination controls to navigate through all messages in large threads.

Back to All Threads