staging: rtlwifi: Remove unnecessary statement.
PATCH 1/1 staging: rtlwifi: Remove unnecessary statement.
Remove unnecessary conditional statement.
Detected by Coccinelle semantic patch cond_no_effect.cocci.
--- drivers/staging/comedi/drivers/das1800.c | 8 -------- drivers/staging/rtl8723bs/core/rtw_cmd.c | 4 ---- drivers/staging/rtl8723bs/core/rtw_mlme.c | 6 ------ drivers/staging/rtl8723bs/hal/HalBtc8723b2Ant.c | 12 ------------ drivers/staging/rtl8723bs/hal/hal_btcoex.c | 2 -- drivers/staging/rtl8723bs/hal/odm_DIG.c | 3 --- drivers/staging/rtl8723bs/hal/sdio_halinit.c | 5 ----- drivers/staging/rtl8723bs/os_dep/ioctl_linux.c | 2 -- drivers/staging/rtlwifi/btcoexist/halbtc8822b1ant.c | 3 --- drivers/staging/rtlwifi/btcoexist/halbtc8822b2ant.c | 6 ------ 10 files changed, 51 deletions(-)
drivers/staging/comedi/drivers/das1800.c +0 -8
@@ -1299,14 +1299,6 @@ static int das1800_attach(struct comedi_device *dev,outb (DAC (i), dev->iobase +DAS1800_SELECT );outw (0 , dev->iobase +DAS1800_DAC ); } - }else if (board->id ==DAS1800_ID_AO ) { -/* -* 'ao' boards have waveform analog outputs that are not -* currently supported. -*/ - s->type =COMEDI_SUBD_UNUSED ; - }else { - s->type =COMEDI_SUBD_UNUSED ; }/* Digital Input subdevice */
drivers/staging/rtl8723bs/core/rtw_cmd.c +0 -4
@@ -527,10 +527,6 @@ int rtw_cmd_thread(void *context)DBG_871X (ADPT_FMT " cmd =%d process_time =%lu > 1 sec\n" ,ADPT_ARG (pcmd->padapter), pcmd->cmdcode, cmd_process_time);/* rtw_warn_on(1); */ - }else if (pcmd->cmdcode ==GEN_CMD_CODE (_Set_MLME_EVT)) { -DBG_871X (ADPT_FMT " cmd =%d, process_time =%lu > 1 sec\n" , -ADPT_ARG (pcmd->padapter), pcmd->cmdcode, cmd_process_time); -/* rtw_warn_on(1); */ }else {DBG_871X (ADPT_FMT " cmd =%d, process_time =%lu > 1 sec\n" ,ADPT_ARG (pcmd->padapter), pcmd->cmdcode, cmd_process_time);
drivers/staging/rtl8723bs/core/rtw_mlme.c +0 -6
@@ -2900,15 +2900,9 @@ void rtw_update_ht_cap(struct adapter *padapter, u8 *pie, uint ie_len, u8 channe/* remove this part because testbed AP should disable RX AMPDU */ /* phtpriv->ampdu_enable = false; */ phtpriv->ampdu_enable = true; - }else { - phtpriv->ampdu_enable = true; } - }else if (pregistrypriv->ampdu_enable ==2 ) { -/* remove this part because testbed AP should disable RX AMPDU */ -/* phtpriv->ampdu_enable = true; */ } -/* check Max Rx A-MPDU Size */ len =0 ; p =rtw_get_ie (pie+sizeof (struct ndis_802_11_fix_ie ), _HT_CAPABILITY_IE_, &len, ie_len-sizeof (struct ndis_802_11_fix_ie ));
drivers/staging/rtl8723bs/hal/HalBtc8723b2Ant.c +0 -12
@@ -1605,9 +1605,6 @@ static void halbtc8723b2ant_TdmaDurationAdjust( }else if (maxInterval ==2 ) {halbtc8723b2ant_PsTdma (pBtCoexist,NORMAL_EXEC , true,14 ); pCoexDm->psTdmaDuAdjType =14 ; - }else if (maxInterval ==3 ) { -halbtc8723b2ant_PsTdma (pBtCoexist,NORMAL_EXEC , true,15 ); - pCoexDm->psTdmaDuAdjType =15 ; }else {halbtc8723b2ant_PsTdma (pBtCoexist,NORMAL_EXEC , true,15 ); pCoexDm->psTdmaDuAdjType =15 ;
@@ -1619,9 +1616,6 @@ static void halbtc8723b2ant_TdmaDurationAdjust( }else if (maxInterval ==2 ) {halbtc8723b2ant_PsTdma (pBtCoexist,NORMAL_EXEC , true,10 ); pCoexDm->psTdmaDuAdjType =10 ; - }else if (maxInterval ==3 ) { -halbtc8723b2ant_PsTdma (pBtCoexist,NORMAL_EXEC , true,11 ); - pCoexDm->psTdmaDuAdjType =11 ; }else {halbtc8723b2ant_PsTdma (pBtCoexist,NORMAL_EXEC , true,11 ); pCoexDm->psTdmaDuAdjType =11 ;
@@ -1635,9 +1629,6 @@ static void halbtc8723b2ant_TdmaDurationAdjust( }else if (maxInterval ==2 ) {halbtc8723b2ant_PsTdma (pBtCoexist,NORMAL_EXEC , true,6 ); pCoexDm->psTdmaDuAdjType =6 ; - }else if (maxInterval ==3 ) { -halbtc8723b2ant_PsTdma (pBtCoexist,NORMAL_EXEC , true,7 ); - pCoexDm->psTdmaDuAdjType =7 ; }else {halbtc8723b2ant_PsTdma (pBtCoexist,NORMAL_EXEC , true,7 ); pCoexDm->psTdmaDuAdjType =7 ;
@@ -1649,9 +1640,6 @@ static void halbtc8723b2ant_TdmaDurationAdjust( }else if (maxInterval ==2 ) {halbtc8723b2ant_PsTdma (pBtCoexist,NORMAL_EXEC , true,2 ); pCoexDm->psTdmaDuAdjType =2 ; - }else if (maxInterval ==3 ) { -halbtc8723b2ant_PsTdma (pBtCoexist,NORMAL_EXEC , true,3 ); - pCoexDm->psTdmaDuAdjType =3 ; }else {halbtc8723b2ant_PsTdma (pBtCoexist,NORMAL_EXEC , true,3 ); pCoexDm->psTdmaDuAdjType =3 ;
drivers/staging/rtl8723bs/hal/hal_btcoex.c +0 -2
@@ -495,8 +495,6 @@ static u8 halbtcoutsrc_Get(void *pBtcContext, u8 getType, void *pOutBuf) *pU4Tmp =BTC_WIFI_BW_LEGACY ; else if (pHalData->CurrentChannelBW == CHANNEL_WIDTH_20) *pU4Tmp = BTC_WIFI_BW_HT20; - else if (pHalData->CurrentChannelBW == CHANNEL_WIDTH_40) - *pU4Tmp = BTC_WIFI_BW_HT40; else *pU4Tmp =BTC_WIFI_BW_HT40 ;/* todo */ break ;
drivers/staging/rtl8723bs/hal/odm_DIG.c +0 -3
@@ -499,9 +499,6 @@ void odm_DIGInit(void *pDM_VOID)if (pDM_Odm->BoardType & (ODM_BOARD_EXT_PA |ODM_BOARD_EXT_LNA )) { pDM_DigTable->rx_gain_range_max =DM_DIG_MAX_NIC ; pDM_DigTable->rx_gain_range_min =DM_DIG_MIN_NIC ; - }else { - pDM_DigTable->rx_gain_range_max =DM_DIG_MAX_NIC ; - pDM_DigTable->rx_gain_range_min =DM_DIG_MIN_NIC ; } }
drivers/staging/rtl8723bs/hal/sdio_halinit.c +0 -5
@@ -562,11 +562,6 @@ static void HalRxAggr8723BSdio(struct adapter *padapter)/* Timeout value is calculated by 34 / (2^n) */ valueDMATimeout =0x06 ; valueDMAPageCount =0x06 ; - }else { -/* 20130530, Isaac@SD1 suggest 3 kinds of parameter */ -/* TX/RX Balance */ - valueDMATimeout =0x06 ; - valueDMAPageCount =0x06 ; }rtw_write8 (padapter,REG_RXDMA_AGG_PG_TH +1 , valueDMATimeout);
drivers/staging/rtl8723bs/os_dep/ioctl_linux.c +0 -2
@@ -214,8 +214,6 @@ static char *translate_scan(struct adapter *padapter, }else if (ht_cap) {if (mcs_rate&0x8000 ) {/* MCS15 */ max_rate = (bw_40MHz) ? ((short_GI)?300 :270 ):((short_GI)?144 :130 ); - }else if (mcs_rate&0x0080 ) {/* MCS7 */ - max_rate = (bw_40MHz) ? ((short_GI)?150 :135 ):((short_GI)?72 :65 ); }else {/* default MCS7 */ /* DBG_871X("wx_get_scan, mcs_rate_bitmap = 0x%x\n", mcs_rate); */ max_rate = (bw_40MHz) ? ((short_GI)?150 :135 ):((short_GI)?72 :65 );
drivers/staging/rtlwifi/btcoexist/halbtc8822b1ant.c +0 -3
@@ -3365,9 +3365,6 @@ static void halbtc8822b1ant_action_wifi_connected(struct btc_coexist *btcoexist)/*sy modify case16 -> case17*/ halbtc8822b1ant_coex_table_with_type ( btcoexist,NORMAL_EXEC ,1 ); - else - halbtc8822b1ant_coex_table_with_type( - btcoexist, NORMAL_EXEC, 1); } }else {if (coex_dm->bt_status ==BT_8822B_1ANT_BT_STATUS_ACL_BUSY ) {
drivers/staging/rtlwifi/btcoexist/halbtc8822b2ant.c +0 -6
@@ -2696,12 +2696,6 @@ static void halbtc8822b2ant_action_hid(struct btc_coexist *btcoexist) NORMAL_EXEC, 4);halbtc8822b2ant_ps_tdma (btcoexist,NORMAL_EXEC , true,108 ); - }else if (wifi_bw ==0 ) {/* if 11bg mode */ - -halbtc8822b2ant_coex_table_with_type (btcoexist, -NORMAL_EXEC ,8 ); -halbtc8822b2ant_ps_tdma (btcoexist,NORMAL_EXEC , true, -111 ); }else {halbtc8822b2ant_coex_table_with_type (btcoexist,NORMAL_EXEC ,8 );
Signature · 1 line
2.7.4
Quoted 2 lines · Bhagyashri Dighole
Remove unnecessary conditional statement.
Detected by Coccinelle semantic patchcond_no_effect.cocci.
I have the impression that these are all done incorrectly. If you have
if (x)
thing();
else
thing();
it should not become
if (x)
thing();
It should become
thing();
alone with no if.
In many of these cases, it seems like the if encodes some information about the device, and in some cases some information that needs to be taken into account but remains a TODO. If the information is not apparent in some other way, then it might be better to keep the code as is,
julia
Quoted 210 lines
Signed-off-by Bhagyashri Dighole <[email protected]>--- drivers/staging/comedi/drivers/das1800.c | 8 -------- drivers/staging/rtl8723bs/core/rtw_cmd.c | 4 ---- drivers/staging/rtl8723bs/core/rtw_mlme.c | 6 ------ drivers/staging/rtl8723bs/hal/HalBtc8723b2Ant.c | 12 ------------ drivers/staging/rtl8723bs/hal/hal_btcoex.c | 2 -- drivers/staging/rtl8723bs/hal/odm_DIG.c | 3 --- drivers/staging/rtl8723bs/hal/sdio_halinit.c | 5 ----- drivers/staging/rtl8723bs/os_dep/ioctl_linux.c | 2 -- drivers/staging/rtlwifi/btcoexist/halbtc8822b1ant.c | 3 --- drivers/staging/rtlwifi/btcoexist/halbtc8822b2ant.c | 6 ------ 10 files changed, 51 deletions(-)drivers/staging/comedi/drivers/das1800.c +0
-8@@ -1299,14 +1299,6 @@ static int das1800_attach(struct comedi_device *dev,outb (DAC (i), dev->iobase +DAS1800_SELECT );outw (0 , dev->iobase +DAS1800_DAC ); } - }else if (board->id ==DAS1800_ID_AO ) { -/* -* 'ao' boards have waveform analog outputs that are not -* currently supported. -*/ - s->type =COMEDI_SUBD_UNUSED ; - }else { - s->type =COMEDI_SUBD_UNUSED ; }/* Digital Input subdevice */ drivers/staging/rtl8723bs/core/rtw_cmd.c +0
-4@@ -527,10 +527,6 @@ int rtw_cmd_thread(void *context)DBG_871X (ADPT_FMT " cmd =%d process_time =%lu > 1 sec\n" ,ADPT_ARG (pcmd->padapter), pcmd->cmdcode, cmd_process_time);/* rtw_warn_on(1); */ - }else if (pcmd->cmdcode ==GEN_CMD_CODE (_Set_MLME_EVT)) { -DBG_871X (ADPT_FMT " cmd =%d, process_time =%lu > 1 sec\n" , -ADPT_ARG (pcmd->padapter), pcmd->cmdcode, cmd_process_time); -/* rtw_warn_on(1); */ }else {DBG_871X (ADPT_FMT " cmd =%d, process_time =%lu > 1 sec\n" ,ADPT_ARG (pcmd->padapter), pcmd->cmdcode, cmd_process_time);drivers/staging/rtl8723bs/core/rtw_mlme.c +0
-6@@ -2900,15 +2900,9 @@ void rtw_update_ht_cap(struct adapter *padapter, u8 *pie, uint ie_len, u8 channe/* remove this part because testbed AP should disable RX AMPDU */ /* phtpriv->ampdu_enable = false; */ phtpriv->ampdu_enable = true; - }else { - phtpriv->ampdu_enable = true; } - }else if (pregistrypriv->ampdu_enable ==2 ) { -/* remove this part because testbed AP should disable RX AMPDU */ -/* phtpriv->ampdu_enable = true; */ } -/* check Max Rx A-MPDU Size */ len =0 ; p =rtw_get_ie (pie+sizeof (struct ndis_802_11_fix_ie ), _HT_CAPABILITY_IE_, &len, ie_len-sizeof (struct ndis_802_11_fix_ie ));drivers/staging/rtl8723bs/hal/HalBtc8723b2Ant.c +0
-12@@ -1605,9 +1605,6 @@ static void halbtc8723b2ant_TdmaDurationAdjust( }else if (maxInterval ==2 ) {halbtc8723b2ant_PsTdma (pBtCoexist,NORMAL_EXEC , true,14 ); pCoexDm->psTdmaDuAdjType =14 ; - }else if (maxInterval ==3 ) { -halbtc8723b2ant_PsTdma (pBtCoexist,NORMAL_EXEC , true,15 ); - pCoexDm->psTdmaDuAdjType =15 ; }else {halbtc8723b2ant_PsTdma (pBtCoexist,NORMAL_EXEC , true,15 ); pCoexDm->psTdmaDuAdjType =15 ;@@ -1619,9 +1616,6 @@ static void halbtc8723b2ant_TdmaDurationAdjust( }else if (maxInterval ==2 ) {halbtc8723b2ant_PsTdma (pBtCoexist,NORMAL_EXEC , true,10 ); pCoexDm->psTdmaDuAdjType =10 ; - }else if (maxInterval ==3 ) { -halbtc8723b2ant_PsTdma (pBtCoexist,NORMAL_EXEC , true,11 ); - pCoexDm->psTdmaDuAdjType =11 ; }else {halbtc8723b2ant_PsTdma (pBtCoexist,NORMAL_EXEC , true,11 ); pCoexDm->psTdmaDuAdjType =11 ;@@ -1635,9 +1629,6 @@ static void halbtc8723b2ant_TdmaDurationAdjust( }else if (maxInterval ==2 ) {halbtc8723b2ant_PsTdma (pBtCoexist,NORMAL_EXEC , true,6 ); pCoexDm->psTdmaDuAdjType =6 ; - }else if (maxInterval ==3 ) { -halbtc8723b2ant_PsTdma (pBtCoexist,NORMAL_EXEC , true,7 ); - pCoexDm->psTdmaDuAdjType =7 ; }else {halbtc8723b2ant_PsTdma (pBtCoexist,NORMAL_EXEC , true,7 ); pCoexDm->psTdmaDuAdjType =7 ;@@ -1649,9 +1640,6 @@ static void halbtc8723b2ant_TdmaDurationAdjust( }else if (maxInterval ==2 ) {halbtc8723b2ant_PsTdma (pBtCoexist,NORMAL_EXEC , true,2 ); pCoexDm->psTdmaDuAdjType =2 ; - }else if (maxInterval ==3 ) { -halbtc8723b2ant_PsTdma (pBtCoexist,NORMAL_EXEC , true,3 ); - pCoexDm->psTdmaDuAdjType =3 ; }else {halbtc8723b2ant_PsTdma (pBtCoexist,NORMAL_EXEC , true,3 ); pCoexDm->psTdmaDuAdjType =3 ;drivers/staging/rtl8723bs/hal/hal_btcoex.c +0
-2@@ -495,8 +495,6 @@ static u8 halbtcoutsrc_Get(void *pBtcContext, u8 getType, void *pOutBuf) *pU4Tmp =BTC_WIFI_BW_LEGACY ; else if (pHalData->CurrentChannelBW == CHANNEL_WIDTH_20) *pU4Tmp = BTC_WIFI_BW_HT20; - else if (pHalData->CurrentChannelBW == CHANNEL_WIDTH_40) - *pU4Tmp = BTC_WIFI_BW_HT40; else *pU4Tmp =BTC_WIFI_BW_HT40 ;/* todo */ break ;drivers/staging/rtl8723bs/hal/odm_DIG.c +0
-3@@ -499,9 +499,6 @@ void odm_DIGInit(void *pDM_VOID)if (pDM_Odm->BoardType & (ODM_BOARD_EXT_PA |ODM_BOARD_EXT_LNA )) { pDM_DigTable->rx_gain_range_max =DM_DIG_MAX_NIC ; pDM_DigTable->rx_gain_range_min =DM_DIG_MIN_NIC ; - }else { - pDM_DigTable->rx_gain_range_max =DM_DIG_MAX_NIC ; - pDM_DigTable->rx_gain_range_min =DM_DIG_MIN_NIC ; } }drivers/staging/rtl8723bs/hal/sdio_halinit.c +0
-5@@ -562,11 +562,6 @@ static void HalRxAggr8723BSdio(struct adapter *padapter)/* Timeout value is calculated by 34 / (2^n) */ valueDMATimeout =0x06 ; valueDMAPageCount =0x06 ; - }else { -/* 20130530, Isaac@SD1 suggest 3 kinds of parameter */ -/* TX/RX Balance */ - valueDMATimeout =0x06 ; - valueDMAPageCount =0x06 ; }rtw_write8 (padapter,REG_RXDMA_AGG_PG_TH +1 , valueDMATimeout);drivers/staging/rtl8723bs/os_dep/ioctl_linux.c +0
-2@@ -214,8 +214,6 @@ static char *translate_scan(struct adapter *padapter, }else if (ht_cap) {if (mcs_rate&0x8000 ) {/* MCS15 */ max_rate = (bw_40MHz) ? ((short_GI)?300 :270 ):((short_GI)?144 :130 ); - }else if (mcs_rate&0x0080 ) {/* MCS7 */ - max_rate = (bw_40MHz) ? ((short_GI)?150 :135 ):((short_GI)?72 :65 ); }else {/* default MCS7 */ /* DBG_871X("wx_get_scan, mcs_rate_bitmap = 0x%x\n", mcs_rate); */ max_rate = (bw_40MHz) ? ((short_GI)?150 :135 ):((short_GI)?72 :65 );drivers/staging/rtlwifi/btcoexist/halbtc8822b1ant.c +0
-3@@ -3365,9 +3365,6 @@ static void halbtc8822b1ant_action_wifi_connected(struct btc_coexist *btcoexist)/*sy modify case16 -> case17*/ halbtc8822b1ant_coex_table_with_type ( btcoexist,NORMAL_EXEC ,1 ); - else - halbtc8822b1ant_coex_table_with_type( - btcoexist, NORMAL_EXEC, 1); } }else {if (coex_dm->bt_status ==BT_8822B_1ANT_BT_STATUS_ACL_BUSY ) {drivers/staging/rtlwifi/btcoexist/halbtc8822b2ant.c +0
-7@@ -2696,12 +2696,6 @@ static void halbtc8822b2ant_action_hid(struct btc_coexist *btcoexist) NORMAL_EXEC, 4);halbtc8822b2ant_ps_tdma (btcoexist,NORMAL_EXEC , true,108 ); - }else if (wifi_bw ==0 ) {/* if 11bg mode */ - -halbtc8822b2ant_coex_table_with_type (btcoexist, -NORMAL_EXEC ,8 ); -halbtc8822b2ant_ps_tdma (btcoexist,NORMAL_EXEC , true, -111 ); }else {halbtc8822b2ant_coex_table_with_type (btcoexist,NORMAL_EXEC ,8 ); --2.7.4
--
You received this message because you are subscribed to the Google Groups "outreachy-kernel" group.
To unsubscribe from this group and stop receiving emails from it, send an email to [email protected]. To post to this group, send email to [email protected].
To view this discussion on the web visit https://groups.google.com/d/msgid/outreachy-kernel/1552809479-10739-1-git-send-email-digholebhagyashri%40gmail.com.
For more options, visit https://groups.google.com/d/optout.
Greg Kroah-Hartman
maintainerQuoted 4 lines · Bhagyashri Dighole
Remove unnecessary conditional statement.
Detected by Coccinelle semantic patchcond_no_effect.cocci.Signed-off-by Bhagyashri Dighole <[email protected]>
Quoted 11 lines
--- drivers/staging/comedi/drivers/das1800.c | 8 -------- drivers/staging/rtl8723bs/core/rtw_cmd.c | 4 ---- drivers/staging/rtl8723bs/core/rtw_mlme.c | 6 ------ drivers/staging/rtl8723bs/hal/HalBtc8723b2Ant.c | 12 ------------ drivers/staging/rtl8723bs/hal/hal_btcoex.c | 2 -- drivers/staging/rtl8723bs/hal/odm_DIG.c | 3 --- drivers/staging/rtl8723bs/hal/sdio_halinit.c | 5 ----- drivers/staging/rtl8723bs/os_dep/ioctl_linux.c | 2 -- drivers/staging/rtlwifi/btcoexist/halbtc8822b1ant.c | 3 --- drivers/staging/rtlwifi/btcoexist/halbtc8822b2ant.c | 6 ------
You changed a lot more than just the rtlwifi driver here in this single patch :(