Skip to contentSkip to conversation

staging: rtl8723bs: remove unnecessary void pointer casts

PATCH Superseded Siwanan Bungtong 3 participants 11 messages Feb 9 – Feb 10 Staging

v1 of 2 Superseded Latest is v2 →

lore
Share & tools
lore
#0 lore raw

cover staging: rtl8723bs: remove unnecessary void pointer casts

This series removes redundant (void *) casts across rtl8723bs.

C automatically converts pointers to void *, so these casts are unnecessary and add noise. Removing them improves readability and follows kernel style guidelines.

No functional changes.

Siwanan Bungtong (7):
staging: rtl8723bs: rtw_ap: remove unnecessary void * casts
staging: rtl8723bs: rtw_efuse: remove unnecessary void * casts
staging: rtl8723bs: rtw_ieee80211: remove unnecessary void * casts
staging: rtl8723bs: rtw_mlme_ext: remove unnecessary void * casts
staging: rtl8723bs: rtw_security: remove unnecessary void * casts
staging: rtl8723bs: rtl8723b_hal_init: remove unnecessary void * casts
staging: rtl8723bs: ioctl_cfg80211: remove unnecessary void * casts

 drivers/staging/rtl8723bs/core/rtw_ap.c        |  4 ++--
 drivers/staging/rtl8723bs/core/rtw_efuse.c     |  6 +++---
 drivers/staging/rtl8723bs/core/rtw_ieee80211.c |  4 ++--
 drivers/staging/rtl8723bs/core/rtw_mlme_ext.c  | 18 +++++++++---------
 drivers/staging/rtl8723bs/core/rtw_security.c  |  2 +-
 .../staging/rtl8723bs/hal/rtl8723b_hal_init.c  |  4 ++--
 .../staging/rtl8723bs/os_dep/ioctl_cfg80211.c  | 18 +++++++++---------
 7 files changed, 28 insertions(+), 28 deletions(-)
Signature · 1 line
2.52.0
#1 lore raw

PATCH 1/7 staging: rtl8723bs: rtw_ap: remove unnecessary void * casts

Remove redundant (void *) casts when calling memcpy/memset and other helpers. These casts are unnecessary since C implicitly converts to void * and they only add noise.

No functional change.

---
 drivers/staging/rtl8723bs/core/rtw_ap.c | 4 ++--
 1 file changed, 2 insertions(+), 2 deletions(-)
drivers/staging/rtl8723bs/core/rtw_ap.c +2 -2
index 67197c7d4a4d..7f09f44c7004 100644
@@ -389,7 +389,7 @@ void update_bmc_sta(struct adapter *padapter)
 
 		psta->ieee8021x_blocked = false;
 
-		memset((void *)&psta->sta_stats, 0, sizeof(struct stainfo_stats));
+		memset(&psta->sta_stats, 0, sizeof(struct stainfo_stats));
 
 		/* prepare for add_RATid */
 		supportRateNum = rtw_get_rateset_len((u8 *)&pcur_network->supported_rates);
@@ -546,7 +546,7 @@ void update_sta_info_apmode(struct adapter *padapter, struct sta_info *psta)
 
 	/* todo: init other variables */
 
-	memset((void *)&psta->sta_stats, 0, sizeof(struct stainfo_stats));
+	memset(&psta->sta_stats, 0, sizeof(struct stainfo_stats));
 
 	/* add ratid */
 	/* add_RATid(padapter, psta);//move to ap_sta_info_defer_update() */
Signature · 1 line
2.52.0
#2 lore raw

Re: [PATCH 1/7] staging: rtl8723bs: rtw_ap: remove unnecessary void * casts

Quoted 7 lines · Siwanan Bungtong

Remove redundant (void *) casts when calling memcpy/memset and other helpers. These casts are unnecessary since C implicitly converts to void * and they only add noise.

No functional change.

Hi,

You don't have to write the file name in your subject line, "staging:
rtl8723bs: ..." is preferred. Please resend this patch series with the correct formatting.

Thanks,

ET

maintainer
#3 lore raw

Re: [PATCH 1/7] staging: rtl8723bs: rtw_ap: remove unnecessary void * casts

Quoted 7 lines · Ethan Tidmore
Quoted 6 lines · Siwanan Bungtong

Remove redundant (void *) casts when calling memcpy/memset and other helpers. These casts are unnecessary since C implicitly converts to void * and they only add noise.

No functional change.

Quoted 7 lines
Quoted 1 line

Hi,

