Staging: drop redundant memset
authorJulia Lawall <julia@diku.dk>
Tue, 9 Mar 2010 21:15:21 +0000 (22:15 +0100)
committerGreg Kroah-Hartman <gregkh@suse.de>
Tue, 11 May 2010 18:35:34 +0000 (11:35 -0700)
The region set by the call to memset is immediately overwritten by the
subsequent call to memcpy.

The semantic patch that makes this change is as follows:
(http://coccinelle.lip6.fr/)

// <smpl>
@@
expression e1,e2,e3,e4;
@@

- memset(e1,e2,e3);
  memcpy(e1,e4,e3);
// </smpl>

Signed-off-by: Julia Lawall <julia@diku.dk>
Signed-off-by: Greg Kroah-Hartman <gregkh@suse.de>
drivers/staging/rt2860/sta/assoc.c
drivers/staging/rt2860/sta_ioctl.c
drivers/staging/rtl8192su/r819xU_cmdpkt.c
drivers/staging/rtl8192u/r819xU_cmdpkt.c
drivers/staging/vt6655/iwctl.c
drivers/staging/vt6656/iwctl.c

index 7055f229e511d9f93d8153da922d0ac7f6141f1d..6e85d5e6554b1ee6c7bd2999edf984bf80c07cfb 100644 (file)
@@ -1596,7 +1596,6 @@ BOOLEAN StaAddMacTableEntry(struct rt_rtmp_adapter *pAd,
                union iwreq_data wrqu;
                wext_notify_event_assoc(pAd);
 
-               memset(wrqu.ap_addr.sa_data, 0, MAC_ADDR_LEN);
                memcpy(wrqu.ap_addr.sa_data, pAd->MlmeAux.Bssid, MAC_ADDR_LEN);
                wireless_send_event(pAd->net_dev, SIOCGIWAP, &wrqu, NULL);
 
index 33a6939cf2ae24b24c689e4f2167895b976f14a0..112da7a6c417a9886b337f301f25af465797c346 100644 (file)
@@ -608,7 +608,6 @@ int rt_ioctl_siwap(struct net_device *dev,
        /* Prevent to connect AP again in STAMlmePeriodicExec */
        pAdapter->MlmeAux.AutoReconnectSsidLen = 32;
 
-       memset(Bssid, 0, MAC_ADDR_LEN);
        memcpy(Bssid, ap_addr->sa_data, MAC_ADDR_LEN);
        MlmeEnqueue(pAdapter,
                    MLME_CNTL_STATE_MACHINE,
index 9b377bae47b407213daada78a06d52200e90e656..43b68a02d0c135847c03db24aad2aeb06eaf2880 100644 (file)
@@ -33,7 +33,6 @@ bool SendTxCommandPacket(struct net_device *dev, void *pData, u32 DataLen)
        tcb_desc->bLastIniPkt = 0;
        skb_reserve(skb, USB_HWDESC_HEADER_LEN);
        ptr_buf = skb_put(skb, DataLen);
-       memset(ptr_buf, 0, DataLen);
        memcpy(ptr_buf, pData, DataLen);
        tcb_desc->txbuf_size = (u16)DataLen;
 
index fd19a85297a9052ab070b1d395be7b24650e8b7d..0cb28c776c49da14e829cf1315129d7c60a6def8 100644 (file)
@@ -63,7 +63,6 @@ SendTxCommandPacket(
        tcb_desc->bLastIniPkt = 0;
        skb_reserve(skb, USB_HWDESC_HEADER_LEN);
        ptr_buf = skb_put(skb, DataLen);
-       memset(ptr_buf,0,DataLen);
        memcpy(ptr_buf,pData,DataLen);
        tcb_desc->txbuf_size= (u16)DataLen;
 
index 78b49830a2551b8cdf884a7090a39ec57f8dbb1d..824466d5a659504dbe5de0db00777938b3b419ff 100644 (file)
@@ -699,7 +699,6 @@ if (pMgmt->eScanState ==  WMAC_IS_SCANNING) {
        if (wrq->sa_family != ARPHRD_ETHER)
                rc = -EINVAL;
        else {
-               memset(pMgmt->abyDesireBSSID, 0xFF, 6);
                memcpy(pMgmt->abyDesireBSSID, wrq->sa_data, 6);
                                //2008-0409-05, <Add> by Einsn Liu
                if((pDevice->bLinkPass == TRUE) &&
@@ -889,7 +888,6 @@ if (pMgmt->eScanState ==  WMAC_IS_SCANNING) {
            BYTE                   abyTmpDesireSSID[WLAN_IEHDR_LEN + WLAN_SSID_MAXLEN + 1];
          UINT            ii , uSameBssidNum=0;
 
-         memset(abyTmpDesireSSID,0,sizeof(abyTmpDesireSSID));
          memcpy(abyTmpDesireSSID,pMgmt->abyDesireSSID,sizeof(abyTmpDesireSSID));
             pCurr = BSSpSearchBSSList(pDevice,
                                       NULL,
index b7c6a22fe32191fe931d8d2aa565c846523c3e1c..d7ed3b456339c91676a597fc814da10c9f9a5e75 100644 (file)
@@ -758,7 +758,6 @@ int iwctl_siwap(struct net_device *dev,
        if (wrq->sa_family != ARPHRD_ETHER)
                rc = -EINVAL;
        else {
-               memset(pMgmt->abyDesireBSSID, 0xFF, 6);
                memcpy(pMgmt->abyDesireBSSID, wrq->sa_data, 6);
 
        //mike :add
@@ -936,7 +935,6 @@ int iwctl_siwessid(struct net_device *dev,
            BYTE                   abyTmpDesireSSID[WLAN_IEHDR_LEN + WLAN_SSID_MAXLEN + 1];
          UINT            ii , uSameBssidNum=0;
 
-         memset(abyTmpDesireSSID,0,sizeof(abyTmpDesireSSID));
          memcpy(abyTmpDesireSSID,pMgmt->abyDesireSSID,sizeof(abyTmpDesireSSID));
             pCurr = BSSpSearchBSSList(pDevice,
                                       NULL,