🚀 go-pugleaf

RetroBBS NetNews Server

Inspired by RockSolid Light RIP Retro Guy

Article View: linux.kernel.netdev
Article #25279

Re: [PATCH v5 3/5] net: of_net: Derive MAC addresses from a unique device ID

#25279
From: 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
Technical Details
Message-ID: <d856501d-501b-4618-9f8b-0b59538086bd@lunn.ch>
Path: mbox-mo1.pugleaf.net!srv.newsdeef.eu!newsfeed.bofh.team!news.nntp4.net!nntp.xenet.de!news.neodome.net!usenet.network!.POSTED!vger.kernel.org!netdev+bounces-375084-linux-kernel-netdev=dewy.ru
References: <20261125-rk3576-otp-cpuid-mac-v5-0-b3125c9a5fc8@flipper.net> <20261125-rk3576-otp-cpuid-mac-v5-3-b3125c9a5fc8@flipper.net> <0a48577d-32e1-4f59-8b3d-4274174bfaf1@lunn.ch> <CAKTNdwFHOTjzBaFJkKpcwTsxVQUc=FG3u4o9urO6noWFCJzfcQ@mail.gmail.com>

Show Full Headers
Complete Article Headers
Path: mbox-mo1.pugleaf.net!srv.newsdeef.eu!newsfeed.bofh.team!news.nntp4.net!nntp.xenet.de!news.neodome.net!usenet.network!.POSTED!vger.kernel.org!netdev+bounces-375084-linux-kernel-netdev=dewy.ru
From: andrew@lunn.ch (Andrew Lunn)
Newsgroups: linux.kernel.netdev
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
Organization: Usenet Network
Message-ID: <d856501d-501b-4618-9f8b-0b59538086bd@lunn.ch>
References: <20261125-rk3576-otp-cpuid-mac-v5-0-b3125c9a5fc8@flipper.net>
 <20261125-rk3576-otp-cpuid-mac-v5-3-b3125c9a5fc8@flipper.net>
 <0a48577d-32e1-4f59-8b3d-4274174bfaf1@lunn.ch>
 <CAKTNdwFHOTjzBaFJkKpcwTsxVQUc=FG3u4o9urO6noWFCJzfcQ@mail.gmail.com>
MIME-Version: 1.0
Content-Type: text/plain; charset=utf-8
Content-Transfer-Encoding: 8bit
Injection-Info: usenet.network;
	logging-data="1717367"; mail-complaints-to="abuse@usenet.network"
Cancel-Lock: sha1:c75rW9SVUQ6X8hDYC/m09d7Aqww= sha256:MwA67VT0SPqUKMu0EvuT3l+77cJWMXmAxOxOsl+G3NQ=
	sha1:+eiMzFW85kcMurQZAySHEDY48fQ= sha256:Cid+e6s4CAfXNvgw2PdsYM+eTNw36NjtJNlAX4qi25U=
Content-Disposition: inline
List-ID: <netdev.vger.kernel.org>
X-Mailpost-Empty-Hdrs: X-Spam-Level
X-Received: from localhost (localhost [127.0.0.1])
	by mail.dewy.ru (Postfix) with ESMTP id D43011173AA; Tue,  1 Dec 2026 16:06:30 +0300 (MSK)
X-Virus-Scanned: Debian amavisd-new at usenet.network
X-Spam-Flag: NO
X-Spam-Score: -3.05
X-Spam-Status: No, score=-3.05 tagged_above=-9999 required=6.31
	tests=[DCC_REPUT_70_89=0.1, DKIM_SIGNED=0.1, DKIM_VALID=-0.1,
	DKIM_VALID_AU=-0.1, HEADER_FROM_DIFFERENT_DOMAINS=0.249,
	MAILING_LIST_MULTI=-1, RCVD_IN_DNSWL_MED=-2.3, SPF_HELO_NONE=0.001,
	SPF_PASS=-0.001, URIBL_BLOCKED=0.001] autolearn=ham autolearn_force=no
X-Authentication-Results: mail.dewy.ru (amavisd-new); dkim=pass (1024-bit key)
	header.d=lunn.ch
X-Received: from mail.dewy.ru ([127.0.0.1])
	by localhost (mail.dewy.ru [127.0.0.1]) (amavisd-new, port 10024)
	with ESMTP id fDTvA9vD-Af4;
	Tue,  1 Dec 2026 16:06:27 +0300 (MSK)
X-Received-SPF: Pass (mailfrom) identity=mailfrom; client-ip=172.234.253.10; helo=sea.lore.kernel.org; envelope-from=netdev+bounces-375084-linux-kernel-netdev=dewy.ru@vger.kernel.org; receiver=<UNKNOWN> 
X-Authentication-Results: OpenDMARC; dmarc=fail (p=none dis=none) header.from=lunn.ch
X-Received: from sea.lore.kernel.org (sea.lore.kernel.org [172.234.253.10])
	by mail.dewy.ru (Postfix) with ESMTPS id 4353A1173A6; Tue,  1 Dec 2026 16:06:19 +0300 (MSK)
