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 @@ -712,7 +712,9 @@ static int bcm4908_enet_probe(struct pla
26 SET_NETDEV_DEV(netdev, &pdev->dev);
27 - of_get_mac_address(dev->of_node, netdev->dev_addr);
28 + err = of_get_mac_address(dev->of_node, netdev->dev_addr);
29 + if (err == -EPROBE_DEFER)
31 if (!is_valid_ether_addr(netdev->dev_addr))
32 eth_hw_addr_random(netdev);
33 netdev->netdev_ops = &bcm4908_enet_netdev_ops;
34 @@ -723,14 +725,17 @@ static int bcm4908_enet_probe(struct pla
35 netif_napi_add(netdev, &enet->rx_ring.napi, bcm4908_enet_poll_rx, NAPI_POLL_WEIGHT);
37 err = register_netdev(netdev);
39 - bcm4908_enet_dma_free(enet);
45 platform_set_drvdata(pdev, enet);
50 + bcm4908_enet_dma_free(enet);
55 static int bcm4908_enet_remove(struct platform_device *pdev)