Staging: wilc1000: host_interface: Replace memset with eth_zero_addr
authorShraddha Barke <shraddha.6596@gmail.com>
Mon, 5 Oct 2015 11:30:33 +0000 (17:00 +0530)
committerGreg Kroah-Hartman <gregkh@linuxfoundation.org>
Thu, 8 Oct 2015 09:59:17 +0000 (10:59 +0100)
Use eth_zero_addr to assign the zero address to the given address
array instead of memset when second argument is address of zero.

The Coccinelle patch used -

// <smpl>
@eth_zero_addr@
expression e;
@@

-memset(e,0x00,ETH_ALEN);
+eth_zero_addr(e);
// </smpl>

Signed-off-by: Shraddha Barke <shraddha.6596@gmail.com>
Signed-off-by: Greg Kroah-Hartman <gregkh@linuxfoundation.org>
drivers/staging/wilc1000/host_interface.c

index 80697232f7722f59b92b31c1c071efdc78e3449e..ba1d05d5e9266cf34304fb691f1d5b8e9f0bd50b 100644 (file)
@@ -6,6 +6,7 @@
 #include "coreconfigurator.h"
 #include "wilc_wlan_if.h"
 #include "wilc_msgqueue.h"
+#include <linux/etherdevice.h>
 
 extern u8 connecting;
 
@@ -1949,7 +1950,7 @@ static s32 Handle_ConnectTimeout(tstrWILC_WFIDrv *drvHandler)
                pstrWFIDrv->strWILC_UsrConnReq.pu8ConnReqIEs = NULL;
        }
 
-       memset(u8ConnectedSSID, 0, ETH_ALEN);
+       eth_zero_addr(u8ConnectedSSID);
        /*Freeing flushed join request params on connect timeout*/
        if (gu8FlushedJoinReq != NULL && gu8FlushedJoinReqDrvHandler == drvHandler) {
                kfree(gu8FlushedJoinReq);
@@ -2205,11 +2206,11 @@ static s32 Handle_RcvdGnrlAsyncInfo(tstrWILC_WFIDrv *drvHandler,
                        if ((u8MacStatus == MAC_CONNECTED) &&
                            (strConnectInfo.u16ConnectStatus != SUCCESSFUL_STATUSCODE)) {
                                PRINT_ER("Received MAC status is MAC_CONNECTED while the received status code in Asoc Resp is not SUCCESSFUL_STATUSCODE\n");
-                               memset(u8ConnectedSSID, 0, ETH_ALEN);
+                               eth_zero_addr(u8ConnectedSSID);
 
                        } else if (u8MacStatus == MAC_DISCONNECTED)    {
                                PRINT_ER("Received MAC status is MAC_DISCONNECTED\n");
-                               memset(u8ConnectedSSID, 0, ETH_ALEN);
+                               eth_zero_addr(u8ConnectedSSID);
                        }
 
                        /* TODO: mostafa: correct BSSID should be retrieved from actual BSSID received from AP */
@@ -2327,7 +2328,7 @@ static s32 Handle_RcvdGnrlAsyncInfo(tstrWILC_WFIDrv *drvHandler,
                                PRINT_ER("Connect result callback function is NULL\n");
                        }
 
-                       memset(pstrWFIDrv->au8AssociatedBSSID, 0, ETH_ALEN);
+                       eth_zero_addr(pstrWFIDrv->au8AssociatedBSSID);
 
 
                        /* Deallocation */
@@ -2789,7 +2790,7 @@ static void Handle_Disconnect(tstrWILC_WFIDrv *drvHandler)
        g_obtainingIP = false;
        host_int_set_power_mgmt(pstrWFIDrv, 0, 0);
 
-       memset(u8ConnectedSSID, 0, ETH_ALEN);
+       eth_zero_addr(u8ConnectedSSID);
 
        s32Error = send_config_pkt(SET_CFG, &strWID, 1, false,
                                   get_id_from_handler(pstrWFIDrv));
@@ -2831,7 +2832,7 @@ static void Handle_Disconnect(tstrWILC_WFIDrv *drvHandler)
 
                pstrWFIDrv->enuHostIFstate = HOST_IF_IDLE;
 
-               memset(pstrWFIDrv->au8AssociatedBSSID, 0, ETH_ALEN);
+               eth_zero_addr(pstrWFIDrv->au8AssociatedBSSID);
 
 
                /* Deallocation */