You don't have to write the file name in your subject line, "staging:
rtl8723bs: ..." is preferred. Please resend this patch series with the correct formatting.

No, for this type of series, the filename makes sense. The subjects would not be unique otherwise.

So the subjects are fine here.

thanks,

greg k-h

#4 lore raw

Re: [PATCH 1/7] staging: rtl8723bs: rtw_ap: remove unnecessary void * casts

Quoted 12 lines · Greg KH
Quoted 11 lines · Ethan Tidmore
Quoted 7 lines · Siwanan Bungtong

Remove redundant (void *) casts when calling memcpy/memset and other helpers. These casts are unnecessary since C implicitly converts to void * and they only add noise.

No functional change.

Hi,

Quoted 8 lines
Quoted 3 lines

You don't have to write the file name in your subject line, "staging:
rtl8723bs: ..." is preferred. Please resend this patch series with the correct formatting.

No, for this type of series, the filename makes sense. The subjects would not be unique otherwise.

So the subjects are fine here.

Understood, sorry about that Siwanan.

Thanks,

ET

#5 lore raw

PATCH 2/7 staging: rtl8723bs: rtw_efuse: remove unnecessary void * casts

In reply to Siwanan Bungtong

Remove redundant (void *) casts when calling memcpy/memset and other helpers. These casts are unnecessary since C implicitly converts to void * and they only add noise.

No functional change.

---
 drivers/staging/rtl8723bs/core/rtw_efuse.c | 6 +++---
 1 file changed, 3 insertions(+), 3 deletions(-)
drivers/staging/rtl8723bs/core/rtw_efuse.c +3 -3
index 98b15ca10074..d1150da50260 100644
@@ -69,7 +69,7 @@ u16		Address)
 	u32 k = 0;
 	u16 contentLen = 0;
 
