net: mvneta: support EPROBE_DEFER when reading MAC address
Subsystems (3)
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
@@ -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
Quoted 10 lines · Rosen Penev
If nvmem loads after the ethernet driver, mac address assignments will not take effect.
of_get_ethdev_addressreturnsEPROBE_DEFERin such a case so we need to handle that to avoideth_hw_addr_random.Add extra goto section to just free stats as they are allocated right above.
Signed-off-by Rosen Penev <[email protected]>---
v2: free stats on probe defer.
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_addressreturnsEPROBE_DEFERin such a case so we need to handle that to avoideth_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