Skip to contentSkip to conversation

net: mvneta: support EPROBE_DEFER when reading MAC address

PATCH Applied Rosen Penev 3 participants 3 messages Mar 7 – Mar 11

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

PATCH v2 1/1 net: mvneta: support EPROBE_DEFER when reading 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.

Add extra goto section to just free stats as they are allocated right above.

---
v2: free stats on probe defer.

 drivers/net/ethernet/marvell/mvneta.c | 3 +++
 1 file changed, 3 insertions(+)
drivers/net/ethernet/marvell/mvneta.c +3 -0
index d627858d2802..5bdf5020ec69 100644
@@ -5620,6 +5620,8 @@ static int mvneta_probe(struct platform_device *pdev)
 	}
 
 	err = of_get_ethdev_address(dn, dev);
+	if (err == -EPROBE_DEFER)
+		goto err_free_stats;
 	if (!err) {
 		mac_from = "device tree";
 	} else {
@@ -5755,6 +5757,7 @@ static int mvneta_probe(struct platform_device *pdev)
 				       1 << pp->id);
 		mvneta_bm_put(pp->bm_priv);
 	}
+err_free_stats:
 	free_percpu(pp->stats);
 err_free_ports:
 	free_percpu(pp->ports);

--
2.53.0

reviewer Reviewed-by on v2 1/1
#1 lore raw
Quoted 10 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.

Add extra goto section to just free stats as they are allocated right above.

---
v2: free stats on probe defer.

#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 Fri, 6 Mar 2026 19:17:09 -0800 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.

Add extra goto section to just free stats as they are allocated right above.

[...]

Here is the summary with links:
- [PATCHv2,net-next] net: mvneta: support EPROBE_DEFER when reading MAC address

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

You are awesome, thank you!

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