--- a/drivers/net/wireless/uwe5622/unisocwifi/cfg80211.c +++ b/drivers/net/wireless/uwe5622/unisocwifi/cfg80211.c @@ -394,7 +394,7 @@ struct sprdwl_priv *priv = vif->priv; enum nl80211_iftype type = vif->wdev.iftype; enum sprdwl_mode mode; - u8 *mac; + u8 mac[ETH_ALEN]; u8 vif_ctx_id = 0; wl_ndev_log(L_DBG, vif->ndev, "%s type %d, mode %d\n", __func__, type, @@ -427,9 +427,9 @@ vif->mode = mode; if (!vif->ndev) - mac = vif->wdev.address; + ether_addr_copy(mac, vif->wdev.address); else - mac = vif->ndev->dev_addr; + ether_addr_copy(mac, vif->ndev->dev_addr); if (sprdwl_open_fw(priv, &vif_ctx_id, vif->mode, mac)) { wl_ndev_log(L_ERR, vif->ndev, "%s failed!\n", __func__); --- a/drivers/net/wireless/uwe5622/unisocwifi/main.c +++ b/drivers/net/wireless/uwe5622/unisocwifi/main.c @@ -944,12 +944,12 @@ if (!is_zero_ether_addr(sa->sa_data)) { vif->has_rand_mac = true; memcpy(vif->random_mac, sa->sa_data, ETH_ALEN); - memcpy(dev->dev_addr, sa->sa_data, ETH_ALEN); + dev_addr_set(dev, sa->sa_data); } else { vif->has_rand_mac = false; netdev_info(dev, "need clear random mac for sta/softap mode\n"); memset(vif->random_mac, 0, ETH_ALEN); - memcpy(dev->dev_addr, vif->mac, ETH_ALEN); + dev_addr_set(dev, vif->mac); } } /*return success to pass vts test*/ @@ -1448,7 +1448,12 @@ ndev->features |= NETIF_F_SG; SET_NETDEV_DEV(ndev, wiphy_dev(priv->wiphy)); - sprdwl_set_mac_addr(vif, addr, ndev->dev_addr); + { + u8 mac_addr_buf[ETH_ALEN]; + ether_addr_copy(mac_addr_buf, ndev->dev_addr); + sprdwl_set_mac_addr(vif, addr, mac_addr_buf); + dev_addr_set(ndev, mac_addr_buf); + } #ifdef CONFIG_P2P_INTF if (type == NL80211_IFTYPE_P2P_DEVICE)