X-Received: from smtp.subspace.kernel.org (conduit.subspace.kernel.org [100.77.114.92])
	by sea.lore.kernel.org (Postfix) with ESMTP id 44C552D79C; Tue,  1 Dec 2026 13:06:17 +0000 (UTC)
X-Authentication-Results: smtp.subspace.kernel.org; arc=pass header.oldest-pass=0 smtp.remote-ip=127.0.0.1
X-ARC-Seal: i=2; d=subspace.kernel.org; s=arc20261015; a=rsa-sha256; cv=pass;
	t=1796130376;
	b=w7amIMEsfAXnHL/1s9P+QkY/pGDo60NzBS9LKzN8qKfLM//BJQqDQf3LzpBWx703wS0a
	 rMrgvijJh2LzL3CwTvW9urlIwPi2VEgJoLdlqQ00I9lUKcNdATKN86cKoBxy0z+HdMvLd
	 y3S/W6qNNxRboQ8aFO7zSBSdZV7B1UKOf2ACGAnhp0WYf84ICPWKasxRDkQGsH/iZEfYH
	 +ND+EYW7iDB3zQzuCbuv+VA5ppB2R64SR34Ig1a1wrLWnBZF6Ac16OvwJJBlGk8LHqo6n
	 CejHqAK+e6yJIVugnTLGIFSNZC3fpk8AJvkE0qPAuCmEblu03wIFJo0AaVtGoMiWjjA==
X-ARC-Message-Signature: i=2; d=subspace.kernel.org; s=arc20261015;
	a=rsa-sha256; c=relaxed/relaxed; t=1796130376;
	h=X-Original-To:Received:DMARC-Filter:DKIM-Signature:Received:Date:
	 From:To:Cc:Subject:Message-ID:References:X-Mailing-List:List-Id:
	 List-Post:List-Help:List-Subscribe:List-Unsubscribe:List-Owner:
	 Precedence:MIME-Version:Content-Type:Content-Disposition:
	 Content-Transfer-Encoding:In-Reply-To;
	bh=jFVqKk0yZS0Sf2rZ3fi2bBnTnI57X3lEyvpjV6thPS8=;
	b=4jSFXLH02SzcLPlmLNJ3Y3T9+nhxnA8ijaAgcNHtSQhXA6XGiIijLqG15rmFN/rRT2I3
	 +AVsIPqmTcBagiRw02MuLYN17sknRNHxn7bWrKokafdAGqwdvpsdmMeH6B2R5Q0DSJNJt
	 gl5zMuzZKKL2L7Rl4aHaPfqg1/7VdkBwWJCIABi9bYlX/t/JlMN4j7Y4CSbaRsFItHy9d
	 /ckpgLcg+quCq+5+b80FsjN5Tzec7lwL2QdprAoNK2Yanz5/Mmhc1GM7TinvDeA1YVA/V
	 Edom4z2bDwm6NlT95wfGxzTHHnYwVyTNk0StP/KcJUHNSyTor94U/W+OAQaD94kIT9Q==
X-ARC-Authentication-Results: i=2; smtp.subspace.kernel.org; 
	dkim=pass header.d=lunn.ch header.i=@lunn.ch header.a=rsa-sha256 header.s=20171124 header.b=heJmK4he;
	dmarc=pass header.from=lunn.ch;
	spf=pass smtp.mailfrom=lunn.ch;
	arc=pass header.oldest-pass=0 smtp.remote-ip=127.0.0.1
X-Received: from localhost.localdomain (localhost [127.0.0.1])
	by smtp.subspace.kernel.org (Postfix) with ESMTP id D6F3C606A32F;
	Tue,  1 Dec 2026 13:06:16 +0000 (UTC)
X-Authentication-Results: smtp.subspace.kernel.org;
	dkim=pass (1024-bit key) header.d=lunn.ch header.i=@lunn.ch header.a=rsa-sha256 header.s=20171124 header.b=heJmK4he
X-Authentication-Results: smtp.subspace.kernel.org; arc=none smtp.remote-ip=156.67.10.101
X-ARC-Seal: i=1; d=subspace.kernel.org; s=arc20261015; a=rsa-sha256; cv=none;
	t=1796130376;
	b=KmvZ9GiepfZq5iBSg1ckPQIY9pezwsQ56lGmuJa1vBza7ipQeP7dXSVqlcVBMc2bBTlo
	 dNkBhAiCG9cjz6hsqSZsNTIhYVSD5Q+ZEVmutbx0hUVNOT1UPSHUXaHR/pnnSar3oSWTF
	 GX5VcZADg+9ZgUBTIhrAPVZn0iKaaDNYaJ/HIUecPYhm2sq/K0XtJmXFubUJ7ritufaZD
	 A2qHxHuIfxKNBiIrxR1QARU9PhhJvZ4JHXzQr4I3+TBK/AkKgLik+31kCDCOB8UVGDrH+
	 7R9KTLCGHO/ea23W7V1VJynJFyxTNSYvcTBkf9N+6J/WP5YOnjPymY1ZTdSik07DTpw==
