Skip to contentSkip to conversation

net: bgmac-bcma: handle deferred probe error due to mac-address

PATCH Applied Christian Lamparter 2 participants 2 messages Sep 19, 2021

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

PATCH v2 1/1 net: bgmac-bcma: handle deferred probe error due to mac-address

Due to the inclusion of nvmem handling into the mac-address getter function of_get_mac_address() by
commit d01f449c008a ("of_net: add NVMEM support to of_get_mac_address") it is now possible to get a -EPROBE_DEFER return code. Which did cause bgmac to assign a random ethernet address.

This exact issue happened on my Meraki MR32. The nvmem provider is an EEPROM (at24c64) which gets instantiated once the module driver is loaded... This happens once the filesystem becomes available.

With this patch, bgmac_probe() will propagate the -EPROBE_DEFER error. Then the driver subsystem will reschedule the probe at a later time.

Cc Petr Štetiar <[email protected]>
Cc Michael Walle <[email protected]>
Fixes d01f449c008a ("of_net: add NVMEM support to of_get_mac_address")

---
changes:
v1 -> v2:
rewrote commit message
based on net (commit 02319bf15ac) [Andrew Lunn] "net" tag [Andrew Lunn]
added "CCs" of the previous authors in that area

---
 drivers/net/ethernet/broadcom/bgmac-bcma.c | 2 ++
 1 file changed, 2 insertions(+)
drivers/net/ethernet/broadcom/bgmac-bcma.c +2 -0
index 85fa0ab7201c..9513cfb5ba58 100644
@@ -129,6 +129,8 @@ static int bgmac_probe(struct bcma_device *core)
 	bcma_set_drvdata(core, bgmac);
 
 	err = of_get_mac_address(bgmac->dev->of_node, bgmac->net_dev->dev_addr);
+	if (err == -EPROBE_DEFER)
+		return err;
 
 	/* If no MAC address assigned via device tree, check SPROM */
 	if (err) {
Signature · 1 line
2.33.0
#1 lore raw
This patch was applied to netdev/net.git (refs/heads/master):

Hello:

This patch was applied to netdev/net.git (refs/heads/master):

Quoted 11 lines · On Sun, 19 Sep 2021 13:57:25 +0200 you wrote:

Due to the inclusion of nvmem handling into the mac-address getter function of_get_mac_address() by
commit d01f449c008a ("of_net: add NVMEM support to of_get_mac_address") it is now possible to get a -EPROBE_DEFER return code. Which did cause bgmac to assign a random ethernet address.

This exact issue happened on my Meraki MR32. The nvmem provider is an EEPROM (at24c64) which gets instantiated once the module driver is loaded... This happens once the filesystem becomes available.

[...]

Here is the summary with links:
- [net,v2] net: bgmac-bcma: handle deferred probe error due to mac-address

    https://git.kernel.org/netdev/net/c/029497e66bdc

You are awesome, thank you!
--
Deet-doot-dot, I am a bot.
https://korg.docs.kernel.org/patchwork/pwbot.html