From: Andrew Lunn <andrew@lunn.ch>
To: Alexey Charkov <alchark@flipper.net>
Cc: "Srinivas Kandagatla" <srini@kernel.org>,
"Rob Herring" <robh@kernel.org>,
"Krzysztof Kozlowski" <krzk+dt@kernel.org>,
"Conor Dooley" <conor+dt@kernel.org>,
"Heiko Stuebner" <heiko@sntech.de>,
"Rafał Miłecki" <rafal@milecki.pl>,
"Andrew Lunn" <andrew+netdev@lunn.ch>,
"David S. Miller" <davem@davemloft.net>,
"Eric Dumazet" <edumazet@kernel.org>,
"Jakub Kicinski" <kuba@kernel.org>,
"Paolo Abeni" <pabeni@redhat.com>,
"Heiner Kallweit" <hkallweit1@gmail.com>,
"Russell King" <linux@armlinux.org.uk>,
"Willem de Bruijn" <willemb@google.com>,
"Simon Horman" <horms@kernel.org>,
"Ryan Leung" <untilscour@protonmail.com>,
"Ricardo Pardini" <ricardo@pardini.net>,
devicetree@vger.kernel.org, linux-arm-kernel@lists.infradead.org,
linux-rockchip@lists.infradead.org, netdev@vger.kernel.org,
linux-kernel@vger.kernel.org
Subject: Re: [PATCH v5 3/5] net: of_net: Derive MAC addresses from a unique device ID
Date: Tue, 1 Dec 2026 14:05:48 +0100 [thread overview]
Message-ID: <d856501d-501b-4618-9f8b-0b59538086bd@lunn.ch> (raw)
In-Reply-To: <CAKTNdwFHOTjzBaFJkKpcwTsxVQUc=FG3u4o9urO6noWFCJzfcQ@mail.gmail.com>
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
next prev parent reply other threads:[~2026-12-01 13:06 UTC|newest]
Thread overview: 10+ messages / expand[flat|nested] mbox.gz Atom feed top
2026-11-25 19:36 [PATCH v5 0/5] net: Derive stable " Alexey Charkov
2026-11-25 19:36 ` [PATCH v5 1/5] dt-bindings: nvmem: fixed-cell: Add Rockchip CPU ID Alexey Charkov
2026-11-25 19:36 ` [PATCH v5 2/5] dt-bindings: net: ethernet-controller: Allow a unique ID NVMEM cell Alexey Charkov
2026-11-25 19:36 ` [PATCH v5 3/5] net: of_net: Derive MAC addresses from a unique device ID Alexey Charkov
2026-11-26 4:02 ` Ryan Leung
2026-12-01 1:30 ` Andrew Lunn
2026-12-01 4:17 ` Alexey Charkov
2026-12-01 13:05 ` Andrew Lunn [this message]
2026-11-25 19:36 ` [PATCH v5 4/5] arm64: dts: rockchip: Move RK3576 OTP cells into a fixed layout Alexey Charkov
2026-11-25 19:36 ` [PATCH v5 5/5] arm64: dts: rockchip: Derive GMAC MAC addresses from OTP on RK3576 Alexey Charkov
Reply instructions:
You may reply publicly to this message via plain-text email
using any one of the following methods:
* Save the following mbox file, import it into your mail client,
and reply-to-all from there: mbox
Avoid top-posting and favor interleaved quoting:
https://en.wikipedia.org/wiki/Posting_style#Interleaved_style
* Reply using the --to, --cc, and --in-reply-to
switches of git-send-email(1):
git send-email \
--in-reply-to=d856501d-501b-4618-9f8b-0b59538086bd@lunn.ch \
--to=andrew@lunn.ch \
--cc=alchark@flipper.net \
--cc=andrew+netdev@lunn.ch \
--cc=conor+dt@kernel.org \
--cc=davem@davemloft.net \
--cc=devicetree@vger.kernel.org \
--cc=edumazet@kernel.org \
--cc=heiko@sntech.de \
--cc=hkallweit1@gmail.com \
--cc=horms@kernel.org \
--cc=krzk+dt@kernel.org \
--cc=kuba@kernel.org \
--cc=linux-arm-kernel@lists.infradead.org \
--cc=linux-kernel@vger.kernel.org \
--cc=linux-rockchip@lists.infradead.org \
--cc=linux@armlinux.org.uk \
--cc=netdev@vger.kernel.org \
--cc=pabeni@redhat.com \
--cc=rafal@milecki.pl \
--cc=ricardo@pardini.net \
--cc=robh@kernel.org \
--cc=srini@kernel.org \
--cc=untilscour@protonmail.com \
--cc=willemb@google.com \
/path/to/YOUR_REPLY
https://kernel.org/pub/software/scm/git/docs/git-send-email.html
* If your mail client supports setting the In-Reply-To header
via mailto: links, try the mailto: link
Be sure your reply has a Subject: header at the top and a blank line
before the message body.
This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox
all inboxes | Powered by JetHome®