Staging: rtl8188eu: Remove unneeded return statement
PATCH v3 1/3 Staging: rtl8188eu: Remove unneeded return statement
This patch removes unnecessary return statement from a void function and hence make it more compatible.
This issue is identified by checkpatch.pl
--- drivers/staging/rtl8188eu/core/rtw_wlan_util.c | 4 ---- 1 file changed, 4 deletions(-)
drivers/staging/rtl8188eu/core/rtw_wlan_util.c +0 -4
@@ -650,8 +650,6 @@ void WMMOnAssocRsp(struct adapter *padapter) pxmitpriv->wmm_para_seq[i] = inx[i];DBG_88E ("wmm_para_seq(%d): %d\n" , i, pxmitpriv->wmm_para_seq[i]); } - -return ; }static void bwmode_update_check (struct adapter *padapter,struct ndis_802_11_var_ie *pIE)
@@ -779,7 +777,6 @@ void HT_caps_handler(struct adapter *padapter, struct ndis_802_11_var_ie *pIE)else pmlmeinfo->HT_caps.u.HT_cap_element.MCS_rate[i] &= MCS_rate_2R[i]; } -return ; }void HT_info_handler (struct adapter *padapter,struct ndis_802_11_var_ie *pIE)
@@ -800,7 +797,6 @@ void HT_info_handler(struct adapter *padapter, struct ndis_802_11_var_ie *pIE) pmlmeinfo->HT_info_enable =1 ;memcpy (&(pmlmeinfo->HT_info), pIE->data, pIE->Length); -return ; }void HTOnAssocRsp (struct adapter *padapter)
Signature · 1 line
1.9.1
PATCH v3 2/3 staging: rtl8188eu: Remove unneeded parentheses
This patch removes unneeded parentheses from a if statement for better readability.
This issue is identified by checkpatch.pl
--- drivers/staging/rtl8188eu/core/rtw_wlan_util.c | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-)
drivers/staging/rtl8188eu/core/rtw_wlan_util.c +1 -1
@@ -1297,7 +1297,7 @@ int support_short_GI(struct adapter *padapter, struct HT_caps_element *pHT_caps)if (!(pmlmeinfo->HT_enable))return _FAIL; -if ((pmlmeinfo->assoc_AP_vendor ==HT_IOT_PEER_RALINK )) +if (pmlmeinfo->assoc_AP_vendor ==HT_IOT_PEER_RALINK )return _FAIL; bit_offset = (pmlmeext->cur_bwmode &HT_CHANNEL_WIDTH_40 ) ?6 :5 ;
Signature · 1 line
1.9.1
PATCH v3 3/3 Staging: rtl8188eu: Remove redundant local variable
In reply to Somya AnandThis patch removes a redundant variable "val" and adds inline return statements. It also adds a default case to the switch statement which returns 0 to keep the logic intact.
It also removes a redundant variable "inx" and adds inline return statements.
This issue is identified by the following coccinelle script. @@
expression ret;
identifier f;
@@
-ret =
+return
f(...);
-return ret;
--- drivers/staging/rtl8188eu/core/rtw_wlan_util.c | 82 +++++++++----------------- 1 file changed, 28 insertions(+), 54 deletions(-)
drivers/staging/rtl8188eu/core/rtw_wlan_util.c +28 -54
@@ -136,47 +136,34 @@ u8 judge_network_type(struct adapter *padapter, unsigned char *rate, int ratelenstatic unsigned char ratetbl_val_2wifirate (unsigned char rate) { -unsigned char val =0 ; -switch (rate &0x7f ) {case 0 : - val =IEEE80211_CCK_RATE_1MB ; -break ; +return IEEE80211_CCK_RATE_1MB ;case 1 : - val =IEEE80211_CCK_RATE_2MB ; -break ; +return IEEE80211_CCK_RATE_2MB ;case 2 : - val =IEEE80211_CCK_RATE_5MB ; -break ; +return IEEE80211_CCK_RATE_5MB ;case 3 : - val =IEEE80211_CCK_RATE_11MB ; -break ; +return IEEE80211_CCK_RATE_11MB ;case 4 : - val =IEEE80211_OFDM_RATE_6MB ; -break ; +return IEEE80211_OFDM_RATE_6MB ;case 5 : - val =IEEE80211_OFDM_RATE_9MB ; -break ; +return IEEE80211_OFDM_RATE_9MB ;case 6 : - val =IEEE80211_OFDM_RATE_12MB ; -break ; +return IEEE80211_OFDM_RATE_12MB ;case 7 : - val =IEEE80211_OFDM_RATE_18MB ; -break ; +return IEEE80211_OFDM_RATE_18MB ;case 8 : - val =IEEE80211_OFDM_RATE_24MB ; -break ; +return IEEE80211_OFDM_RATE_24MB ;case 9 : - val =IEEE80211_OFDM_RATE_36MB ; -break ; +return IEEE80211_OFDM_RATE_36MB ;case 10 : - val =IEEE80211_OFDM_RATE_48MB ; -break ; +return IEEE80211_OFDM_RATE_48MB ;case 11 : - val =IEEE80211_OFDM_RATE_54MB ; -break ; +return IEEE80211_OFDM_RATE_54MB ; +default : +return 0 ; } -return val; }static int is_basicrate (struct adapter *padapter,unsigned char rate)
@@ -1208,49 +1195,36 @@ unsigned int is_ap_in_wep(struct adapter *padapter)static int wifirate2_ratetbl_inx (unsigned char rate) { -int inx =0 ; - rate = rate &0x7f ;switch (rate) {case 54 *2 : - inx =11 ; -break ; +return 11 ;case 48 *2 : - inx =10 ; -break ; +return 10 ;case 36 *2 : - inx =9 ; -break ; +return 9 ;case 24 *2 : - inx =8 ; -break ; +return 8 ;case 18 *2 : - inx =7 ; -break ; +return 7 ;case 12 *2 : - inx =6 ; -break ; +return 6 ;case 9 *2 : - inx =5 ; -break ; +return 5 ;case 6 *2 : - inx =4 ; -break ; +return 4 ;case 11 *2 : - inx =3 ; -break ; +return 3 ;case 11 : - inx =2 ; -break ; +return 2 ;case 2 *2 : - inx =1 ; -break ; +return 1 ;case 1 *2 : - inx =0 ; -break ; +return 0 ; +default : +return 0 ; } -return inx; }unsigned int update_basic_rate (unsigned char *ptn,unsigned int ptn_sz)
Signature · 1 line
1.9.1
Greg KH
maintainerRe: [Outreachy kernel] [PATCH v3 3/3] Staging: rtl8188eu: Remove redundant local variable
Quoted 19 lines · Somya Anand
This patch removes a redundant variable "val" and adds inline return statements. It also adds a default case to the switch statement which returns 0 to keep the logic intact.
It also removes a redundant variable "inx" and adds inline return statements.
This issue is identified by the following coccinelle script. @@
expression ret;
identifier f;
@@(quoted diff) +1
-2-ret = +return f(...); -return ret;
Quoted 3 lines
Signed-off-by Somya Anand <[email protected]>--- drivers/staging/rtl8188eu/core/rtw_wlan_util.c | 82 +++++++++-----------------
This patch also does not apply :(
Please refresh your patches against my latest staging-testing branch of staging.git on git.kernel.org and resend them.
thanks,
greg k-h
Greg KH
maintainerQuoted 9 lines · Somya Anand
This patch removes unnecessary return statement from a void function and hence make it more compatible.
This issue is identified by checkpatch.pl
Signed-off-by Somya Anand <[email protected]>--- drivers/staging/rtl8188eu/core/rtw_wlan_util.c | 4 ---- 1 file changed, 4 deletions(-)
This does not apply to my tree :(