Skip to contentSkip to conversation

net: gianfar: fix NVMEM mac address

PATCH Applied Rosen Penev 3 participants 3 messages Sep 10, 2024 – Sep 12, 2024

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

PATCH v2 1/1 net: gianfar: fix NVMEM mac address

If nvmem loads after the ethernet driver, mac address assignments will not take effect. of_get_ethdev_address returns EPROBE_DEFER in such a case so we need to handle that to avoid eth_hw_addr_random.

v2: use goto instead of return

---
 drivers/net/ethernet/freescale/gianfar.c | 2 ++
 1 file changed, 2 insertions(+)
drivers/net/ethernet/freescale/gianfar.c +2 -0
index 2baef59f741d..ecb1703ea150 100644
@@ -754,6 +754,8 @@ static int gfar_of_init(struct platform_device *ofdev, struct net_device **pdev)
 		priv->device_flags |= FSL_GIANFAR_DEV_HAS_BUF_STASHING;
 
 	err = of_get_ethdev_address(np, dev);
+	if (err == -EPROBE_DEFER)
+		goto err_grp_init;
 	if (err) {
 		eth_hw_addr_random(dev);
 		dev_info(&ofdev->dev, "Using random MAC address: %pM\n", dev->dev_addr);
Signature · 1 line
2.46.0
reviewer Reviewed-by on v2 1/1
#1 lore raw
Quoted 6 lines · Rosen Penev

If nvmem loads after the ethernet driver, mac address assignments will not take effect. of_get_ethdev_address returns EPROBE_DEFER in such a case so we need to handle that to avoid eth_hw_addr_random.

v2: use goto instead of return

Thanks for the update.

...

#2 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 8 lines · On Tue, 10 Sep 2024 15:09:13 -0700 you wrote:

If nvmem loads after the ethernet driver, mac address assignments will not take effect. of_get_ethdev_address returns EPROBE_DEFER in such a case so we need to handle that to avoid eth_hw_addr_random.

v2: use goto instead of return

[...]

Here is the summary with links:
- [PATCHv2,net-next] net: gianfar: fix NVMEM mac address

    https://git.kernel.org/netdev/net-next/c/b2d9544070d0

You are awesome, thank you!

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