Staging: rtl8192u: removed an unnecessary else statement
PATCH 1/1 Staging: rtl8192u: removed an unnecessary else statement
As per checkpatch warning, removed an unnecessary else statement proceeding an if statement with a return.
--- drivers/staging/rtl8192u/r8192U_dm.c | 16 +++++++--------- 1 file changed, 7 insertions(+), 9 deletions(-)
drivers/staging/rtl8192u/r8192U_dm.c +7 -9
@@ -480,15 +480,13 @@ static void dm_bandwidth_autoswitch(struct net_device *dev)if (priv->CurrentChannelBW ==HT_CHANNEL_WIDTH_20 ||!priv->ieee80211->bandwidth_auto_switch.bautoswitch_enable){return ; - }else { -if (priv->ieee80211->bandwidth_auto_switch.bforced_tx20Mhz == false){//If send packets in 40 Mhz in 20/40 -if (priv->undecorated_smoothed_pwdb <= priv->ieee80211->bandwidth_auto_switch.threshold_40Mhzto20Mhz) - priv->ieee80211->bandwidth_auto_switch.bforced_tx20Mhz = true; - }else {//in force send packets in 20 Mhz in 20/40 -if (priv->undecorated_smoothed_pwdb >= priv->ieee80211->bandwidth_auto_switch.threshold_20Mhzto40Mhz) - priv->ieee80211->bandwidth_auto_switch.bforced_tx20Mhz = false; - - } + } +if (priv->ieee80211->bandwidth_auto_switch.bforced_tx20Mhz == false){//If send packets in 40 Mhz in 20/40 +if (priv->undecorated_smoothed_pwdb <= priv->ieee80211->bandwidth_auto_switch.threshold_40Mhzto20Mhz) + priv->ieee80211->bandwidth_auto_switch.bforced_tx20Mhz = true; + }else {//in force send packets in 20 Mhz in 20/40 +if (priv->undecorated_smoothed_pwdb >= priv->ieee80211->bandwidth_auto_switch.threshold_20Mhzto40Mhz) + priv->ieee80211->bandwidth_auto_switch.bforced_tx20Mhz = false; } }// dm_BandwidthAutoSwitch
Signature · 1 line
2.1.3
Karthik,
Quoted 25 lines · Karthik Nayak
As per checkpatch warning, removed an unnecessary else statement proceeding an if statement with a return.
Signed-off-by Karthik Nayak <[email protected]>--- drivers/staging/rtl8192u/r8192U_dm.c | 16 +++++++--------- 1 file changed, 7 insertions(+), 9 deletions(-)drivers/staging/rtl8192u/r8192U_dm.c +0
-9@@ -480,15 +480,13 @@ static void dm_bandwidth_autoswitch(struct net_device *dev)if (priv->CurrentChannelBW ==HT_CHANNEL_WIDTH_20 ||!priv->ieee80211->bandwidth_auto_switch.bautoswitch_enable){return ; - }else { -if (priv->ieee80211->bandwidth_auto_switch.bforced_tx20Mhz == false){//If send packets in 40 Mhz in 20/40 -if (priv->undecorated_smoothed_pwdb <= priv->ieee80211->bandwidth_auto_switch.threshold_40Mhzto20Mhz) - priv->ieee80211->bandwidth_auto_switch.bforced_tx20Mhz = true; - }else {//in force send packets in 20 Mhz in 20/40 -if (priv->undecorated_smoothed_pwdb >= priv->ieee80211->bandwidth_auto_switch.threshold_20Mhzto40Mhz) - priv->ieee80211->bandwidth_auto_switch.bforced_tx20Mhz = false; - - }
drivers/staging/rtl8192u/r8192U_dm.c static void dm_bandwidth_autoswitch(struct net_device *dev) · line 492
Quoted 10 lines
drivers/staging/rtl8192u/r8192U_dm.c +7
-0+ } +if (priv->ieee80211->bandwidth_auto_switch.bforced_tx20Mhz == false){//If send packets in 40 Mhz in 20/40 +if (priv->undecorated_smoothed_pwdb <= priv->ieee80211->bandwidth_auto_switch.threshold_40Mhzto20Mhz) + priv->ieee80211->bandwidth_auto_switch.bforced_tx20Mhz = true; + }else {//in force send packets in 20 Mhz in 20/40 +if (priv->undecorated_smoothed_pwdb >= priv->ieee80211->bandwidth_auto_switch.threshold_20Mhzto40Mhz) + priv->ieee80211->bandwidth_auto_switch.bforced_tx20Mhz = false; } }// dm_BandwidthAutoSwitch
[...]
Wow, I don't think I have ever seen a file with so many checkpatch errors!
Instead of only fixing one instance of one error I would fix all instances of that type of error. Since the changes would be very similar it should still be easy to review.
You could even make a whole patch series with each patch fixing one type of error. Although I would keep the series to just a few at first until you are sure you are doing everything right.
Signature · 1 line
- Jeremiah Mahler
Quoted 42 lines · Jeremiah Mahler
Karthik,
Quoted 25 lines · Karthik Nayak
As per checkpatch warning, removed an unnecessary else statement proceeding an if statement with a return.
Signed-off-by Karthik Nayak <[email protected]>--- drivers/staging/rtl8192u/r8192U_dm.c | 16 +++++++--------- 1 file changed, 7 insertions(+), 9 deletions(-)drivers/staging/rtl8192u/r8192U_dm.c +0
-9@@ -480,15 +480,13 @@ static void dm_bandwidth_autoswitch(struct net_device *dev)if (priv->CurrentChannelBW ==HT_CHANNEL_WIDTH_20 ||!priv->ieee80211->bandwidth_auto_switch.bautoswitch_enable){return ; - }else { -if (priv->ieee80211->bandwidth_auto_switch.bforced_tx20Mhz == false){//If send packets in 40 Mhz in 20/40 -if (priv->undecorated_smoothed_pwdb <= priv->ieee80211->bandwidth_auto_switch.threshold_40Mhzto20Mhz) - priv->ieee80211->bandwidth_auto_switch.bforced_tx20Mhz = true; - }else {//in force send packets in 20 Mhz in 20/40 -if (priv->undecorated_smoothed_pwdb >= priv->ieee80211->bandwidth_auto_switch.threshold_20Mhzto40Mhz) - priv->ieee80211->bandwidth_auto_switch.bforced_tx20Mhz = false; - - }drivers/staging/rtl8192u/r8192U_dm.c static void dm_bandwidth_autoswitch(struct net_device *dev) · line 492
Quoted 10 lines
drivers/staging/rtl8192u/r8192U_dm.c +7
-0+ } +if (priv->ieee80211->bandwidth_auto_switch.bforced_tx20Mhz == false){//If send packets in 40 Mhz in 20/40 +if (priv->undecorated_smoothed_pwdb <= priv->ieee80211->bandwidth_auto_switch.threshold_40Mhzto20Mhz) + priv->ieee80211->bandwidth_auto_switch.bforced_tx20Mhz = true; + }else {//in force send packets in 20 Mhz in 20/40 +if (priv->undecorated_smoothed_pwdb >= priv->ieee80211->bandwidth_auto_switch.threshold_20Mhzto40Mhz) + priv->ieee80211->bandwidth_auto_switch.bforced_tx20Mhz = false; } }// dm_BandwidthAutoSwitch [...]
Wow, I don't think I have ever seen a file with so many checkpatch errors!
Quoted 8 lines
Instead of only fixing one instance of one error I would fix all instances of that type of error. Since the changes would be very similar it should still be easy to review.
You could even make a whole patch series with each patch fixing one type of error. Although I would keep the series to just a few at first until you are sure you are doing everything right.
Hello Jeremiah,
I agree, there are a lot of errors, so I fixed a single issue. This is just to get used to checkpatch system.
I can write patches to fix the other things, but I rather not. I hope you get the point.
Regards
Karthik Nayak
Karthik,
Quoted 50 lines · karthik nayak
Quoted 40 lines · Jeremiah Mahler
Karthik,
Quoted 23 lines · Karthik Nayak
As per checkpatch warning, removed an unnecessary else statement proceeding an if statement with a return.
Signed-off-by Karthik Nayak <[email protected]>--- drivers/staging/rtl8192u/r8192U_dm.c | 16 +++++++--------- 1 file changed, 7 insertions(+), 9 deletions(-)drivers/staging/rtl8192u/r8192U_dm.c +0
-8@@ -480,15 +480,13 @@ static void dm_bandwidth_autoswitch(struct net_device *dev)if (priv->CurrentChannelBW ==HT_CHANNEL_WIDTH_20 ||!priv->ieee80211->bandwidth_auto_switch.bautoswitch_enable){return ; - }else { -if (priv->ieee80211->bandwidth_auto_switch.bforced_tx20Mhz == false){//If send packets in 40 Mhz in 20/40 -if (priv->undecorated_smoothed_pwdb <= priv->ieee80211->bandwidth_auto_switch.threshold_40Mhzto20Mhz) - priv->ieee80211->bandwidth_auto_switch.bforced_tx20Mhz = true; - }else {//in force send packets in 20 Mhz in 20/40 -if (priv->undecorated_smoothed_pwdb >= priv->ieee80211->bandwidth_auto_switch.threshold_20Mhzto40Mhz) - priv->ieee80211->bandwidth_auto_switch.bforced_tx20Mhz = false; -drivers/staging/rtl8192u/r8192U_dm.c static void dm_bandwidth_autoswitch(struct net_device *dev) · line 490
Quoted 10 lines
drivers/staging/rtl8192u/r8192U_dm.c +7
-1- } + } +if (priv->ieee80211->bandwidth_auto_switch.bforced_tx20Mhz == false){//If send packets in 40 Mhz in 20/40 +if (priv->undecorated_smoothed_pwdb <= priv->ieee80211->bandwidth_auto_switch.threshold_40Mhzto20Mhz) + priv->ieee80211->bandwidth_auto_switch.bforced_tx20Mhz = true; + }else {//in force send packets in 20 Mhz in 20/40 +if (priv->undecorated_smoothed_pwdb >= priv->ieee80211->bandwidth_auto_switch.threshold_20Mhzto40Mhz) + priv->ieee80211->bandwidth_auto_switch.bforced_tx20Mhz = false; } }// dm_BandwidthAutoSwitch [...]
Wow, I don't think I have ever seen a file with so many checkpatch errors!
Quoted 8 lines
Instead of only fixing one instance of one error I would fix all instances of that type of error. Since the changes would be very similar it should still be easy to review.
You could even make a whole patch series with each patch fixing one type of error. Although I would keep the series to just a few at first until you are sure you are doing everything right.
Quoted 7 lines
Hello Jeremiah,
I agree, there are a lot of errors, so I fixed a single issue. This is just to get used to checkpatch system.
I can write patches to fix the other things, but I rather not. I hope you get the point.
Regards
Karthik Nayak
Starting small sounds like a good idea.
Signature · 1 line
- Jeremiah Mahler