diff options
Diffstat (limited to 'target/linux/realtek')
-rw-r--r-- | target/linux/realtek/files-5.4/drivers/net/ethernet/rtl838x_eth.c | 8 |
1 files changed, 3 insertions, 5 deletions
diff --git a/target/linux/realtek/files-5.4/drivers/net/ethernet/rtl838x_eth.c b/target/linux/realtek/files-5.4/drivers/net/ethernet/rtl838x_eth.c index de54868cad..f810f7eb58 100644 --- a/target/linux/realtek/files-5.4/drivers/net/ethernet/rtl838x_eth.c +++ b/target/linux/realtek/files-5.4/drivers/net/ethernet/rtl838x_eth.c @@ -1968,7 +1968,6 @@ static int __init rtl838x_eth_probe(struct platform_device *pdev) struct device_node *dn = pdev->dev.of_node; struct rtl838x_eth_priv *priv; struct resource *res, *mem; - const void *mac; phy_interface_t phy_mode; struct phylink *phylink; int err = 0, i, rxrings, rxringlen; @@ -2089,10 +2088,9 @@ static int __init rtl838x_eth_probe(struct platform_device *pdev) * 1) from device tree data * 2) from internal registers set by bootloader */ - mac = of_get_mac_address(pdev->dev.of_node); - if (!IS_ERR(mac)) { - memcpy(dev->dev_addr, mac, ETH_ALEN); - rtl838x_set_mac_hw(dev, (u8 *)mac); + of_get_mac_address(pdev->dev.of_node, dev->dev_addr); + if (is_valid_ether_addr(dev->dev_addr))) { + rtl838x_set_mac_hw(dev, (u8 *)dev->dev_addr); } else { dev->dev_addr[0] = (sw_r32(priv->r->mac) >> 8) & 0xff; dev->dev_addr[1] = sw_r32(priv->r->mac) & 0xff; |