Staging: rtl8192e: Fix incorrect type in assignment in rtllib_softmac.c
authorRashika Kheria <rashika.kheria@gmail.com>
Thu, 7 Nov 2013 13:28:57 +0000 (18:58 +0530)
committerGreg Kroah-Hartman <gregkh@linuxfoundation.org>
Sun, 10 Nov 2013 20:01:35 +0000 (12:01 -0800)
This patch fixes the following Sparse warning in rtllib_softmac.c-

drivers/staging/rtl8192e/rtllib_softmac.c:298:12: warning: incorrect type in assignment (different base types)
drivers/staging/rtl8192e/rtllib_softmac.c:298:12:    expected unsigned short [unsigned] [usertype] fc
drivers/staging/rtl8192e/rtllib_softmac.c:298:12:    got restricted __le16 [usertype] frame_ctl

drivers/staging/rtl8192e/rtllib_softmac.c:810:32: warning: incorrect type in assignment (different base types)
drivers/staging/rtl8192e/rtllib_softmac.c:810:32:    expected restricted __le16 [usertype] frame_ctl
drivers/staging/rtl8192e/rtllib_softmac.c:810:32:    got int

drivers/staging/rtl8192e/rtllib_softmac.c:814:34: warning: incorrect type in assignment (different base types)
drivers/staging/rtl8192e/rtllib_softmac.c:814:34:    expected restricted __le16 [usertype] duration_id
drivers/staging/rtl8192e/rtllib_softmac.c:814:34:    got int

drivers/staging/rtl8192e/rtllib_softmac.c:821:33: warning: incorrect type in assignment (different base types)
drivers/staging/rtl8192e/rtllib_softmac.c:821:33:    expected restricted __le16 [usertype] algorithm
drivers/staging/rtl8192e/rtllib_softmac.c:821:33:    got int

drivers/staging/rtl8192e/rtllib_softmac.c:955:24: warning: incorrect type in assignment (different base types)
drivers/staging/rtl8192e/rtllib_softmac.c:955:24:    expected unsigned short [unsigned] [usertype] val16
drivers/staging/rtl8192e/rtllib_softmac.c:955:24:    got restricted __le16 [usertype] <noident>

drivers/staging/rtl8192e/rtllib_softmac.c:1263:33: warning: incorrect type in assignment (different base types)
drivers/staging/rtl8192e/rtllib_softmac.c:1263:33:    expected restricted __le16 [usertype] duration_id
drivers/staging/rtl8192e/rtllib_softmac.c:1263:33:    got int

drivers/staging/rtl8192e/rtllib_softmac.c:1282:30: warning: incorrect type in assignment (different base types)
drivers/staging/rtl8192e/rtllib_softmac.c:1282:30:    expected restricted __le16 [usertype] listen_interval
drivers/staging/rtl8192e/rtllib_softmac.c:1282:30:    got unsigned short [unsigned] [usertype] listen_interval

Signed-off-by: Rashika Kheria <rashika.kheria@gmail.com>
Reviewed-by: Peter P Waskiewicz Jr <peter.p.waskiewicz.jr@intel.com>
Signed-off-by: Greg Kroah-Hartman <gregkh@linuxfoundation.org>
drivers/staging/rtl8192e/rtllib_softmac.c

index 721ee254b820b43c91ba39a7601c69ef95c91c21..31cb858d978e7d369e65569cdaaef68840971e2b 100644 (file)
@@ -295,7 +295,7 @@ inline void softmac_ps_mgmt_xmit(struct sk_buff *skb,
        u16 fc, type, stype;
        struct cb_desc *tcb_desc = (struct cb_desc *)(skb->cb + 8);
 
-       fc = header->frame_ctl;
+       fc = le16_to_cpu(header->frame_ctl);
        type = WLAN_FC_GET_TYPE(fc);
        stype = WLAN_FC_GET_STYPE(fc);
 
@@ -807,18 +807,18 @@ inline struct sk_buff *rtllib_authentication_req(struct rtllib_network *beacon,
        auth = (struct rtllib_authentication *)
                skb_put(skb, sizeof(struct rtllib_authentication));
 
-       auth->header.frame_ctl = RTLLIB_STYPE_AUTH;
+       auth->header.frame_ctl = cpu_to_le16(RTLLIB_STYPE_AUTH);
        if (challengelen)
                auth->header.frame_ctl |= cpu_to_le16(RTLLIB_FCTL_WEP);
 
-       auth->header.duration_id = 0x013a;
+       auth->header.duration_id = cpu_to_le16(0x013a);
        memcpy(auth->header.addr1, beacon->bssid, ETH_ALEN);
        memcpy(auth->header.addr2, ieee->dev->dev_addr, ETH_ALEN);
        memcpy(auth->header.addr3, beacon->bssid, ETH_ALEN);
        if (ieee->auth_mode == 0)
                auth->algorithm = WLAN_AUTH_OPEN;
        else if (ieee->auth_mode == 1)
-               auth->algorithm = WLAN_AUTH_SHARED_KEY;
+               auth->algorithm = cpu_to_le16(WLAN_AUTH_SHARED_KEY);
        else if (ieee->auth_mode == 2)
                auth->algorithm = WLAN_AUTH_OPEN;
        auth->transaction = cpu_to_le16(ieee->associate_seq);
@@ -952,7 +952,7 @@ static struct sk_buff *rtllib_probe_resp(struct rtllib_device *ieee, u8 *dest)
                u16 val16;
                *(tag++) = MFIE_TYPE_IBSS_SET;
                *(tag++) = 2;
-                val16 = cpu_to_le16(ieee->current_network.atim_window);
+               val16 = ieee->current_network.atim_window;
                memcpy((u8 *)tag, (u8 *)&val16, 2);
                tag += 2;
        }
@@ -1260,7 +1260,7 @@ inline struct sk_buff *rtllib_association_req(struct rtllib_network *beacon,
 
 
        hdr->header.frame_ctl = RTLLIB_STYPE_ASSOC_REQ;
-       hdr->header.duration_id = 37;
+       hdr->header.duration_id = cpu_to_le16(37);
        memcpy(hdr->header.addr1, beacon->bssid, ETH_ALEN);
        memcpy(hdr->header.addr2, ieee->dev->dev_addr, ETH_ALEN);
        memcpy(hdr->header.addr3, beacon->bssid, ETH_ALEN);
@@ -1279,7 +1279,7 @@ inline struct sk_buff *rtllib_association_req(struct rtllib_network *beacon,
                hdr->capability |= cpu_to_le16(WLAN_CAPABILITY_SHORT_SLOT_TIME);
 
 
-       hdr->listen_interval = beacon->listen_interval;
+       hdr->listen_interval = cpu_to_le16(beacon->listen_interval);
 
        hdr->info_element[0].id = MFIE_TYPE_SSID;