Skip to contentSkip to conversation

net: fs_enet: allow nvmem to override MAC address

PATCH Applied Rosen Penev 3 participants 4 messages Feb 24 – Feb 26

Subsystems (3)
lore
Share & tools
lore
#0 lore raw

PATCH 1/1 net: fs_enet: allow nvmem to override MAC address

NVMEM typically loads after the ethernet driver and of_get_ethdev_address returns -EPROBE_DEFER. return in such a case to allow NVMEM to work.

---
 drivers/net/ethernet/freescale/fs_enet/fs_enet-main.c | 4 +++-
 1 file changed, 3 insertions(+), 1 deletion(-)
drivers/net/ethernet/freescale/fs_enet/fs_enet-main.c +3 -1
index 2cbcc29408e3..d3c772ed5fc9 100644
@@ -951,7 +951,9 @@ static int fs_enet_probe(struct platform_device *ofdev)
 	spin_lock_init(&fep->lock);
 	spin_lock_init(&fep->tx_lock);
 
-	of_get_ethdev_address(ofdev->dev.of_node, ndev);
+	ret = of_get_ethdev_address(ofdev->dev.of_node, ndev);
+	if (ret == -EPROBE_DEFER)
+		goto out_cleanup_data;
 
 	ret = fep->ops->allocate_bd(ndev);
 	if (ret)

--
2.53.0

#1 lore raw

Le 24/02/2026 à 02:46, Rosen Penev a écrit :

Quoted 14 lines

NVMEM typically loads after the ethernet driver and of_get_ethdev_address returns -EPROBE_DEFER. return in such a case to allow NVMEM to work.

---
  drivers/net/ethernet/freescale/fs_enet/fs_enet-main.c | 4 +++-
  1 file changed, 3 insertions(+), 1 deletion(-)
drivers/net/ethernet/freescale/fs_enet/fs_enet-main.c +0 -0
index 2cbcc29408e3..d3c772ed5fc9 100644

drivers/net/ethernet/freescale/fs_enet/fs_enet-main.c static int fs_enet_probe(struct platform_device *ofdev) · line 956

Quoted 7 lines
drivers/net/ethernet/freescale/fs_enet/fs_enet-main.c +3 -1
@@ -951,7 +951,9 @@ static int fs_enet_probe(struct platform_device *ofdev)
  	spin_lock_init(&fep->lock);
  	spin_lock_init(&fep->tx_lock);
 
-	of_get_ethdev_address(ofdev->dev.of_node, ndev);
+	ret = of_get_ethdev_address(ofdev->dev.of_node, ndev);
+	if (ret == -EPROBE_DEFER)
+		goto out_cleanup_data;

What about other error cases ? Shouldn't it exit on all types of errors ?

Quoted 7 lines
drivers/net/ethernet/freescale/fs_enet/fs_enet-main.c +0 -1
  	ret = fep->ops->allocate_bd(ndev);
  	if (ret)
--

2.53.0

#2 lore raw
Quoted 21 lines · Christophe Leroy (CS GROUP)
Quoted 17 lines · Rosen Penev

NVMEM typically loads after the ethernet driver and of_get_ethdev_address returns -EPROBE_DEFER. return in such a case to allow NVMEM to work.

---
  drivers/net/ethernet/freescale/fs_enet/fs_enet-main.c | 4 +++-
  1 file changed, 3 insertions(+), 1 deletion(-)
drivers/net/ethernet/freescale/fs_enet/fs_enet-main.c +0 -0
index 2cbcc29408e3..d3c772ed5fc9 100644
@@ -951,7 +951,9 @@ static int fs_enet_probe(struct platform_device *ofdev)
      spin_lock_init(&fep->lock);
      spin_lock_init(&fep->tx_lock);
 
Quoted 6 lines

drivers/net/ethernet/freescale/fs_enet/fs_enet-main.c static int fs_enet_probe(struct platform_device *ofdev) · line 956

Quoted 4 lines
drivers/net/ethernet/freescale/fs_enet/fs_enet-main.c +3 -1
-     of_get_ethdev_address(ofdev->dev.of_node, ndev);
+     ret = of_get_ethdev_address(ofdev->dev.of_node, ndev);
+     if (ret == -EPROBE_DEFER)
+             goto out_cleanup_data;

What about other error cases ? Shouldn't it exit on all types of errors ?

For MAC acquisition? No. That would result in a non working interface for no good reason.

The way other driver handle this is exit when probe is deferred, and set a random MAC on other errors.

Quoted 9 lines
Quoted 8 lines
drivers/net/ethernet/freescale/fs_enet/fs_enet-main.c +0 -1
      ret = fep->ops->allocate_bd(ndev);
      if (ret)
--

2.53.0

#3 lore raw
In reply to Rosen Penev
This patch was applied to netdev/net-next.git (main) by Jakub Kicinski <[email protected]>:

Hello:

This patch was applied to netdev/net-next.git (main) by Jakub Kicinski <[email protected]>:

Quoted 10 lines · On Mon, 23 Feb 2026 17:46:06 -0800 you wrote:

NVMEM typically loads after the ethernet driver and of_get_ethdev_address returns -EPROBE_DEFER. return in such a case to allow NVMEM to work.

---
 drivers/net/ethernet/freescale/fs_enet/fs_enet-main.c | 4 +++-
 1 file changed, 3 insertions(+), 1 deletion(-)

[...]

Here is the summary with links:
- [net-next] net: fs_enet: allow nvmem to override MAC address
https://git.kernel.org/netdev/net-next/c/dc2a1facbde8

You are awesome, thank you!

Signature · 2 lines
Deet-doot-dot, I am a bot.
https://korg.docs.kernel.org/patchwork/pwbot.html