From e7c636f2bb50367581bec53782fb15ebf8648936 Mon Sep 17 00:00:00 2001 From: Jakub Kicinski Date: Tue, 19 Oct 2021 10:12:42 -0700 Subject: staging: rtl: use eth_hw_addr_set() Commit 406f42fa0d3c ("net-next: When a bond have a massive amount of VLANs...") introduced a rbtree for faster Ethernet address look up. To maintain netdev->dev_addr in this tree we need to make all the writes to it got through appropriate helpers. Signed-off-by: Jakub Kicinski Link: https://lore.kernel.org/r/20211019171243.1412240-8-kuba@kernel.org Signed-off-by: Greg Kroah-Hartman --- drivers/staging/rtl8192u/r8192U.h | 3 ++- drivers/staging/rtl8192u/r8192U_core.c | 11 +++++++---- 2 files changed, 9 insertions(+), 5 deletions(-) (limited to 'drivers/staging/rtl8192u') diff --git a/drivers/staging/rtl8192u/r8192U.h b/drivers/staging/rtl8192u/r8192U.h index 4013107cd93a..14ca00a2789b 100644 --- a/drivers/staging/rtl8192u/r8192U.h +++ b/drivers/staging/rtl8192u/r8192U.h @@ -1114,6 +1114,7 @@ void rtl8192_set_rxconf(struct net_device *dev); void rtl819xusb_beacon_tx(struct net_device *dev, u16 tx_rate); void EnableHWSecurityConfig8192(struct net_device *dev); -void setKey(struct net_device *dev, u8 EntryNo, u8 KeyIndex, u16 KeyType, u8 *MacAddr, u8 DefaultKey, u32 *KeyContent); +void setKey(struct net_device *dev, u8 EntryNo, u8 KeyIndex, u16 KeyType, + const u8 *MacAddr, u8 DefaultKey, u32 *KeyContent); #endif diff --git a/drivers/staging/rtl8192u/r8192U_core.c b/drivers/staging/rtl8192u/r8192U_core.c index 3718d72e217e..cfbd9d79baa7 100644 --- a/drivers/staging/rtl8192u/r8192U_core.c +++ b/drivers/staging/rtl8192u/r8192U_core.c @@ -2300,12 +2300,15 @@ static int rtl8192_read_eeprom_info(struct net_device *dev) /* set channelplan from eeprom */ priv->ChannelPlan = priv->eeprom_ChannelPlan; if (bLoad_From_EEPOM) { + u8 addr[ETH_ALEN]; + for (i = 0; i < 6; i += 2) { ret = eprom_read(dev, (u16)((EEPROM_NODE_ADDRESS_BYTE_0 + i) >> 1)); if (ret < 0) return ret; - *(u16 *)(&dev->dev_addr[i]) = (u16)ret; + *(u16 *)(&addr[i]) = (u16)ret; } + eth_hw_addr_set(dev, addr); } else { eth_hw_addr_set(dev, bMac_Tmp_Addr); /* should I set IDR0 here? */ @@ -3045,14 +3048,14 @@ static void CamRestoreAllEntry(struct net_device *dev) } else if (priv->ieee80211->pairwise_key_type == KEY_TYPE_TKIP) { if (priv->ieee80211->iw_mode == IW_MODE_ADHOC) setKey(dev, 4, 0, priv->ieee80211->pairwise_key_type, - (u8 *)dev->dev_addr, 0, NULL); + (const u8 *)dev->dev_addr, 0, NULL); else setKey(dev, 4, 0, priv->ieee80211->pairwise_key_type, MacAddr, 0, NULL); } else if (priv->ieee80211->pairwise_key_type == KEY_TYPE_CCMP) { if (priv->ieee80211->iw_mode == IW_MODE_ADHOC) setKey(dev, 4, 0, priv->ieee80211->pairwise_key_type, - (u8 *)dev->dev_addr, 0, NULL); + (const u8 *)dev->dev_addr, 0, NULL); else setKey(dev, 4, 0, priv->ieee80211->pairwise_key_type, MacAddr, 0, NULL); @@ -4868,7 +4871,7 @@ void EnableHWSecurityConfig8192(struct net_device *dev) } void setKey(struct net_device *dev, u8 entryno, u8 keyindex, u16 keytype, - u8 *macaddr, u8 defaultkey, u32 *keycontent) + const u8 *macaddr, u8 defaultkey, u32 *keycontent) { u32 target_command = 0; u32 target_content = 0; -- cgit v1.2.3-70-g09d2