From ae2881896318b4d1ccc06fe53504be9d48c6e55d Mon Sep 17 00:00:00 2001 From: Sherry Sun Date: Tue, 19 Apr 2022 18:23:17 +0800 Subject: [PATCH] mxm_wifiex: fix the net_device::dev_addr build warning MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit When build the mxm17322 wifi release based on the latest kernel(L5.17), will observe the following build warning. Need to use eth_hw_addr_set function instead of writing the address directly to net_device::dev_addr. Make sure we don't cast off const qualifier from dev->dev_addr. /home/sherry/work/mwifiex/mxm_wifiex/wlan_src/mlinux/moal_uap_cfg80211.c: In function ‘woal_cfg80211_add_mon_if’: /home/sherry/work/mwifiex/mxm_wifiex/wlan_src/mlinux/moal_uap_cfg80211.c:1485:44: warning: passing argument 2 of ‘moal_memcpy_ext’ discards ‘const’ qualifier from pointer target type [-Wdiscarded-qualifiers] 1485 | moal_memcpy_ext(priv->phandle, ndev->dev_addr, ndev->perm_addr, | ~~~~^~~~~~~~~~ In file included from /home/sherry/work/mwifiex/mxm_wifiex/wlan_src/mlinux/moal_main.h:119, from /home/sherry/work/mwifiex/mxm_wifiex/wlan_src/mlinux/moal_cfg80211.h:26, from /home/sherry/work/mwifiex/mxm_wifiex/wlan_src/mlinux/moal_uap_cfg80211.c:23: /home/sherry/work/mwifiex/mxm_wifiex/wlan_src/mlinux/moal_shim.h:82:48: note: expected ‘t_void *’ {aka ‘void *’} but argument is of type ‘const unsigned char *’ 82 | t_void *moal_memcpy_ext(t_void *pmoal, t_void *pdest, const t_void *psrc, | ~~~~~~~~^~~~~ Signed-off-by: Sherry Sun --- mxm_wifiex/wlan_src/mlinux/moal_uap_cfg80211.c | 4 ++++ 1 file changed, 4 insertions(+) diff --git a/mxm_wifiex/wlan_src/mlinux/moal_uap_cfg80211.c b/mxm_wifiex/wlan_src/mlinux/moal_uap_cfg80211.c index ab739ed..27adad9 100644 --- a/mxm_wifiex/wlan_src/mlinux/moal_uap_cfg80211.c +++ b/mxm_wifiex/wlan_src/mlinux/moal_uap_cfg80211.c @@ -1482,8 +1482,12 @@ static int woal_cfg80211_add_mon_if(struct wiphy *wiphy, moal_memcpy_ext(priv->phandle, ndev->perm_addr, wiphy->perm_addr, ETH_ALEN, sizeof(ndev->perm_addr)); +#if LINUX_VERSION_CODE >= KERNEL_VERSION(5, 16, 0) + eth_hw_addr_set(ndev, ndev->perm_addr); +#else moal_memcpy_ext(priv->phandle, ndev->dev_addr, ndev->perm_addr, ETH_ALEN, MAX_ADDR_LEN); +#endif SET_NETDEV_DEV(ndev, wiphy_dev(wiphy)); ndev->ieee80211_ptr = &mon_if->wdev; mon_if->wdev.iftype = NL80211_IFTYPE_MONITOR;