Skip to contentSkip to conversation

Remove redundant memset.

PATCH New Navya Sri Nizamkari 1 participant 4 messages Mar 1, 2015

Subsystems (2)
lore
Share & tools
lore
#0 lore raw

cover Remove redundant memset.

The memory area set by the call to memset is immediately overwritten by the subsequent call to memcpy. Hence, remove the redundant memset.This patchset removes that memset in all staging drivers using the following sematic patch:

@@
expression e1,e2,e3,e4;
@@
- memset(e1,e2,e3);
memcpy(e1,e4,e3);

Navya Sri Nizamkari (3):
staging: rtl8188eu: Remove memset.
staging: rtl8188eu: Remove memset.
staging: media: Remove redundant memset.

 drivers/staging/media/davinci_vpfe/dm365_ipipeif.c | 1 -
 drivers/staging/media/davinci_vpfe/dm365_resizer.c | 1 -
 drivers/staging/rtl8188eu/os_dep/mlme_linux.c      | 1 -
 3 files changed, 3 deletions(-)
Signature · 1 line
1.9.1
#1 lore raw

PATCH 1/3 staging: rtl8188eu: Remove memset.

The memory area set by the call to memset is immediately overwritten by the subsequent call to memcpy. Hence, remove that redundant memset.

---
 drivers/staging/rtl8188eu/os_dep/mlme_linux.c | 1 -
 1 file changed, 1 deletion(-)
drivers/staging/rtl8188eu/os_dep/mlme_linux.c +0 -1
index 1b892c4..eebb7d7 100644
@@ -60,7 +60,6 @@ void rtw_reset_securitypriv(struct adapter *adapter)
 		/*  We have to backup the PMK information for WiFi PMK Caching test item. */
 		/*  Backup the btkip_countermeasure information. */
 		/*  When the countermeasure is trigger, the driver have to disconnect with AP for 60 seconds. */
-		memset(&backup_pmkid[0], 0x00, sizeof(struct rt_pmkid_list) * NUM_PMKID_CACHE);
 		memcpy(&backup_pmkid[0], &adapter->securitypriv.PMKIDList[0], sizeof(struct rt_pmkid_list) * NUM_PMKID_CACHE);
 		backup_index = adapter->securitypriv.PMKIDIndex;
 		backup_counter = adapter->securitypriv.btkip_countermeasure;
Signature · 1 line
1.9.1
#2 lore raw

PATCH 2/3 staging: media: Remove memset.

In reply to Navya Sri Nizamkari

The memory area set by the call to memset is immediately overwritten by the subsequent call to memcpy. Hence, remove that redundant memset.

---
 drivers/staging/media/davinci_vpfe/dm365_resizer.c | 1 -
 1 file changed, 1 deletion(-)
drivers/staging/media/davinci_vpfe/dm365_resizer.c +0 -1
index 75e70e1..7cc8d1b 100644
@@ -907,7 +907,6 @@ resizer_set_defualt_configuration(struct vpfe_resizer_device *resizer)
 			.out_chr_pos = VPFE_IPIPE_YUV422_CHR_POS_COSITE,
 		},
 	};
-	memset(&resizer->config, 0, sizeof(struct resizer_params));
 	memcpy(&resizer->config, &rsz_default_config,
 	       sizeof(struct resizer_params));
 }
Signature · 1 line
1.9.1
#3 lore raw

PATCH 3/3 staging: media: Remove redundant memset.

In reply to Navya Sri Nizamkari

The memory area set by the call to memset is immediately overwritten by the subsequent call to memcpy. Hence, remove that redundant memset.

---
 drivers/staging/media/davinci_vpfe/dm365_ipipeif.c | 1 -
 1 file changed, 1 deletion(-)
drivers/staging/media/davinci_vpfe/dm365_ipipeif.c +0 -1
index 878abdd..ceeef18 100644
@@ -747,7 +747,6 @@ static void ipipeif_set_default_config(struct vpfe_ipipeif_device *ipipeif)
 			.clip = 4095,
 		},
 	};
-	memset(&ipipeif->config, 0, sizeof(struct ipipeif_params));
 	memcpy(&ipipeif->config, &ipipeif_defaults,
 	       sizeof(struct ipipeif_params));
 }
Signature · 1 line
1.9.1