Casting correct Endianness for __le16 variable used in assignment and
condition check.

Signed-off-by: Gnanachandran Dhanapal <gdhan...@visteon.com>
---
        v2:Since previous version of the patch had build error.This
version has no build warnings and error.
---
 drivers/staging/rtl8192e/rtllib_softmac.c |   14 +++++++++-----
 1 file changed, 9 insertions(+), 5 deletions(-)

diff --git a/drivers/staging/rtl8192e/rtllib_softmac.c 
b/drivers/staging/rtl8192e/rtllib_softmac.c
index 98afd3b..b708dce 100644
--- a/drivers/staging/rtl8192e/rtllib_softmac.c
+++ b/drivers/staging/rtl8192e/rtllib_softmac.c
@@ -1263,7 +1263,7 @@ inline struct sk_buff *rtllib_association_req(struct 
rtllib_network *beacon,
                skb_put(skb, sizeof(struct rtllib_assoc_request_frame) + 2);
 
 
-       hdr->header.frame_ctl = RTLLIB_STYPE_ASSOC_REQ;
+       hdr->header.frame_ctl =   cpu_to_le16(RTLLIB_STYPE_ASSOC_REQ);
        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);
@@ -2233,9 +2233,9 @@ inline int rtllib_rx_assoc_resp(struct rtllib_device 
*ieee, struct sk_buff *skb,
        u8 *ies;
        struct rtllib_assoc_response_frame *assoc_resp;
        struct rtllib_hdr_3addr *header = (struct rtllib_hdr_3addr *) skb->data;
-
+       u16 fc = le16_to_cpu(header->frame_ctl);
        RTLLIB_DEBUG_MGMT("received [RE]ASSOCIATION RESPONSE (%d)\n",
-                         WLAN_FC_GET_STYPE(header->frame_ctl));
+                         WLAN_FC_GET_STYPE(fc));
 
        if ((ieee->softmac_features & IEEE_SOFTMAC_ASSOCIATE) &&
             ieee->state == RTLLIB_ASSOCIATING_AUTHENTICATED &&
@@ -2384,6 +2384,7 @@ inline int rtllib_rx_auth(struct rtllib_device *ieee, 
struct sk_buff *skb,
 inline int rtllib_rx_deauth(struct rtllib_device *ieee, struct sk_buff *skb)
 {
        struct rtllib_hdr_3addr *header = (struct rtllib_hdr_3addr *) skb->data;
+       u16 fc;
 
        if (memcmp(header->addr3, ieee->current_network.bssid, ETH_ALEN) != 0)
                return 0;
@@ -2394,9 +2395,10 @@ inline int rtllib_rx_deauth(struct rtllib_device *ieee, 
struct sk_buff *skb)
        if ((ieee->softmac_features & IEEE_SOFTMAC_ASSOCIATE) &&
            ieee->state == RTLLIB_LINKED &&
            (ieee->iw_mode == IW_MODE_INFRA)) {
+               fc = le16_to_cpu(header->frame_ctl);
                netdev_info(ieee->dev,
                            "==========>received disassoc/deauth(%x) frame, 
reason code:%x\n",
-                           WLAN_FC_GET_STYPE(header->frame_ctl),
+                           WLAN_FC_GET_STYPE(fc),
                            ((struct rtllib_disassoc *)skb->data)->reason);
                ieee->state = RTLLIB_ASSOCIATING;
                ieee->softmac_stats.reassoc++;
@@ -2422,11 +2424,13 @@ inline int rtllib_rx_frame_softmac(struct rtllib_device 
*ieee,
                                   u16 stype)
 {
        struct rtllib_hdr_3addr *header = (struct rtllib_hdr_3addr *) skb->data;
+       u16 fc;
 
        if (!ieee->proto_started)
                return 0;
 
-       switch (WLAN_FC_GET_STYPE(header->frame_ctl)) {
+       fc = le16_to_cpu(header->frame_ctl);
+       switch (WLAN_FC_GET_STYPE(fc)) {
        case RTLLIB_STYPE_ASSOC_RESP:
        case RTLLIB_STYPE_REASSOC_RESP:
                if (rtllib_rx_assoc_resp(ieee, skb, rx_stats) == 1)
-- 
1.7.9.5
_______________________________________________
devel mailing list
de...@linuxdriverproject.org
http://driverdev.linuxdriverproject.org/mailman/listinfo/driverdev-devel

Reply via email to