Skip to contentSkip to conversation

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

PATCH Superseded Christian Lamparter 2 participants 2 messages Sep 18, 2021 – Sep 19, 2021

Subsystems (3)

v1 of 2 Superseded Latest is v2 →

lore
Share & tools
lore
#0 lore raw

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

Since the inclusion of nvmem into the helper function of_get_mac_address() by
commit d01f449c008a ("of_net: add NVMEM support to of_get_mac_address") it has been possible to receive a -EPROBE_DEFER return code during boot. Previously, this resulted in setting a random ethernet address.

This exact issue happened on my Meraki MR32. This is because the nvmem provider is an EEPROM (at24) which gets instantiated once the module driver is loaded... which of course happens much later when the filesystem becomes available.

With this patch, the probe will propagate this error code. The driver subsystem will reschedule the probe at a later time, once the nvmem is in place and ready to deliver the requested mac-address.

---
 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
Quoted 4 lines · Christian Lamparter

Since the inclusion of nvmem into the helper function of_get_mac_address() by
commit d01f449c008a ("of_net: add NVMEM support to of_get_mac_address") it has been possible to receive a -EPROBE_DEFER return code during boot.

Please use this commit as the Fixes: tag.

Also, please base this in net, not next-next, and put net in subject, as described in the netdev FAQ.

Andrew