--- a/ipq806x/nss_gmac_ctrl.c +++ b/ipq806x/nss_gmac_ctrl.c @@ -957,7 +957,8 @@ static int32_t nss_gmac_of_get_pdata(struct device_node *np, struct net_device *netdev, struct msm_nss_gmac_platform_data *gmaccfg) { - uint8_t *maddr = NULL; + int ret; + u8 maddr[ETH_ALEN]; struct nss_gmac_dev *gmacdev = (struct nss_gmac_dev *)netdev_priv(netdev); struct resource memres_devtree = {0}; @@ -991,9 +992,9 @@ static int32_t nss_gmac_of_get_pdata(struct device_node *np, pr_err("%s: Can't map interrupt\n", np->name); return -EFAULT; } - maddr = (uint8_t *)of_get_mac_address(np); - if (maddr) - memcpy(gmaccfg->mac_addr, maddr, ETH_ALEN); + ret = of_get_mac_address(np, maddr); + if (!ret && is_valid_ether_addr(maddr)) + ether_addr_copy(gmaccfg->mac_addr, maddr); if (of_address_to_resource(np, 0, &memres_devtree) != 0) return -EFAULT;