Skip to content

Commit 78ddc03

Browse files
xdarklightclaudiubeznea
authored andcommitted
net: stmmac: manage errors returned by of_get_mac_address()
Commit d01f449 ("of_net: add NVMEM support to of_get_mac_address") added support for reading the MAC address from an nvmem-cell. This required changing the logic to return an error pointer upon failure. If stmmac is loaded before the nvmem provider driver then of_get_mac_address() return an error pointer with -EPROBE_DEFER. Propagate this error so the stmmac driver will be probed again after the nvmem provider driver is loaded. Default to a random generated MAC address in case of any other error, instead of using the error pointer as MAC address. Fixes: d01f449 ("of_net: add NVMEM support to of_get_mac_address") Signed-off-by: Martin Blumenstingl <martin.blumenstingl@googlemail.com> Reviewed-by: Neil Armstrong <narmstrong@baylibre.com> Signed-off-by: David S. Miller <davem@davemloft.net>
1 parent 185666e commit 78ddc03

1 file changed

Lines changed: 7 additions & 0 deletions

File tree

drivers/net/ethernet/stmicro/stmmac/stmmac_platform.c

Lines changed: 7 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -395,6 +395,13 @@ stmmac_probe_config_dt(struct platform_device *pdev, const char **mac)
395395
return ERR_PTR(-ENOMEM);
396396

397397
*mac = of_get_mac_address(np);
398+
if (IS_ERR(*mac)) {
399+
if (PTR_ERR(*mac) == -EPROBE_DEFER)
400+
return ERR_CAST(*mac);
401+
402+
*mac = NULL;
403+
}
404+
398405
plat->interface = of_get_phy_mode(np);
399406

400407
/* Get max speed of operation from device tree */

0 commit comments

Comments
 (0)