-	Hal_GetEfuseDefinition(Adapter, EFUSE_WIFI, TYPE_EFUSE_REAL_CONTENT_LEN, (void *)&contentLen);
+	Hal_GetEfuseDefinition(Adapter, EFUSE_WIFI, TYPE_EFUSE_REAL_CONTENT_LEN, &contentLen);
 
 	if (Address < contentLen) {/* E-fuse 512Byte */
 		/* Write E-fuse Register address bit0~7 */
@@ -163,7 +163,7 @@ static void Efuse_ReadAllMap(struct adapter *padapter, u8 efuseType, u8 *Efuse)
 
 	Hal_EfusePowerSwitch(padapter, true);
 
-	Hal_GetEfuseDefinition(padapter, efuseType, TYPE_EFUSE_MAP_LEN, (void *)&mapLen);
+	Hal_GetEfuseDefinition(padapter, efuseType, TYPE_EFUSE_MAP_LEN, &mapLen);
 
 	Hal_ReadEFuse(padapter, efuseType, 0, mapLen, Efuse);
 
@@ -239,7 +239,7 @@ void EFUSE_ShadowMapUpdate(struct adapter *padapter, u8 efuseType)
 	struct eeprom_priv *pEEPROM = GET_EEPROM_EFUSE_PRIV(padapter);
 	u16 mapLen = 0;
 
-	Hal_GetEfuseDefinition(padapter, efuseType, TYPE_EFUSE_MAP_LEN, (void *)&mapLen);
+	Hal_GetEfuseDefinition(padapter, efuseType, TYPE_EFUSE_MAP_LEN, &mapLen);
 
 	if (pEEPROM->bautoload_fail_flag)
 		memset(pEEPROM->efuse_eeprom_data, 0xFF, mapLen);
Signature · 1 line
2.52.0
#6 lore raw

PATCH 3/7 staging: rtl8723bs: rtw_ieee80211: remove unnecessary void * casts

In reply to Siwanan Bungtong

Remove redundant (void *) casts when calling memcpy/memset and other helpers. These casts are unnecessary since C implicitly converts to void * and they only add noise.

No functional change.

---
 drivers/staging/rtl8723bs/core/rtw_ieee80211.c | 4 ++--
 1 file changed, 2 insertions(+), 2 deletions(-)
drivers/staging/rtl8723bs/core/rtw_ieee80211.c +2 -2
index 8fdeeda88a6d..d9746679a5f0 100644
@@ -108,7 +108,7 @@ int rtw_check_network_type(unsigned char *rate, int ratelen, int channel)
 u8 *rtw_set_fixed_ie(unsigned char *pbuf, unsigned int len, unsigned char *source,
 				unsigned int *frlen)
 {
-	memcpy((void *)pbuf, (void *)source, len);
+	memcpy(pbuf, source, len);
 	*frlen = *frlen + len;
 	return pbuf + len;
 }
@@ -125,7 +125,7 @@ u8 *rtw_set_ie(u8 *pbuf,
 	*(pbuf + 1) = (u8)len;
 
 	if (len > 0)
-		memcpy((void *)(pbuf + 2), (void *)source, len);
+		memcpy(pbuf + 2, source, len);
 
 	*frlen = *frlen + (len + 2);
 
Signature · 1 line
2.52.0
#7 lore raw

PATCH 4/7 staging: rtl8723bs: rtw_mlme_ext: remove unnecessary void * casts

In reply to Siwanan Bungtong

Remove redundant (void *) casts when calling memcpy/memset and other helpers. These casts are unnecessary since C implicitly converts to void * and they only add noise.

No functional change.

---
 drivers/staging/rtl8723bs/core/rtw_mlme_ext.c | 18 +++++++++---------
 1 file changed, 9 insertions(+), 9 deletions(-)
drivers/staging/rtl8723bs/core/rtw_mlme_ext.c +9 -9
index ac49bfbaa5bb..e6a0f801ee4f 100644
@@ -528,7 +528,7 @@ unsigned int OnProbeReq(struct adapter *padapter, union recv_frame *precv_frame)
 		if (is_valid_p2p_probereq)
 			goto _issue_probersp;
 
-		if ((ielen != 0 && false == !memcmp((void *)(p+2), (void *)cur->ssid.ssid, cur->ssid.ssid_length))
+		if ((ielen != 0 && false == !memcmp((p+2), cur->ssid.ssid, cur->ssid.ssid_length))
 			|| (ielen == 0 && pmlmeinfo->hidden_ssid_mode)
 		)
 			return _SUCCESS;
@@ -794,7 +794,7 @@ unsigned int OnAuth(struct adapter *padapter, union recv_frame *precv_frame)
 	} else { /*  shared system or auto authentication */
 		if (seq == 1) {
 			/* prepare for the challenging txt... */
-			memset((void *)pstat->chg_txt, 78, 128);
+			memset(pstat->chg_txt, 78, 128);
 
 			pstat->state &= ~WIFI_FW_AUTH_NULL;
 			pstat->state |= WIFI_FW_AUTH_STATE;
@@ -809,7 +809,7 @@ unsigned int OnAuth(struct adapter *padapter, union recv_frame *precv_frame)
 				goto auth_fail;
 			}
 
-			if (!memcmp((void *)(p + 2), pstat->chg_txt, 128)) {
+			if (!memcmp((p + 2), pstat->chg_txt, 128)) {
 				pstat->state &= (~WIFI_FW_AUTH_STATE);
 				pstat->state |= WIFI_FW_AUTH_SUCCESS;
 				/*  challenging txt is correct... */
@@ -896,7 +896,7 @@ unsigned int OnAuthClient(struct adapter *padapter, union recv_frame *precv_fram
 			if (!p)
 				goto authclnt_fail;
 
-			memcpy((void *)(pmlmeinfo->chg_txt), (void *)(p + 2), len);
+			memcpy(pmlmeinfo->chg_txt, p + 2, len);
 			pmlmeinfo->auth_seq = 3;
 			issue_auth(padapter, NULL, 0);
 			set_link_timer(pmlmeext, REAUTH_TO);
@@ -1010,7 +1010,7 @@ unsigned int OnAssocReq(struct adapter *padapter, union recv_frame *precv_frame)
 		goto OnAssocReqFail;
 	} else {
 		/*  check if ssid match */
-		if (memcmp((void *)(p+2), cur->ssid.ssid, cur->ssid.ssid_length))
+		if (memcmp(p+2, cur->ssid.ssid, cur->ssid.ssid_length))
 			status = WLAN_STATUS_CHALLENGE_FAIL;
 
 		if (ie_len != cur->ssid.ssid_length)
@@ -1349,7 +1349,7 @@ unsigned int OnAssocReq(struct adapter *padapter, union recv_frame *precv_frame)
 
 asoc_class2_error:
 
-	issue_deauth(padapter, (void *)GetAddr2Ptr(pframe), status);
+	issue_deauth(padapter, GetAddr2Ptr(pframe), status);
 
 	return _FAIL;
 
@@ -2736,9 +2736,9 @@ void issue_asocrsp(struct adapter *padapter, unsigned short status, struct sta_i
 	fctrl = &(pwlanhdr->frame_control);
 	*(fctrl) = 0;
 
-	memcpy((void *)GetAddr1Ptr(pwlanhdr), pstat->hwaddr, ETH_ALEN);
-	memcpy((void *)GetAddr2Ptr(pwlanhdr), myid(&(padapter->eeprompriv)), ETH_ALEN);
-	memcpy((void *)GetAddr3Ptr(pwlanhdr), get_my_bssid(&(pmlmeinfo->network)), ETH_ALEN);
+	memcpy(GetAddr1Ptr(pwlanhdr), pstat->hwaddr, ETH_ALEN);
+	memcpy(GetAddr2Ptr(pwlanhdr), myid(&(padapter->eeprompriv)), ETH_ALEN);
+	memcpy(GetAddr3Ptr(pwlanhdr), get_my_bssid(&(pmlmeinfo->network)), ETH_ALEN);
 
 
 	SetSeqNum(pwlanhdr, pmlmeext->mgnt_seq);
Signature · 1 line
2.52.0
#8 lore raw

PATCH 5/7 staging: rtl8723bs: rtw_security: remove unnecessary void * casts

In reply to Siwanan Bungtong

Remove redundant (void *) casts when calling memcpy/memset and other helpers. These casts are unnecessary since C implicitly converts to void * and they only add noise.

No functional change.

---
 drivers/staging/rtl8723bs/core/rtw_security.c | 2 +-
 1 file changed, 1 insertion(+), 1 deletion(-)
drivers/staging/rtl8723bs/core/rtw_security.c +1 -1
index 2f941ffbd465..c2860dad2576 100644
@@ -1113,7 +1113,7 @@ static signed int aes_decipher(u8 *key, uint	hdrlen,
 
 	/* start to calculate the mic */
 	if ((hdrlen + plen + 8) <= MAX_MSG_SIZE)
-		memcpy((void *)message, pframe, (hdrlen + plen + 8)); /* 8 is for ext iv len */
+		memcpy(message, pframe, (hdrlen + plen + 8)); /* 8 is for ext iv len */
 
 	pn_vector[0] = pframe[hdrlen];
 	pn_vector[1] = pframe[hdrlen + 1];
Signature · 1 line
2.52.0
#9 lore raw

PATCH 6/7 staging: rtl8723bs: rtl8723b_hal_init: remove unnecessary void * casts

In reply to Siwanan Bungtong

Remove redundant (void *) casts when calling memcpy/memset and other helpers. These casts are unnecessary since C implicitly converts to void * and they only add noise.

No functional change.

---
 drivers/staging/rtl8723bs/hal/rtl8723b_hal_init.c | 4 ++--
 1 file changed, 2 insertions(+), 2 deletions(-)
drivers/staging/rtl8723bs/hal/rtl8723b_hal_init.c +2 -2
index 57c83f332e74..7955f1ff209c 100644
@@ -1187,12 +1187,12 @@ void Hal_InitPGData(struct adapter *padapter, u8 *PROMContent)
 		if (!pEEPROM->EepromOrEfuse) {
 			/*  Read EFUSE real map to shadow. */
 			EFUSE_ShadowMapUpdate(padapter, EFUSE_WIFI);
-			memcpy((void *)PROMContent, (void *)pEEPROM->efuse_eeprom_data, HWSET_MAX_SIZE_8723B);
+			memcpy(PROMContent, pEEPROM->efuse_eeprom_data, HWSET_MAX_SIZE_8723B);
 		}
 	} else {/* autoload fail */
 		if (!pEEPROM->EepromOrEfuse)
 			EFUSE_ShadowMapUpdate(padapter, EFUSE_WIFI);
-		memcpy((void *)PROMContent, (void *)pEEPROM->efuse_eeprom_data, HWSET_MAX_SIZE_8723B);
+		memcpy(PROMContent, pEEPROM->efuse_eeprom_data, HWSET_MAX_SIZE_8723B);
 	}
 }
 
Signature · 1 line
2.52.0
#10 lore raw

PATCH 7/7 staging: rtl8723bs: ioctl_cfg80211: remove unnecessary void * casts

In reply to Siwanan Bungtong

Remove redundant (void *) casts when calling memcpy/memset and other helpers. These casts are unnecessary since C implicitly converts to void * and they only add noise.

No functional change.

---
 .../staging/rtl8723bs/os_dep/ioctl_cfg80211.c  | 18 +++++++++---------
 1 file changed, 9 insertions(+), 9 deletions(-)
drivers/staging/rtl8723bs/os_dep/ioctl_cfg80211.c +9 -9
index 60edeae1cffe..a0f9844e17d9 100644
@@ -93,7 +93,7 @@ static struct ieee80211_channel rtw_2ghz_channels[] = {
 
 static void rtw_2g_channels_init(struct ieee80211_channel *channels)
 {
-	memcpy((void *)channels, (void *)rtw_2ghz_channels,
+	memcpy(channels, rtw_2ghz_channels,
 	       sizeof(struct ieee80211_channel) * RTW_2G_CHANNELS_NUM
 	);
 }
@@ -894,7 +894,7 @@ static int cfg80211_rtw_add_key(struct wiphy *wiphy, struct net_device *ndev,
 		ret =  rtw_cfg80211_set_encryption(ndev, param, param_len);
 	} else if (check_fwstate(pmlmepriv, WIFI_AP_STATE) == true) {
 		if (mac_addr)
-			memcpy(param->sta_addr, (void *)mac_addr, ETH_ALEN);
+			memcpy(param->sta_addr, mac_addr, ETH_ALEN);
 
 		ret = rtw_cfg80211_ap_set_encryption(ndev, param, param_len);
 	} else if (check_fwstate(pmlmepriv, WIFI_ADHOC_STATE) == true
@@ -1737,7 +1737,7 @@ static int cfg80211_rtw_connect(struct wiphy *wiphy, struct net_device *ndev,
 		pwep->key_index = wep_key_idx;
 		pwep->key_index |= 0x80000000;
 
-		memcpy(pwep->key_material,  (void *)sme->key, pwep->key_length);
+		memcpy(pwep->key_material, sme->key, pwep->key_length);
 
 		if (rtw_set_802_11_add_wep(padapter, pwep) == (u8)_FAIL)
 			ret = -EOPNOTSUPP;
@@ -2086,7 +2086,7 @@ static netdev_tx_t rtw_cfg80211_monitor_if_xmit_entry(struct sk_buff *skb, struc
 
 		pframe = (u8 *)(pmgntframe->buf_addr) + TXDESC_OFFSET;
 
-		memcpy(pframe, (void *)buf, len);
+		memcpy(pframe, buf, len);
 		pattrib->pktlen = len;
 
 		pwlanhdr = (struct ieee80211_hdr *)pframe;
@@ -2261,8 +2261,8 @@ static int rtw_add_beacon(struct adapter *adapter, const u8 *head, size_t head_l
 	if (!pbuf)
 		return -ENOMEM;
 
-	memcpy(pbuf, (void *)head + 24, head_len - 24);/*  24 =beacon header len. */
-	memcpy(pbuf + head_len - 24, (void *)tail, tail_len);
+	memcpy(pbuf, head + 24, head_len - 24);/*  24 =beacon header len. */
+	memcpy(pbuf + head_len - 24, tail, tail_len);
 
 	len = head_len + tail_len - 24;
 
@@ -2299,9 +2299,9 @@ static int cfg80211_rtw_start_ap(struct wiphy *wiphy, struct net_device *ndev,
 		struct wlan_bssid_ex *pbss_network = &adapter->mlmepriv.cur_network.network;
 		struct wlan_bssid_ex *pbss_network_ext = &adapter->mlmeextpriv.mlmext_info.network;
 
-		memcpy(pbss_network->ssid.ssid, (void *)settings->ssid, settings->ssid_len);
+		memcpy(pbss_network->ssid.ssid, settings->ssid, settings->ssid_len);
 		pbss_network->ssid.ssid_length = settings->ssid_len;
-		memcpy(pbss_network_ext->ssid.ssid, (void *)settings->ssid, settings->ssid_len);
+		memcpy(pbss_network_ext->ssid.ssid, settings->ssid, settings->ssid_len);
 		pbss_network_ext->ssid.ssid_length = settings->ssid_len;
 	}
 
@@ -2494,7 +2494,7 @@ static int _cfg80211_rtw_mgmt_tx(struct adapter *padapter, u8 tx_ch, const u8 *b
 
 	pframe = (u8 *)(pmgntframe->buf_addr) + TXDESC_OFFSET;
 
-	memcpy(pframe, (void *)buf, len);
+	memcpy(pframe, buf, len);
 	pattrib->pktlen = len;
 
 	pwlanhdr = (struct ieee80211_hdr *)pframe;
Signature · 1 line
2.52.0