Staging: rtl8723bs: core: rtw_mlme_ext.c: Remove typecast in kfree
PATCH v2 1/1 Staging: rtl8723bs: core: rtw_mlme_ext.c: Remove typecast in kfree
Remove typecast in kfree, as per definition of kfree in include/linux/slab.h#L144, the parameter type of kfree is void*, and hence C compiler casts any pointer type to void*.
that is allocated with kmalloc.
---
Changes in v2:
- Modified commit log
--- drivers/staging/rtl8723bs/core/rtw_mlme_ext.c | 22 +++++++++---------- 1 file changed, 11 insertions(+), 11 deletions(-)
drivers/staging/rtl8723bs/core/rtw_mlme_ext.c +11 -11
@@ -816,7 +816,7 @@ unsigned int OnBeacon(struct adapter *padapter, union recv_frame *precv_frame)update_network (&(pmlmepriv->cur_network.network), pbss, padapter, true);rtw_get_bcn_info (&(pmlmepriv->cur_network)); } -kfree ((u8 *)pbss); +kfree (pbss); }/* check the vendor of the assoc AP */
@@ -5043,7 +5043,7 @@ void report_survey_event(struct adapter *padapter, union recv_frame *precv_frame cmdsz = (sizeof (struct survey_event ) +sizeof (struct C2HEvent_Header )); pevtcmd =rtw_zmalloc (cmdsz);if (pevtcmd ==NULL ) { -kfree ((u8 *)pcmd_obj); +kfree (pcmd_obj);return ; }
@@ -5064,8 +5064,8 @@ void report_survey_event(struct adapter *padapter, union recv_frame *precv_frame psurvey_evt = (struct survey_event *)(pevtcmd +sizeof (struct C2HEvent_Header ));if (collect_bss_info (padapter, precv_frame, (struct wlan_bssid_ex *)&psurvey_evt->bss) == _FAIL) { -kfree ((u8 *)pcmd_obj); -kfree ((u8 *)pevtcmd); +kfree (pcmd_obj); +kfree (pevtcmd);return ; }
@@ -5096,7 +5096,7 @@ void report_surveydone_event(struct adapter *padapter) cmdsz = (sizeof (struct surveydone_event ) +sizeof (struct C2HEvent_Header )); pevtcmd =rtw_zmalloc (cmdsz);if (pevtcmd ==NULL ) { -kfree ((u8 *)pcmd_obj); +kfree (pcmd_obj);return ; }
@@ -5143,7 +5143,7 @@ void report_join_res(struct adapter *padapter, int res) cmdsz = (sizeof (struct joinbss_event ) +sizeof (struct C2HEvent_Header )); pevtcmd =rtw_zmalloc (cmdsz);if (pevtcmd ==NULL ) { -kfree ((u8 *)pcmd_obj); +kfree (pcmd_obj);return ; }
@@ -5194,7 +5194,7 @@ void report_wmm_edca_update(struct adapter *padapter) cmdsz = (sizeof (struct wmm_event ) +sizeof (struct C2HEvent_Header )); pevtcmd =rtw_zmalloc (cmdsz);if (pevtcmd ==NULL ) { -kfree ((u8 *)pcmd_obj); + kfree((pcmd_obj);return ; }
@@ -5241,7 +5241,7 @@ void report_del_sta_event(struct adapter *padapter, unsigned char *MacAddr, unsi cmdsz = (sizeof (struct stadel_event ) +sizeof (struct C2HEvent_Header )); pevtcmd =rtw_zmalloc (cmdsz);if (pevtcmd ==NULL ) { -kfree ((u8 *)pcmd_obj); +kfree (pcmd_obj);return ; }
@@ -5296,7 +5296,7 @@ void report_add_sta_event(struct adapter *padapter, unsigned char *MacAddr, int cmdsz = (sizeof (struct stassoc_event ) +sizeof (struct C2HEvent_Header )); pevtcmd =rtw_zmalloc (cmdsz);if (pevtcmd ==NULL ) { -kfree ((u8 *)pcmd_obj); +kfree (pcmd_obj);return ; }
@@ -5822,7 +5822,7 @@ void survey_timer_hdl(struct timer_list *t) psurveyPara =rtw_zmalloc (sizeof (struct sitesurvey_parm ));if (psurveyPara ==NULL ) { -kfree ((unsigned char *)ph2c); +kfree (ph2c); goto exit_survey_timer_hdl; }
@@ -6589,7 +6589,7 @@ u8 set_tx_beacon_cmd(struct adapter *padapter) ptxBeacon_parm =rtw_zmalloc (sizeof (struct Tx_Beacon_param ));if (ptxBeacon_parm ==NULL ) { -kfree ((unsigned char *)ph2c); +kfree (ph2c); res = _FAIL; goto exit; }
Signature · 1 line
2.17.1
Greg KH
maintainerQuoted 66 lines · Madhumitha Prabakaran
Remove typecast in kfree, as per definition of kfree in include/linux/slab.h#L144, the parameter type of kfree is void*, and hence C compiler casts any pointer type to void*.
that is allocated with kmalloc.Signed-off-by Madhumitha Prabakaran <[email protected]>---
Changes in v2:
- Modified commit log--- drivers/staging/rtl8723bs/core/rtw_mlme_ext.c | 22 +++++++++---------- 1 file changed, 11 insertions(+), 11 deletions(-)drivers/staging/rtl8723bs/core/rtw_mlme_ext.c +6
-6@@ -816,7 +816,7 @@ unsigned int OnBeacon(struct adapter *padapter, union recv_frame *precv_frame)update_network (&(pmlmepriv->cur_network.network), pbss, padapter, true);rtw_get_bcn_info (&(pmlmepriv->cur_network)); } -kfree ((u8 *)pbss); +kfree (pbss); }/* check the vendor of the assoc AP */ @@ -5043,7 +5043,7 @@ void report_survey_event(struct adapter *padapter, union recv_frame *precv_frame cmdsz = (sizeof (struct survey_event ) +sizeof (struct C2HEvent_Header )); pevtcmd =rtw_zmalloc (cmdsz);if (pevtcmd ==NULL ) { -kfree ((u8 *)pcmd_obj); +kfree (pcmd_obj);return ; }@@ -5064,8 +5064,8 @@ void report_survey_event(struct adapter *padapter, union recv_frame *precv_frame psurvey_evt = (struct survey_event *)(pevtcmd +sizeof (struct C2HEvent_Header ));if (collect_bss_info (padapter, precv_frame, (struct wlan_bssid_ex *)&psurvey_evt->bss) == _FAIL) { -kfree ((u8 *)pcmd_obj); -kfree ((u8 *)pevtcmd); +kfree (pcmd_obj); +kfree (pevtcmd);return ; }@@ -5096,7 +5096,7 @@ void report_surveydone_event(struct adapter *padapter) cmdsz = (sizeof (struct surveydone_event ) +sizeof (struct C2HEvent_Header )); pevtcmd =rtw_zmalloc (cmdsz);if (pevtcmd ==NULL ) { -kfree ((u8 *)pcmd_obj); +kfree (pcmd_obj);return ; }@@ -5143,7 +5143,7 @@ void report_join_res(struct adapter *padapter, int res) cmdsz = (sizeof (struct joinbss_event ) +sizeof (struct C2HEvent_Header )); pevtcmd =rtw_zmalloc (cmdsz);if (pevtcmd ==NULL ) { -kfree ((u8 *)pcmd_obj); +kfree (pcmd_obj);return ; }
drivers/staging/rtl8723bs/core/rtw_mlme_ext.c void report_wmm_edca_update(struct adapter *padapter) · line 5197
Quoted 5 lines
drivers/staging/rtl8723bs/core/rtw_mlme_ext.c +1
-1@@ -5194,7 +5194,7 @@ void report_wmm_edca_update(struct adapter *padapter) cmdsz = (sizeof (struct wmm_event ) +sizeof (struct C2HEvent_Header )); pevtcmd =rtw_zmalloc (cmdsz);if (pevtcmd ==NULL ) { -kfree ((u8 *)pcmd_obj); + kfree((pcmd_obj);
ALWAYS test build your patches, otherwise you will get a grumpy maintainer when their build breaks when they apply your patch :(
This line is obviously incorrect :(
Please fix up and resend.
thanks,
greg k-h
Quoted 66 lines · Greg KH
Quoted 65 lines · Madhumitha Prabakaran
Remove typecast in kfree, as per definition of kfree in include/linux/slab.h#L144, the parameter type of kfree is void*, and hence C compiler casts any pointer type to void*.
that is allocated with kmalloc.Signed-off-by Madhumitha Prabakaran <[email protected]>---
Changes in v2:
- Modified commit log--- drivers/staging/rtl8723bs/core/rtw_mlme_ext.c | 22 +++++++++---------- 1 file changed, 11 insertions(+), 11 deletions(-)drivers/staging/rtl8723bs/core/rtw_mlme_ext.c +6
-6@@ -816,7 +816,7 @@ unsigned int OnBeacon(struct adapter *padapter, union recv_frame *precv_frame)update_network (&(pmlmepriv->cur_network.network), pbss, padapter, true);rtw_get_bcn_info (&(pmlmepriv->cur_network)); } -kfree ((u8 *)pbss); +kfree (pbss); }/* check the vendor of the assoc AP */ @@ -5043,7 +5043,7 @@ void report_survey_event(struct adapter *padapter, union recv_frame *precv_frame cmdsz = (sizeof (struct survey_event ) +sizeof (struct C2HEvent_Header )); pevtcmd =rtw_zmalloc (cmdsz);if (pevtcmd ==NULL ) { -kfree ((u8 *)pcmd_obj); +kfree (pcmd_obj);return ; }@@ -5064,8 +5064,8 @@ void report_survey_event(struct adapter *padapter, union recv_frame *precv_frame psurvey_evt = (struct survey_event *)(pevtcmd +sizeof (struct C2HEvent_Header ));if (collect_bss_info (padapter, precv_frame, (struct wlan_bssid_ex *)&psurvey_evt->bss) == _FAIL) { -kfree ((u8 *)pcmd_obj); -kfree ((u8 *)pevtcmd); +kfree (pcmd_obj); +kfree (pevtcmd);return ; }@@ -5096,7 +5096,7 @@ void report_surveydone_event(struct adapter *padapter) cmdsz = (sizeof (struct surveydone_event ) +sizeof (struct C2HEvent_Header )); pevtcmd =rtw_zmalloc (cmdsz);if (pevtcmd ==NULL ) { -kfree ((u8 *)pcmd_obj); +kfree (pcmd_obj);return ; }@@ -5143,7 +5143,7 @@ void report_join_res(struct adapter *padapter, int res) cmdsz = (sizeof (struct joinbss_event ) +sizeof (struct C2HEvent_Header )); pevtcmd =rtw_zmalloc (cmdsz);if (pevtcmd ==NULL ) { -kfree ((u8 *)pcmd_obj); +kfree (pcmd_obj);return ; }
Quoted 10 lines
drivers/staging/rtl8723bs/core/rtw_mlme_ext.c void report_wmm_edca_update(struct adapter *padapter) · line 5197
Quoted 6 lines
drivers/staging/rtl8723bs/core/rtw_mlme_ext.c +1
-1@@ -5194,7 +5194,7 @@ void report_wmm_edca_update(struct adapter *padapter) cmdsz = (sizeof (struct wmm_event ) +sizeof (struct C2HEvent_Header )); pevtcmd =rtw_zmalloc (cmdsz);if (pevtcmd ==NULL ) { -kfree ((u8 *)pcmd_obj); + kfree((pcmd_obj);ALWAYS test build your patches, otherwise you will get a grumpy maintainer when their build breaks when they apply your patch :(
Sorry, will remember it.
Quoted 4 lines
This line is obviously incorrect :(
Please fix up and resend.
Thanks
Madhumitha
Quoted 3 lines
thanks,
greg k-h