staging: rtl8723au: Make rtw_get_capability23a_from_ie() return __le 16 *
authorJes Sorensen <Jes.Sorensen@redhat.com>
Sat, 26 Apr 2014 16:55:41 +0000 (18:55 +0200)
committerGreg Kroah-Hartman <gregkh@linuxfoundation.org>
Sat, 26 Apr 2014 17:16:20 +0000 (10:16 -0700)
This should make sparse happier.

Reported-by: Larry Finger <Larry.Finger@lwfinger.net>
Signed-off-by: Jes Sorensen <Jes.Sorensen@redhat.com>
Signed-off-by: Greg Kroah-Hartman <gregkh@linuxfoundation.org>
drivers/staging/rtl8723au/core/rtw_ieee80211.c
drivers/staging/rtl8723au/core/rtw_mlme.c
drivers/staging/rtl8723au/include/rtw_mlme.h
drivers/staging/rtl8723au/os_dep/ioctl_cfg80211.c

index 8f91bdbc2bbff8c1b2a5efed4ea58c10c05fce91..7c899d8e6db03d248abf6acb77d4013933837fbf 100644 (file)
@@ -1004,8 +1004,8 @@ void rtw_get_bcn_info23a(struct wlan_network *pnetwork)
        unsigned int            len;
        unsigned char           *p;
 
-       memcpy(&cap, rtw_get_capability23a_from_ie(pnetwork->network.IEs), 2);
-       cap = le16_to_cpu(cap);
+       cap = get_unaligned_le16(
+               rtw_get_capability23a_from_ie(pnetwork->network.IEs));
        if (cap & WLAN_CAPABILITY_PRIVACY) {
                bencrypt = 1;
                pnetwork->network.Privacy = 1;
index 1f7f061ca1dd2f27a5168c68f9b45c01c119c871..dd42d4f5e7f104428ad06091619e40f2b05b2289 100644 (file)
@@ -333,9 +333,9 @@ void rtw23a_roaming(struct rtw_adapter *padapter,
        spin_unlock_bh(&pmlmepriv->lock);
 }
 
-u8 *rtw_get_capability23a_from_ie(u8 *ie)
+__le16 *rtw_get_capability23a_from_ie(u8 *ie)
 {
-       return ie + 8 + 2;
+       return (__le16 *)(ie + 8 + 2);
 }
 
 u16 rtw_get_capability23a(struct wlan_bssid_ex *bss)
@@ -416,11 +416,8 @@ int is_same_network23a(struct wlan_bssid_ex *src, struct wlan_bssid_ex *dst)
 {
        u16 s_cap, d_cap;
 
-       memcpy(&s_cap, rtw_get_capability23a_from_ie(src->IEs), 2);
-       memcpy(&d_cap, rtw_get_capability23a_from_ie(dst->IEs), 2);
-
-       s_cap = le16_to_cpu(s_cap);
-       d_cap = le16_to_cpu(d_cap);
+       s_cap = get_unaligned_le16(rtw_get_capability23a_from_ie(src->IEs));
+       d_cap = get_unaligned_le16(rtw_get_capability23a_from_ie(dst->IEs));
 
        return ((src->Ssid.ssid_len == dst->Ssid.ssid_len) &&
                /*      (src->Configuration.DSConfig == dst->Configuration.DSConfig) && */
index 3d6f7307e41eee4f12742e87e0b147d0816597a8..55242c2f6636f2e631d21e4bd4cc456f91a5aa1f 100644 (file)
@@ -469,7 +469,7 @@ int rtw_if_up23a(struct rtw_adapter *padapter);
 
 int rtw_linked_check(struct rtw_adapter *padapter);
 
-u8 *rtw_get_capability23a_from_ie(u8 *ie);
+__le16 *rtw_get_capability23a_from_ie(u8 *ie);
 u8 *rtw_get_beacon_interval23a_from_ie(u8 *ie);
 
 
index 221d15205b1e84deae096c279f5f86a32b2e7d4e..14331e474f0b66a57b2a01c199e6edd9c1df4c97 100644 (file)
@@ -292,7 +292,7 @@ static int rtw_cfg80211_inform_bss(struct rtw_adapter *padapter,
            le16_to_cpu(*(u16 *)
                        rtw_get_beacon_interval23a_from_ie(pnetwork->network.IEs));
        notify_capability =
-           le16_to_cpu(*(u16 *)
+               get_unaligned_le16(
                        rtw_get_capability23a_from_ie(pnetwork->network.IEs));
 
        notify_ie = pnetwork->network.IEs + _FIXED_IE_LENGTH_;