733-v5.15-0001-net-bgmac-bcma-handle-deferred-probe-error-due-to-ma.patch 1.6 KB

123456789101112131415161718192021222324252627282930313233343536373839404142
  1. From 029497e66bdc762e001880e4c85a91f35a54b1e2 Mon Sep 17 00:00:00 2001
  2. From: Christian Lamparter <[email protected]>
  3. Date: Sun, 19 Sep 2021 13:57:25 +0200
  4. Subject: [PATCH] net: bgmac-bcma: handle deferred probe error due to
  5. mac-address
  6. MIME-Version: 1.0
  7. Content-Type: text/plain; charset=UTF-8
  8. Content-Transfer-Encoding: 8bit
  9. Due to the inclusion of nvmem handling into the mac-address getter
  10. function of_get_mac_address() by
  11. commit d01f449c008a ("of_net: add NVMEM support to of_get_mac_address")
  12. it is now possible to get a -EPROBE_DEFER return code. Which did cause
  13. bgmac to assign a random ethernet address.
  14. This exact issue happened on my Meraki MR32. The nvmem provider is
  15. an EEPROM (at24c64) which gets instantiated once the module
  16. driver is loaded... This happens once the filesystem becomes available.
  17. With this patch, bgmac_probe() will propagate the -EPROBE_DEFER error.
  18. Then the driver subsystem will reschedule the probe at a later time.
  19. Cc: Petr Štetiar <[email protected]>
  20. Cc: Michael Walle <[email protected]>
  21. Fixes: d01f449c008a ("of_net: add NVMEM support to of_get_mac_address")
  22. Signed-off-by: Christian Lamparter <[email protected]>
  23. Signed-off-by: David S. Miller <[email protected]>
  24. ---
  25. drivers/net/ethernet/broadcom/bgmac-bcma.c | 2 ++
  26. 1 file changed, 2 insertions(+)
  27. --- a/drivers/net/ethernet/broadcom/bgmac-bcma.c
  28. +++ b/drivers/net/ethernet/broadcom/bgmac-bcma.c
  29. @@ -129,6 +129,8 @@ static int bgmac_probe(struct bcma_devic
  30. bcma_set_drvdata(core, bgmac);
  31. err = of_get_mac_address(bgmac->dev->of_node, bgmac->net_dev->dev_addr);
  32. + if (err == -EPROBE_DEFER)
  33. + return err;
  34. /* If no MAC address assigned via device tree, check SPROM */
  35. if (err) {