Commit 285b7c00 authored by Mateusz Kulikowski's avatar Mateusz Kulikowski Committed by Greg Kroah-Hartman

staging: rtl8192e: Fix UNNECESSARY_ELSE warning

Fix checkpatch warnings 'else is not generally useful after a break or return'
Signed-off-by: default avatarMateusz Kulikowski <mateusz.kulikowski@gmail.com>
Signed-off-by: default avatarGreg Kroah-Hartman <gregkh@linuxfoundation.org>
parent 28eb1f3b
......@@ -2025,6 +2025,7 @@ bool rtl8192_rx_query_status_desc(struct net_device *dev,
struct sk_buff *skb)
{
struct r8192_priv *priv = rtllib_priv(dev);
struct rx_fwinfo *pDrvInfo = NULL;
stats->bICV = pdesc->ICV;
stats->bCRC = pdesc->CRC32;
......@@ -2046,8 +2047,7 @@ bool rtl8192_rx_query_status_desc(struct net_device *dev,
priv->stats.rxcrcerrmid++;
}
return false;
} else {
struct rx_fwinfo *pDrvInfo = NULL;
}
stats->RxDrvInfoSize = pdesc->RxDrvInfoSize;
stats->RxBufShift = ((pdesc->Shift)&0x03);
......@@ -2090,7 +2090,6 @@ bool rtl8192_rx_query_status_desc(struct net_device *dev,
stats->fragoffset = 0;
stats->ntotalfrag = 1;
return true;
}
}
void rtl8192_halt_adapter(struct net_device *dev, bool reset)
......@@ -2314,7 +2313,6 @@ bool rtl8192_HalRxCheckStuck(struct net_device *dev)
(priv->undecorated_smoothed_pwdb >= RateAdaptiveTH_Low_20M)))) {
if (rx_chk_cnt < 2)
return bStuck;
else
rx_chk_cnt = 0;
} else if ((((priv->CurrentChannelBW != HT_CHANNEL_WIDTH_20) &&
(priv->undecorated_smoothed_pwdb < RateAdaptiveTH_Low_40M)) ||
......@@ -2323,12 +2321,10 @@ bool rtl8192_HalRxCheckStuck(struct net_device *dev)
priv->undecorated_smoothed_pwdb >= VeryLowRSSI) {
if (rx_chk_cnt < 4)
return bStuck;
else
rx_chk_cnt = 0;
} else {
if (rx_chk_cnt < 8)
return bStuck;
else
rx_chk_cnt = 0;
}
......
......@@ -940,14 +940,12 @@ static u8 rtl8192_phy_SwChnlStepByStep(struct net_device *dev, u8 channel,
}
if (CurrentCmd && CurrentCmd->CmdID == CmdID_End) {
if ((*stage) == 2) {
if ((*stage) == 2)
return true;
} else {
(*stage)++;
(*step) = 0;
continue;
}
}
if (!CurrentCmd)
continue;
......
......@@ -116,13 +116,12 @@ void setKey(struct net_device *dev, u8 EntryNo, u8 KeyIndex, u16 KeyType,
RT_TRACE(COMP_ERR, "%s(): RF is OFF.\n",
__func__);
return;
} else {
}
down(&priv->rtllib->ips_sem);
IPSLeave(dev);
up(&priv->rtllib->ips_sem);
}
}
}
priv->rtllib->is_set_key = true;
if (EntryNo >= TOTAL_CAM_ENTRY)
RT_TRACE(COMP_ERR, "cam entry exceeds in setKey()\n");
......
......@@ -204,9 +204,9 @@ u8 read_nic_io_byte(struct net_device *dev, int x)
bool bIsLegalPage = false;
u8 Data = 0;
if (u4bPage == 0) {
if (u4bPage == 0)
return 0xff&inb(dev->base_addr + x);
} else {
bIsLegalPage = PlatformIOCheckPageLegalAndGetRegMask(u4bPage,
&u1PageMask);
if (bIsLegalPage) {
......@@ -217,7 +217,6 @@ u8 read_nic_io_byte(struct net_device *dev, int x)
Data = read_nic_io_byte(dev, (x & 0xff));
write_nic_io_byte(dev, PSR, (u1bPsr & u1PageMask));
}
}
return Data;
}
......@@ -229,9 +228,8 @@ u16 read_nic_io_word(struct net_device *dev, int x)
bool bIsLegalPage = false;
u16 Data = 0;
if (u4bPage == 0) {
if (u4bPage == 0)
return inw(dev->base_addr + x);
} else {
bIsLegalPage = PlatformIOCheckPageLegalAndGetRegMask(u4bPage,
&u1PageMask);
if (bIsLegalPage) {
......@@ -241,8 +239,6 @@ u16 read_nic_io_word(struct net_device *dev, int x)
(u8)u4bPage));
Data = read_nic_io_word(dev, (x & 0xff));
write_nic_io_byte(dev, PSR, (u1bPsr & u1PageMask));
}
}
return Data;
......@@ -255,9 +251,8 @@ u32 read_nic_io_dword(struct net_device *dev, int x)
bool bIsLegalPage = false;
u32 Data = 0;
if (u4bPage == 0) {
if (u4bPage == 0)
return inl(dev->base_addr + x);
} else {
bIsLegalPage = PlatformIOCheckPageLegalAndGetRegMask(u4bPage,
&u1PageMask);
if (bIsLegalPage) {
......@@ -267,8 +262,6 @@ u32 read_nic_io_dword(struct net_device *dev, int x)
(u8)u4bPage));
Data = read_nic_io_dword(dev, (x & 0xff));
write_nic_io_byte(dev, PSR, (u1bPsr & u1PageMask));
}
}
return Data;
......@@ -1331,10 +1324,10 @@ static short rtl8192_init(struct net_device *dev)
dev->name, dev)) {
netdev_err(dev, "Error allocating IRQ %d", dev->irq);
return -1;
} else {
}
priv->irq = dev->irq;
RT_TRACE(COMP_INIT, "IRQ %d\n", dev->irq);
}
if (rtl8192_pci_initdescring(dev) != 0) {
netdev_err(dev, "Endopoints initialization failed");
......@@ -1932,7 +1925,8 @@ int rtl8192_hard_start_xmit(struct sk_buff *skb, struct net_device *dev)
if (queue_index == TXCMD_QUEUE) {
rtl8192_tx_cmd(dev, skb);
return 0;
} else {
}
tcb_desc->RATRIndex = 7;
tcb_desc->bTxDisableRateFallBack = 1;
tcb_desc->bTxUseDriverAssingedRate = 1;
......@@ -1941,8 +1935,6 @@ int rtl8192_hard_start_xmit(struct sk_buff *skb, struct net_device *dev)
ret = rtl8192_tx(dev, skb);
if (ret != 0)
kfree_skb(skb);
}
return ret;
}
......@@ -2338,12 +2330,10 @@ static void rtl8192_rx_normal(struct net_device *dev)
[priv->rx_idx[rx_queue_idx]];
struct sk_buff *skb = priv->rx_buf[rx_queue_idx]
[priv->rx_idx[rx_queue_idx]];
if (pdesc->OWN) {
return;
} else {
struct sk_buff *new_skb;
if (pdesc->OWN)
return;
if (!priv->ops->rx_query_status_descriptor(dev, &stats,
pdesc, skb))
goto done;
......@@ -2408,7 +2398,6 @@ static void rtl8192_rx_normal(struct net_device *dev)
dev_kfree_skb_any(skb);
return;
}
}
done:
pdesc->BufferAddress = *((dma_addr_t *)skb->cb);
pdesc->OWN = 1;
......
......@@ -378,9 +378,8 @@ static void dm_bandwidth_autoswitch(struct net_device *dev)
struct r8192_priv *priv = rtllib_priv(dev);
if (priv->CurrentChannelBW == HT_CHANNEL_WIDTH_20 ||
!priv->rtllib->bandwidth_auto_switch.bautoswitch_enable) {
!priv->rtllib->bandwidth_auto_switch.bautoswitch_enable)
return;
} else {
if (priv->rtllib->bandwidth_auto_switch.bforced_tx20Mhz == false) {
if (priv->undecorated_smoothed_pwdb <=
priv->rtllib->bandwidth_auto_switch.threshold_40Mhzto20Mhz)
......@@ -389,8 +388,6 @@ static void dm_bandwidth_autoswitch(struct net_device *dev)
if (priv->undecorated_smoothed_pwdb >=
priv->rtllib->bandwidth_auto_switch.threshold_20Mhzto40Mhz)
priv->rtllib->bandwidth_auto_switch.bforced_tx20Mhz = false;
}
}
}
......@@ -581,7 +578,7 @@ static void dm_TXPowerTrackingCallback_TSSI(struct net_device *dev)
"priv->CCKPresentAttentuation = %d\n",
priv->CCKPresentAttentuation);
return;
} else {
}
if (Avg_TSSI_Meas_from_driver < TSSI_13dBm - E_FOR_TX_POWER_TRACK) {
if (RF_Type == RF_2T4R) {
......@@ -722,7 +719,7 @@ static void dm_TXPowerTrackingCallback_TSSI(struct net_device *dev)
RT_TRACE(COMP_POWER_TRACKING, "tx power track--->limited\n");
return;
}
}
write_nic_byte(dev, Pw_Track_Flag, 0);
Avg_TSSI_Meas_from_driver = 0;
for (k = 0; k < 5; k++)
......@@ -1401,14 +1398,13 @@ static void dm_CheckTXPowerTracking_ThermalMeter(struct net_device *dev)
TxPowerCheckCnt = 5;
else
TxPowerCheckCnt = 2;
if (!priv->btxpower_tracking) {
if (!priv->btxpower_tracking)
return;
} else {
if (priv->txpower_count <= TxPowerCheckCnt) {
priv->txpower_count++;
return;
}
}
if (!TM_Trigger) {
{
......@@ -1419,15 +1415,12 @@ static void dm_CheckTXPowerTracking_ThermalMeter(struct net_device *dev)
}
TM_Trigger = 1;
return;
} else {
netdev_info(dev,
"===============>Schedule TxPowerTrackingWorkItem\n");
}
netdev_info(dev, "===============>Schedule TxPowerTrackingWorkItem\n");
queue_delayed_work_rsl(priv->priv_wq, &priv->txpower_tracking_wq, 0);
TM_Trigger = 0;
}
}
}
static void dm_check_txpower_tracking(struct net_device *dev)
{
......@@ -1835,7 +1828,6 @@ static void dm_ctrl_initgain_byrssi_by_fwfalse_alarm(
if (dm_digtable.dig_state == DM_STA_DIG_OFF &&
(priv->reset_count == reset_cnt))
return;
else
reset_cnt = priv->reset_count;
dm_digtable.dig_highpwr_state = DM_STA_DIG_MAX;
......@@ -1865,12 +1857,11 @@ static void dm_ctrl_initgain_byrssi_by_fwfalse_alarm(
(priv->reset_count == reset_cnt)) {
dm_ctrl_initgain_byrssi_highpwr(dev);
return;
} else {
}
if (priv->reset_count != reset_cnt)
reset_flag = 1;
reset_cnt = priv->reset_count;
}
dm_digtable.dig_state = DM_STA_DIG_ON;
......@@ -1912,7 +1903,6 @@ static void dm_ctrl_initgain_byrssi_highpwr(struct net_device *dev)
if (dm_digtable.dig_highpwr_state == DM_STA_DIG_ON &&
(priv->reset_count == reset_cnt_highpwr))
return;
else
dm_digtable.dig_highpwr_state = DM_STA_DIG_ON;
if (priv->CurrentChannelBW != HT_CHANNEL_WIDTH_20)
......@@ -1923,7 +1913,6 @@ static void dm_ctrl_initgain_byrssi_highpwr(struct net_device *dev)
if (dm_digtable.dig_highpwr_state == DM_STA_DIG_OFF &&
(priv->reset_count == reset_cnt_highpwr))
return;
else
dm_digtable.dig_highpwr_state = DM_STA_DIG_OFF;
if (priv->undecorated_smoothed_pwdb < dm_digtable.rssi_high_power_lowthresh &&
......
......@@ -202,14 +202,13 @@ void rtllib_ips_leave_wq(struct net_device *dev)
RT_TRACE(COMP_ERR, "%s(): RF is OFF.\n",
__func__);
return;
} else {
}
netdev_info(dev, "=========>%s(): IPSLeave\n",
__func__);
queue_work_rsl(priv->rtllib->wq,
&priv->rtllib->ips_leave_wq);
}
}
}
}
void rtllib_ips_leave(struct net_device *dev)
......
......@@ -346,9 +346,8 @@ static int r8192_wx_set_mode(struct net_device *dev, struct iw_request_info *a,
__func__);
up(&priv->wx_sem);
return -1;
} else {
netdev_info(dev,
"=========>%s(): IPSLeave\n",
}
netdev_info(dev, "=========>%s(): IPSLeave\n",
__func__);
down(&priv->rtllib->ips_sem);
IPSLeave(dev);
......@@ -356,7 +355,6 @@ static int r8192_wx_set_mode(struct net_device *dev, struct iw_request_info *a,
}
}
}
}
ret = rtllib_wx_set_mode(priv->rtllib, a, wrqu, b);
up(&priv->wx_sem);
......@@ -509,16 +507,14 @@ static int r8192_wx_set_scan(struct net_device *dev, struct iw_request_info *a,
__func__);
up(&priv->wx_sem);
return -1;
} else {
RT_TRACE(COMP_PS,
"=========>%s(): IPSLeave\n",
}
RT_TRACE(COMP_PS, "=========>%s(): IPSLeave\n",
__func__);
down(&priv->rtllib->ips_sem);
IPSLeave(dev);
up(&priv->rtllib->ips_sem);
}
}
}
rtllib_stop_scan(priv->rtllib);
if (priv->rtllib->LedControlHandler)
priv->rtllib->LedControlHandler(dev,
......
......@@ -135,16 +135,14 @@ u16 TxCountToDataRate(struct rtllib_device *ieee, u8 nDataRate)
u8 is40MHz = 0;
u8 isShortGI = 0;
if (nDataRate < 12) {
if (nDataRate < 12)
return CCKOFDMRate[nDataRate];
} else {
if (nDataRate >= 0x10 && nDataRate <= 0x1f) {
is40MHz = 0;
isShortGI = 0;
} else if (nDataRate >= 0x20 && nDataRate <= 0x2f) {
is40MHz = 1;
isShortGI = 0;
} else if (nDataRate >= 0x30 && nDataRate <= 0x3f) {
is40MHz = 0;
isShortGI = 1;
......@@ -153,7 +151,6 @@ u16 TxCountToDataRate(struct rtllib_device *ieee, u8 nDataRate)
isShortGI = 1;
}
return MCS_DATA_RATE[is40MHz][isShortGI][nDataRate&0xf];
}
}
bool IsHTHalfNmodeAPs(struct rtllib_device *ieee)
......
......@@ -311,6 +311,11 @@ bool GetTs(struct rtllib_device *ieee, struct ts_common_info **ppTS,
u8 *Addr, u8 TID, enum tr_select TxRxSelect, bool bAddNewTs)
{
u8 UP = 0;
union tspec_body TSpec;
union qos_tsinfo *pTSInfo = &TSpec.f.TSInfo;
struct list_head *pUnusedList;
struct list_head *pAddmitList;
enum direction_value Dir;
if (is_multicast_ether_addr(Addr)) {
RTLLIB_DEBUG(RTLLIB_DL_ERR,
......@@ -348,30 +353,27 @@ bool GetTs(struct rtllib_device *ieee, struct ts_common_info **ppTS,
}
*ppTS = SearchAdmitTRStream(ieee, Addr, UP, TxRxSelect);
if (*ppTS != NULL) {
if (*ppTS != NULL)
return true;
} else {
if (!bAddNewTs) {
RTLLIB_DEBUG(RTLLIB_DL_TS,
"add new TS failed(tid:%d)\n", UP);
return false;
} else {
union tspec_body TSpec;
union qos_tsinfo *pTSInfo = &TSpec.f.TSInfo;
struct list_head *pUnusedList =
(TxRxSelect == TX_DIR) ?
}
pUnusedList = (TxRxSelect == TX_DIR) ?
(&ieee->Tx_TS_Unused_List) :
(&ieee->Rx_TS_Unused_List);
struct list_head *pAddmitList =
(TxRxSelect == TX_DIR) ?
pAddmitList = (TxRxSelect == TX_DIR) ?
(&ieee->Tx_TS_Admit_List) :
(&ieee->Rx_TS_Admit_List);
enum direction_value Dir =
(ieee->iw_mode == IW_MODE_MASTER) ?
Dir = (ieee->iw_mode == IW_MODE_MASTER) ?
((TxRxSelect == TX_DIR) ? DIR_DOWN : DIR_UP) :
((TxRxSelect == TX_DIR) ? DIR_UP : DIR_DOWN);
RTLLIB_DEBUG(RTLLIB_DL_TS, "to add Ts\n");
if (!list_empty(pUnusedList)) {
(*ppTS) = list_entry(pUnusedList->next,
......@@ -409,14 +411,12 @@ bool GetTs(struct rtllib_device *ieee, struct ts_common_info **ppTS,
list_add_tail(&((*ppTS)->List), pAddmitList);
return true;
} else {
}
RTLLIB_DEBUG(RTLLIB_DL_ERR,
"ERR!!in function %s() There is not enough dir=%d(0=up down=1) TS record to be used!!",
__func__, Dir);
return false;
}
}
}
}
static void RemoveTsEntry(struct rtllib_device *ieee, struct ts_common_info *pTs,
......
......@@ -783,7 +783,8 @@ static u8 parse_subframe(struct rtllib_device *ieee, struct sk_buff *skb,
memcpy(rxb->dst, dst, ETH_ALEN);
rxb->subframes[0]->dev = ieee->dev;
return 1;
} else {
}
rxb->nr_subframes = 0;
memcpy(rxb->src, src, ETH_ALEN);
memcpy(rxb->dst, dst, ETH_ALEN);
......@@ -850,7 +851,6 @@ static u8 parse_subframe(struct rtllib_device *ieee, struct sk_buff *skb,
}
return rxb->nr_subframes;
}
}
......
......@@ -2540,14 +2540,13 @@ static void rtllib_resume_tx(struct rtllib_device *ieee)
if (ieee->queue_stop) {
ieee->tx_pending.frag = i;
return;
} else {
}
ieee->softmac_data_hard_start_xmit(
ieee->tx_pending.txb->fragments[i],
ieee->dev, ieee->rate);
ieee->stats.tx_packets++;
}
}
rtllib_txb_free(ieee->tx_pending.txb);
ieee->tx_pending.txb = NULL;
......
......@@ -413,6 +413,8 @@ static void rtllib_query_protectionmode(struct rtllib_device *ieee,
struct cb_desc *tcb_desc,
struct sk_buff *skb)
{
struct rt_hi_throughput *pHTInfo;
tcb_desc->bRTSSTBC = false;
tcb_desc->bRTSUseShortGI = false;
tcb_desc->bCTSEnable = false;
......@@ -435,8 +437,9 @@ static void rtllib_query_protectionmode(struct rtllib_device *ieee,
tcb_desc->rts_rate = MGN_24M;
}
return;
} else {
struct rt_hi_throughput *pHTInfo = ieee->pHTInfo;
}
pHTInfo = ieee->pHTInfo;
while (true) {
if (pHTInfo->IOTAction & HT_IOT_ACT_FORCED_CTS2SELF) {
......@@ -479,7 +482,6 @@ static void rtllib_query_protectionmode(struct rtllib_device *ieee,
}
goto NO_PROTECTION;
}
}
if (ieee->current_network.capability & WLAN_CAPABILITY_SHORT_PREAMBLE)
tcb_desc->bUseShortPreamble = true;
if (ieee->iw_mode == IW_MODE_MASTER)
......
Markdown is supported
0%
or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment