From 8f18604e6f0975fa852f43f90d5556efd67efadc Mon Sep 17 00:00:00 2001 From: Julia Lawall Date: Tue, 9 Mar 2010 22:15:21 +0100 Subject: [PATCH] Staging: drop redundant memset 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/) // @@ expression e1,e2,e3,e4; @@ - memset(e1,e2,e3); memcpy(e1,e4,e3); // Signed-off-by: Julia Lawall Signed-off-by: Greg Kroah-Hartman --- drivers/staging/rt2860/sta/assoc.c | 1 - drivers/staging/rt2860/sta_ioctl.c | 1 - drivers/staging/rtl8192su/r819xU_cmdpkt.c | 1 - drivers/staging/rtl8192u/r819xU_cmdpkt.c | 1 - drivers/staging/vt6655/iwctl.c | 2 -- drivers/staging/vt6656/iwctl.c | 2 -- 6 files changed, 8 deletions(-) diff --git a/drivers/staging/rt2860/sta/assoc.c b/drivers/staging/rt2860/sta/assoc.c index 7055f229e511..6e85d5e6554b 100644 --- a/drivers/staging/rt2860/sta/assoc.c +++ b/drivers/staging/rt2860/sta/assoc.c @@ -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); diff --git a/drivers/staging/rt2860/sta_ioctl.c b/drivers/staging/rt2860/sta_ioctl.c index 33a6939cf2ae..112da7a6c417 100644 --- a/drivers/staging/rt2860/sta_ioctl.c +++ b/drivers/staging/rt2860/sta_ioctl.c @@ -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, diff --git a/drivers/staging/rtl8192su/r819xU_cmdpkt.c b/drivers/staging/rtl8192su/r819xU_cmdpkt.c index 9b377bae47b4..43b68a02d0c1 100644 --- a/drivers/staging/rtl8192su/r819xU_cmdpkt.c +++ b/drivers/staging/rtl8192su/r819xU_cmdpkt.c @@ -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; diff --git a/drivers/staging/rtl8192u/r819xU_cmdpkt.c b/drivers/staging/rtl8192u/r819xU_cmdpkt.c index fd19a85297a9..0cb28c776c49 100644 --- a/drivers/staging/rtl8192u/r819xU_cmdpkt.c +++ b/drivers/staging/rtl8192u/r819xU_cmdpkt.c @@ -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; diff --git a/drivers/staging/vt6655/iwctl.c b/drivers/staging/vt6655/iwctl.c index 78b49830a255..824466d5a659 100644 --- a/drivers/staging/vt6655/iwctl.c +++ b/drivers/staging/vt6655/iwctl.c @@ -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, 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, diff --git a/drivers/staging/vt6656/iwctl.c b/drivers/staging/vt6656/iwctl.c index b7c6a22fe321..d7ed3b456339 100644 --- a/drivers/staging/vt6656/iwctl.c +++ b/drivers/staging/vt6656/iwctl.c @@ -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, -- 2.30.2