X-ARC-Message-Signature: i=1; d=subspace.kernel.org; s=arc20261015;
	a=rsa-sha256; c=relaxed/relaxed; t=1796130376;
	h=DMARC-Filter:DKIM-Signature:Received:Date:From:To:Cc:Subject:
	 Message-ID:References:MIME-Version:Content-Type:Content-Disposition:
	 Content-Transfer-Encoding:In-Reply-To;
	bh=jFVqKk0yZS0Sf2rZ3fi2bBnTnI57X3lEyvpjV6thPS8=;
	b=JlurwCWlULdJ0nh8fOZ7s0lU2uS6KWVmWBiCw81AfrdNgJz68CgglKhV9EihlN5zkSwO
	 5kn1P3mMfhlHd4SoV43dm/MZ50vDvXlp+a9z/0dmfI/5baDDZ5JHeutqhQUuAgPGzV95E
	 cW8T2dFKWePfA2tSi43XFJ7ssxorLmvKqbMUl9MUeztpEPGBHXaXcUOIkoHXZUjFgv8fJ
	 2vBYY7qmSOMKStY4mM93NkPpad2HL1ZGtXYS54VX38ZRhQ4JuOBmf1wT7A++TnsMFef9M
	 VPH0HuSPMPgHpxdOFSqdq7Jpj8N0nlI2N71JXq8/6UIeumQQm/dl/jjGXSGmAcCB/kw==
X-ARC-Authentication-Results: i=1; smtp.subspace.kernel.org; 
	dmarc=pass header.from=lunn.ch;
	spf=pass smtp.mailfrom=lunn.ch;
	dkim=pass header.d=lunn.ch header.i=@lunn.ch header.a=rsa-sha256 header.s=20171124 header.b=heJmK4he;
	arc=none smtp.remote-ip=156.67.10.101
X-Received: from vps0.lunn.ch (vps0.lunn.ch [156.67.10.101])
	(using TLSv1.3 with cipher TLS_AES_256_GCM_SHA384 (256/256 bits)
	 key-exchange ECDHE (prime256v1) server-signature ECDSA (prime256v1) server-digest SHA256)
	(No client certificate requested)
	by smtp.subspace.kernel.org (Postfix) with ESMTPS id 57568606A31A;
	Tue,  1 Dec 2026 13:06:15 +0000 (UTC)
X-DMARC-Filter: OpenDMARC Filter v1.4.2 smtp.subspace.kernel.org 57568606A31A
X-Authentication-Results: smtp.subspace.kernel.org; dmarc=pass (p=none dis=none) header.from=lunn.ch
X-Authentication-Results: smtp.subspace.kernel.org; spf=pass smtp.mailfrom=lunn.ch
X-DKIM-Signature: v=1; a=rsa-sha256; q=dns/txt; c=relaxed/relaxed; d=lunn.ch;
	s=20171124; h=In-Reply-To:Content-Transfer-Encoding:Content-Disposition:
	Content-Type:MIME-Version:References:Message-ID:Subject:Cc:To:From:Date:From:
	Sender:Reply-To:Subject:Date:Message-ID:To:Cc:MIME-Version:Content-Type:
	Content-Transfer-Encoding:Content-ID:Content-Description:Content-Disposition:
	In-Reply-To:References; bh=jFVqKk0yZS0Sf2rZ3fi2bBnTnI57X3lEyvpjV6thPS8=; b=he
	JmK4heK+m0O29sp5cNfiT6MVrU3D9OgL0D6PL7lwM3hWPuih4cStpgEaUa7E1u2nEBQ53njauMmJI
	pszUNQE88Ax5UWh7mBfNq696EN2RH4K8vtCNBcNrCAgox9LPaBLSy56NdXEgiKqKcwJQObeLRISpY
	olA3MMfs84ktTsk=;
X-Received: from andrew by vps0.lunn.ch with local (Exim 4.94.2)
	(envelope-from <andrew@lunn.ch>)
	id 1xYNYL-002cO2-1J; Tue, 01 Dec 2026 14:05:49 +0100
X-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
X-Mailing-List: netdev@vger.kernel.org
X-List-Post: <mailto:netdev@vger.kernel.org>
X-List-Help: <mailto:netdev+help@vger.kernel.org>
X-List-Subscribe: <mailto:netdev+subscribe@vger.kernel.org>
X-List-Unsubscribe: <mailto:netdev+unsubscribe@vger.kernel.org>
X-List-Owner: <mailto:netdev+owner@vger.kernel.org>
X-Precedence: list
X-In-Reply-To: <CAKTNdwFHOTjzBaFJkKpcwTsxVQUc=FG3u4o9urO6noWFCJzfcQ@mail.gmail.com>