* [PATCH v2 1/5] Staging: rtl8188eu: Remove useless local variable
2015-03-04 13:23 [PATCH v2 0/5] coccinelle and checkpatch.pl issues Somya Anand
@ 2015-03-04 13:23 ` Somya Anand
2015-03-06 23:49 ` [Outreachy kernel] " Greg KH
2015-03-04 13:23 ` [PATCH v2 2/5] Staging: rtl8188eu: Add blank line after declaration Somya Anand
` (3 subsequent siblings)
4 siblings, 1 reply; 8+ messages in thread
From: Somya Anand @ 2015-03-04 13:23 UTC (permalink / raw)
To: outreachy-kernel; +Cc: Somya Anand
This patch removes a redundant variable "raid" and adds inline
return statements.
This issue is identified by the following coccinelle script:
@@
expression ret;
identifier f;
@@
-ret =
+return
f(...);
-return ret;
Signed-off-by: Somya Anand <somyaanand214@gmail.com>
---
drivers/staging/rtl8188eu/core/rtw_wlan_util.c | 24 +++++++-----------------
1 file changed, 7 insertions(+), 17 deletions(-)
diff --git a/drivers/staging/rtl8188eu/core/rtw_wlan_util.c b/drivers/staging/rtl8188eu/core/rtw_wlan_util.c
index a3ffc69..6917abf 100644
--- a/drivers/staging/rtl8188eu/core/rtw_wlan_util.c
+++ b/drivers/staging/rtl8188eu/core/rtw_wlan_util.c
@@ -88,35 +88,25 @@ int cckratesonly_included(unsigned char *rate, int ratelen)
unsigned char networktype_to_raid(unsigned char network_type)
{
- unsigned char raid;
-
switch (network_type) {
case WIRELESS_11B:
- raid = RATR_INX_WIRELESS_B;
- break;
+ return RATR_INX_WIRELESS_B;
case WIRELESS_11A:
case WIRELESS_11G:
- raid = RATR_INX_WIRELESS_G;
- break;
+ return RATR_INX_WIRELESS_G;
case WIRELESS_11BG:
- raid = RATR_INX_WIRELESS_GB;
- break;
+ return RATR_INX_WIRELESS_GB;
case WIRELESS_11_24N:
case WIRELESS_11_5N:
- raid = RATR_INX_WIRELESS_N;
- break;
+ return RATR_INX_WIRELESS_N;
case WIRELESS_11A_5N:
case WIRELESS_11G_24N:
- raid = RATR_INX_WIRELESS_NG;
- break;
+ return RATR_INX_WIRELESS_NG;
case WIRELESS_11BG_24N:
- raid = RATR_INX_WIRELESS_NGB;
- break;
+ return RATR_INX_WIRELESS_NGB;
default:
- raid = RATR_INX_WIRELESS_GB;
- break;
+ return RATR_INX_WIRELESS_GB;
}
- return raid;
}
u8 judge_network_type(struct adapter *padapter, unsigned char *rate, int ratelen)
--
1.9.1
^ permalink raw reply related [flat|nested] 8+ messages in thread* Re: [Outreachy kernel] [PATCH v2 1/5] Staging: rtl8188eu: Remove useless local variable
2015-03-04 13:23 ` [PATCH v2 1/5] Staging: rtl8188eu: Remove useless local variable Somya Anand
@ 2015-03-06 23:49 ` Greg KH
2015-03-07 14:47 ` Somya Anand
0 siblings, 1 reply; 8+ messages in thread
From: Greg KH @ 2015-03-06 23:49 UTC (permalink / raw)
To: Somya Anand; +Cc: outreachy-kernel
On Wed, Mar 04, 2015 at 06:53:01PM +0530, Somya Anand wrote:
> This patch removes a redundant variable "raid" and adds inline
> return statements.
>
> This issue is identified by the following coccinelle script:
> @@
> expression ret;
> identifier f;
> @@
>
> -ret =
> +return
> f(...);
> -return ret;
>
> Signed-off-by: Somya Anand <somyaanand214@gmail.com>
> ---
> drivers/staging/rtl8188eu/core/rtw_wlan_util.c | 24 +++++++-----------------
> 1 file changed, 7 insertions(+), 17 deletions(-)
I think I already applied an older version of this series, right?
Please resend the portions I missed that were different from the ones I
applied.
thanks,
greg k-h
^ permalink raw reply [flat|nested] 8+ messages in thread
* Re: [Outreachy kernel] [PATCH v2 1/5] Staging: rtl8188eu: Remove useless local variable
2015-03-06 23:49 ` [Outreachy kernel] " Greg KH
@ 2015-03-07 14:47 ` Somya Anand
0 siblings, 0 replies; 8+ messages in thread
From: Somya Anand @ 2015-03-07 14:47 UTC (permalink / raw)
To: outreachy-kernel; +Cc: somyaanand214
[-- Attachment #1.1: Type: text/plain, Size: 962 bytes --]
On Saturday, March 7, 2015 at 4:26:41 PM UTC+5:30, gregkh wrote:
>
> On Wed, Mar 04, 2015 at 06:53:01PM +0530, Somya Anand wrote:
> > This patch removes a redundant variable "raid" and adds inline
> > return statements.
> >
> > This issue is identified by the following coccinelle script:
> > @@
> > expression ret;
> > identifier f;
> > @@
> >
> > -ret =
> > +return
> > f(...);
> > -return ret;
> >
> > Signed-off-by: Somya Anand <somyaa...@gmail.com <javascript:>>
> > ---
> > drivers/staging/rtl8188eu/core/rtw_wlan_util.c | 24
> +++++++-----------------
> > 1 file changed, 7 insertions(+), 17 deletions(-)
>
> I think I already applied an older version of this series, right?
> Please resend the portions I missed that were different from the ones I
> applied.
No, Greg You have missed some. Actually Julia said to me that I should
merge the patches.
Never mind, I will send them again.
>
> thanks,
>
Somya
>
>
[-- Attachment #1.2: Type: text/html, Size: 1758 bytes --]
^ permalink raw reply [flat|nested] 8+ messages in thread
* [PATCH v2 2/5] Staging: rtl8188eu: Add blank line after declaration
2015-03-04 13:23 [PATCH v2 0/5] coccinelle and checkpatch.pl issues Somya Anand
2015-03-04 13:23 ` [PATCH v2 1/5] Staging: rtl8188eu: Remove useless local variable Somya Anand
@ 2015-03-04 13:23 ` Somya Anand
2015-03-04 13:23 ` [PATCH v2 3/5] Staging: rtl8188eu: Remove unneeded return statement Somya Anand
` (2 subsequent siblings)
4 siblings, 0 replies; 8+ messages in thread
From: Somya Anand @ 2015-03-04 13:23 UTC (permalink / raw)
To: outreachy-kernel; +Cc: Somya Anand
This patch fixes checkpatch.pl warning by adding a blank line after
declaration for better readability.
Signed-off-by: Somya Anand <somyaanand214@gmail.com>
---
drivers/staging/rtl8188eu/core/rtw_wlan_util.c | 6 +++++-
1 file changed, 5 insertions(+), 1 deletion(-)
diff --git a/drivers/staging/rtl8188eu/core/rtw_wlan_util.c b/drivers/staging/rtl8188eu/core/rtw_wlan_util.c
index 6917abf..dac4246 100644
--- a/drivers/staging/rtl8188eu/core/rtw_wlan_util.c
+++ b/drivers/staging/rtl8188eu/core/rtw_wlan_util.c
@@ -101,7 +101,7 @@ unsigned char networktype_to_raid(unsigned char network_type)
return RATR_INX_WIRELESS_N;
case WIRELESS_11A_5N:
case WIRELESS_11G_24N:
- return RATR_INX_WIRELESS_NG;
+ return RATR_INX_WIRELESS_NG;
case WIRELESS_11BG_24N:
return RATR_INX_WIRELESS_NGB;
default:
@@ -398,6 +398,7 @@ int get_bsstype(unsigned short capability)
u16 get_beacon_interval(struct wlan_bssid_ex *bss)
{
__le16 val;
+
memcpy((unsigned char *)&val, rtw_get_beacon_interval_from_ie(bss->IEs), 2);
return le16_to_cpu(val);
@@ -1212,6 +1213,7 @@ 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) {
@@ -1344,6 +1346,7 @@ void set_sta_rate(struct adapter *padapter, struct sta_info *psta)
void update_tx_basic_rate(struct adapter *padapter, u8 wirelessmode)
{
unsigned char supported_rates[NDIS_802_11_LENGTH_RATES_EX];
+
memset(supported_rates, 0, NDIS_802_11_LENGTH_RATES_EX);
if ((wirelessmode & WIRELESS_11B) && (wirelessmode == WIRELESS_11B))
@@ -1368,6 +1371,7 @@ unsigned char check_assoc_AP(u8 *pframe, uint len)
struct ndis_802_11_var_ie *pIE;
u8 epigram_vendor_flag;
u8 ralink_vendor_flag;
+
epigram_vendor_flag = 0;
ralink_vendor_flag = 0;
--
1.9.1
^ permalink raw reply related [flat|nested] 8+ messages in thread* [PATCH v2 3/5] Staging: rtl8188eu: Remove unneeded return statement
2015-03-04 13:23 [PATCH v2 0/5] coccinelle and checkpatch.pl issues Somya Anand
2015-03-04 13:23 ` [PATCH v2 1/5] Staging: rtl8188eu: Remove useless local variable Somya Anand
2015-03-04 13:23 ` [PATCH v2 2/5] Staging: rtl8188eu: Add blank line after declaration Somya Anand
@ 2015-03-04 13:23 ` Somya Anand
2015-03-04 13:23 ` [PATCH v2 4/5] staging: rtl8188eu: Remove unneeded parentheses Somya Anand
2015-03-04 13:23 ` [PATCH v2 5/5] Staging: rtl8188eu: Remove redundant local variable Somya Anand
4 siblings, 0 replies; 8+ messages in thread
From: Somya Anand @ 2015-03-04 13:23 UTC (permalink / raw)
To: outreachy-kernel; +Cc: 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 <somyaanand214@gmail.com>
---
drivers/staging/rtl8188eu/core/rtw_wlan_util.c | 4 ----
1 file changed, 4 deletions(-)
diff --git a/drivers/staging/rtl8188eu/core/rtw_wlan_util.c b/drivers/staging/rtl8188eu/core/rtw_wlan_util.c
index dac4246..074f48a 100644
--- a/drivers/staging/rtl8188eu/core/rtw_wlan_util.c
+++ b/drivers/staging/rtl8188eu/core/rtw_wlan_util.c
@@ -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)
--
1.9.1
^ permalink raw reply related [flat|nested] 8+ messages in thread* [PATCH v2 4/5] staging: rtl8188eu: Remove unneeded parentheses
2015-03-04 13:23 [PATCH v2 0/5] coccinelle and checkpatch.pl issues Somya Anand
` (2 preceding siblings ...)
2015-03-04 13:23 ` [PATCH v2 3/5] Staging: rtl8188eu: Remove unneeded return statement Somya Anand
@ 2015-03-04 13:23 ` Somya Anand
2015-03-04 13:23 ` [PATCH v2 5/5] Staging: rtl8188eu: Remove redundant local variable Somya Anand
4 siblings, 0 replies; 8+ messages in thread
From: Somya Anand @ 2015-03-04 13:23 UTC (permalink / raw)
To: outreachy-kernel; +Cc: Somya Anand
This patch removes unneeded parentheses from a if statement
for better readability.
This issue is identified by checkpatch.pl
Signed-off-by: Somya Anand <somyaanand214@gmail.com>
---
drivers/staging/rtl8188eu/core/rtw_wlan_util.c | 2 +-
1 file changed, 1 insertion(+), 1 deletion(-)
diff --git a/drivers/staging/rtl8188eu/core/rtw_wlan_util.c b/drivers/staging/rtl8188eu/core/rtw_wlan_util.c
index 074f48a..d5ebd52 100644
--- a/drivers/staging/rtl8188eu/core/rtw_wlan_util.c
+++ b/drivers/staging/rtl8188eu/core/rtw_wlan_util.c
@@ -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;
--
1.9.1
^ permalink raw reply related [flat|nested] 8+ messages in thread* [PATCH v2 5/5] Staging: rtl8188eu: Remove redundant local variable
2015-03-04 13:23 [PATCH v2 0/5] coccinelle and checkpatch.pl issues Somya Anand
` (3 preceding siblings ...)
2015-03-04 13:23 ` [PATCH v2 4/5] staging: rtl8188eu: Remove unneeded parentheses Somya Anand
@ 2015-03-04 13:23 ` Somya Anand
4 siblings, 0 replies; 8+ messages in thread
From: Somya Anand @ 2015-03-04 13:23 UTC (permalink / raw)
To: outreachy-kernel; +Cc: 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;
@@
-ret =
+return
f(...);
-return ret;
Signed-off-by: Somya Anand <somyaanand214@gmail.com>
---
drivers/staging/rtl8188eu/core/rtw_wlan_util.c | 82 +++++++++-----------------
1 file changed, 28 insertions(+), 54 deletions(-)
diff --git a/drivers/staging/rtl8188eu/core/rtw_wlan_util.c b/drivers/staging/rtl8188eu/core/rtw_wlan_util.c
index d5ebd52..0bb9181 100644
--- a/drivers/staging/rtl8188eu/core/rtw_wlan_util.c
+++ b/drivers/staging/rtl8188eu/core/rtw_wlan_util.c
@@ -136,47 +136,34 @@ u8 judge_network_type(struct adapter *padapter, unsigned char *rate, int ratelen
static 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)
--
1.9.1
^ permalink raw reply related [flat|nested] 8+ messages in thread