brcmfmac: fix invalid permanent MAC address in wiphy
authorWright Feng <wright.feng@cypress.com>
Thu, 4 Jun 2020 07:18:32 +0000 (02:18 -0500)
committerKalle Valo <kvalo@codeaurora.org>
Tue, 14 Jul 2020 09:43:43 +0000 (12:43 +0300)
When host driver retrieves mac addresses from dongle, driver copies memory
from drvr->mac to perm_addr. But at the moment, drvr->mac is all zero
array which causes permanent MAC address in wiphy is all zero as well.
To fix this, we set drvr->mac before setting perm_addr.

Signed-off-by: Wright Feng <wright.feng@cypress.com>
Signed-off-by: Kalle Valo <kvalo@codeaurora.org>
Link: https://lore.kernel.org/r/20200604071835.3842-3-wright.feng@cypress.com
drivers/net/wireless/broadcom/brcm80211/brcmfmac/common.c

index dec25e4156199eb134997b9a3684bc9d8eb5937c..e3758bd86acf0cba5a9fb08403f049dfa36fed72 100644 (file)
@@ -209,8 +209,8 @@ int brcmf_c_preinit_dcmds(struct brcmf_if *ifp)
                bphy_err(drvr, "Retrieving cur_etheraddr failed, %d\n", err);
                goto done;
        }
-       memcpy(ifp->drvr->wiphy->perm_addr, ifp->drvr->mac, ETH_ALEN);
        memcpy(ifp->drvr->mac, ifp->mac_addr, sizeof(ifp->drvr->mac));
+       memcpy(ifp->drvr->wiphy->perm_addr, ifp->drvr->mac, ETH_ALEN);
 
        bus = ifp->drvr->bus_if;
        ri = &ifp->drvr->revinfo;