1 From e93a766da57fff3273bcb618edf5dfca1fb86b89 Mon Sep 17 00:00:00 2001
2 From: =?UTF-8?q?Rafa=C5=82=20Mi=C5=82ecki?= <rafal@milecki.pl>
3 Date: Thu, 15 Sep 2022 15:30:13 +0200
4 Subject: [PATCH] net: broadcom: bcm4908_enet: handle -EPROBE_DEFER when
7 Content-Type: text/plain; charset=UTF-8
8 Content-Transfer-Encoding: 8bit
10 Reading MAC from OF may return -EPROBE_DEFER if underlaying NVMEM device
11 isn't ready yet. In such case pass that error code up and "wait" to be
14 Signed-off-by: Rafał Miłecki <rafal@milecki.pl>
15 Link: https://lore.kernel.org/r/20220915133013.2243-1-zajec5@gmail.com
16 Signed-off-by: Jakub Kicinski <kuba@kernel.org>
18 drivers/net/ethernet/broadcom/bcm4908_enet.c | 13 +++++++++----
19 1 file changed, 9 insertions(+), 4 deletions(-)
21 --- a/drivers/net/ethernet/broadcom/bcm4908_enet.c
22 +++ b/drivers/net/ethernet/broadcom/bcm4908_enet.c
23 @@ -720,6 +720,8 @@ static int bcm4908_enet_probe(struct pla
25 SET_NETDEV_DEV(netdev, &pdev->dev);
26 err = of_get_mac_address(dev->of_node, netdev->dev_addr);
27 + if (err == -EPROBE_DEFER)
30 eth_hw_addr_random(netdev);
31 netdev->netdev_ops = &bcm4908_enet_netdev_ops;
32 @@ -730,14 +732,17 @@ static int bcm4908_enet_probe(struct pla
33 netif_napi_add(netdev, &enet->rx_ring.napi, bcm4908_enet_poll_rx, NAPI_POLL_WEIGHT);
35 err = register_netdev(netdev);
37 - bcm4908_enet_dma_free(enet);
43 platform_set_drvdata(pdev, enet);
48 + bcm4908_enet_dma_free(enet);
53 static int bcm4908_enet_remove(struct platform_device *pdev)