diff options
Diffstat (limited to 'drivers')
21 files changed, 216 insertions, 137 deletions
diff --git a/drivers/staging/rtl8712/hal_init.c b/drivers/staging/rtl8712/hal_init.c index e0ae57d32fa1..8008efe5686d 100644 --- a/drivers/staging/rtl8712/hal_init.c +++ b/drivers/staging/rtl8712/hal_init.c @@ -191,9 +191,9 @@ static u8 rtl8712_dl_fw(struct _adapter *padapter) imem_sz = fwhdr.img_IMEM_size; do { memset(ptx_desc, 0, TXDESC_SIZE); - if (imem_sz > MAX_DUMP_FWSZ/*49152*/) + if (imem_sz > MAX_DUMP_FWSZ/*49152*/) { dump_imem_sz = MAX_DUMP_FWSZ; - else { + } else { dump_imem_sz = imem_sz; ptx_desc->txdw0 |= cpu_to_le32(BIT(28)); } @@ -309,8 +309,9 @@ static u8 rtl8712_dl_fw(struct _adapter *padapter) } if (i == 0) goto exit_fail; - } else + } else { goto exit_fail; + } ret = _SUCCESS; exit_fail: @@ -386,9 +387,9 @@ uint rtl871x_hal_init(struct _adapter *padapter) return _FAIL; if (padapter->halpriv.hal_bus_init(padapter) != _SUCCESS) return _FAIL; - if (rtl8712_hal_init(padapter) == _SUCCESS) + if (rtl8712_hal_init(padapter) == _SUCCESS) { padapter->hw_init_completed = true; - else { + } else { padapter->hw_init_completed = false; return _FAIL; } diff --git a/drivers/staging/rtl8712/ieee80211.c b/drivers/staging/rtl8712/ieee80211.c index 261a97304dfe..3c38fcbc4364 100644 --- a/drivers/staging/rtl8712/ieee80211.c +++ b/drivers/staging/rtl8712/ieee80211.c @@ -304,8 +304,9 @@ int r8712_parse_wpa_ie(u8 *wpa_ie, int wpa_ie_len, int *group_cipher, *group_cipher = r8712_get_wpa_cipher_suite(pos); pos += WPA_SELECTOR_LEN; left -= WPA_SELECTOR_LEN; - } else if (left > 0) + } else if (left > 0) { return _FAIL; + } /*pairwise_cipher*/ if (left >= 2) { count = le16_to_cpu(*(u16 *)pos); @@ -318,8 +319,9 @@ int r8712_parse_wpa_ie(u8 *wpa_ie, int wpa_ie_len, int *group_cipher, pos += WPA_SELECTOR_LEN; left -= WPA_SELECTOR_LEN; } - } else if (left == 1) + } else if (left == 1) { return _FAIL; + } return _SUCCESS; } @@ -344,8 +346,9 @@ int r8712_parse_wpa2_ie(u8 *rsn_ie, int rsn_ie_len, int *group_cipher, *group_cipher = r8712_get_wpa2_cipher_suite(pos); pos += RSN_SELECTOR_LEN; left -= RSN_SELECTOR_LEN; - } else if (left > 0) + } else if (left > 0) { return _FAIL; + } /*pairwise_cipher*/ if (left >= 2) { count = le16_to_cpu(*(u16 *)pos); @@ -358,8 +361,9 @@ int r8712_parse_wpa2_ie(u8 *rsn_ie, int rsn_ie_len, int *group_cipher, pos += RSN_SELECTOR_LEN; left -= RSN_SELECTOR_LEN; } - } else if (left == 1) + } else if (left == 1) { return _FAIL; + } return _SUCCESS; } @@ -385,8 +389,9 @@ int r8712_get_sec_ie(u8 *in_ie, uint in_len, u8 *rsn_ie, u16 *rsn_len, in_ie[cnt + 1] + 2); *rsn_len = in_ie[cnt+1] + 2; cnt += in_ie[cnt+1] + 2; /*get next*/ - } else + } else { cnt += in_ie[cnt+1] + 2; /*get next*/ + } } } return *rsn_len + *wpa_len; diff --git a/drivers/staging/rtl8712/rtl8712_cmd.c b/drivers/staging/rtl8712/rtl8712_cmd.c index 39b63207fa52..ac6c22f98db8 100644 --- a/drivers/staging/rtl8712/rtl8712_cmd.c +++ b/drivers/staging/rtl8712/rtl8712_cmd.c @@ -405,10 +405,12 @@ _next: if (list_empty(&pcmdpriv->cmd_queue.queue)) { r8712_unregister_cmd_alive(padapter); continue; - } else + } else { goto _next; - } else + } + } else { goto _next; + } flush_signals_thread(); } /* free all cmd_obj resources */ diff --git a/drivers/staging/rtl8712/rtl8712_efuse.c b/drivers/staging/rtl8712/rtl8712_efuse.c index 13d4b8dcf073..4dcc82632326 100644 --- a/drivers/staging/rtl8712/rtl8712_efuse.c +++ b/drivers/staging/rtl8712/rtl8712_efuse.c @@ -163,8 +163,9 @@ static u8 efuse_is_empty(struct _adapter *padapter, u8 *empty) *empty = true; else *empty = false; - } else + } else { ret = false; + } return ret; } @@ -229,8 +230,9 @@ u16 r8712_efuse_get_current_size(struct _adapter *padapter) word_cnts = calculate_word_cnts(hworden); /* read next header */ efuse_addr = efuse_addr + (word_cnts * 2) + 1; - } else + } else { bContinual = false; + } } return efuse_addr; } @@ -263,8 +265,9 @@ u8 r8712_efuse_pg_packet_read(struct _adapter *padapter, u8 offset, u8 *data) if (efuse_one_byte_read(padapter, efuse_addr+1+tmpidx, &efuse_data)) { tmpdata[tmpidx] = efuse_data; - } else + } else { ret = false; + } } pgpacket_copy_data(hworden, tmpdata, data); } @@ -335,17 +338,17 @@ static u8 fix_header(struct _adapter *padapter, u8 header, u16 header_addr) efuse_one_byte_write(padapter, addr+1, pkt.data[i*2 + 1]); /* additional check */ - if (!efuse_one_byte_read(padapter, addr, &value)) + if (!efuse_one_byte_read(padapter, addr, &value)) { ret = false; - else if (pkt.data[i*2] != value) { + } else if (pkt.data[i*2] != value) { ret = false; if (0xFF == value) /* write again */ efuse_one_byte_write(padapter, addr, pkt.data[i * 2]); } - if (!efuse_one_byte_read(padapter, addr+1, &value)) + if (!efuse_one_byte_read(padapter, addr+1, &value)) { ret = false; - else if (pkt.data[i*2 + 1] != value) { + } else if (pkt.data[i*2 + 1] != value) { ret = false; if (0xFF == value) /* write again */ efuse_one_byte_write(padapter, addr+1, @@ -503,8 +506,9 @@ u8 r8712_efuse_map_write(struct _adapter *padapter, u16 addr, u16 cnts, if (efuse_is_empty(padapter, &empty)) { if (empty) memset(pktdata, 0xFF, PGPKT_DATA_SIZE); - } else + } else { return false; + } offset = (addr >> 3) & 0xF; if (!empty) if (!r8712_efuse_pg_packet_read(padapter, offset, pktdata)) diff --git a/drivers/staging/rtl8712/rtl8712_led.c b/drivers/staging/rtl8712/rtl8712_led.c index 48d744df47df..79981b591d91 100644 --- a/drivers/staging/rtl8712/rtl8712_led.c +++ b/drivers/staging/rtl8712/rtl8712_led.c @@ -297,14 +297,16 @@ static void SwLedBlink1(struct LED_871x *pLed) if (!pLed1->bSWLedCtrl) { SwLedOn(padapter, pLed1); pLed1->bSWLedCtrl = true; - } else if (!pLed1->bLedOn) + } else if (!pLed1->bLedOn) { SwLedOn(padapter, pLed1); + } } else { if (!pLed1->bSWLedCtrl) { SwLedOff(padapter, pLed1); pLed1->bSWLedCtrl = true; - } else if (pLed1->bLedOn) + } else if (pLed1->bLedOn) { SwLedOff(padapter, pLed1); + } } } switch (pLed->CurrLedState) { @@ -407,8 +409,9 @@ static void SwLedBlink1(struct LED_871x *pLed) mod_timer(&pLed->BlinkTimer, jiffies + msecs_to_jiffies(LED_BLINK_WPS_SUCESS_INTERVAL_ALPHA)); bStopBlinking = false; - } else + } else { bStopBlinking = true; + } if (bStopBlinking) { pLed->bLedLinkBlinkInProgress = true; pLed->CurrLedState = LED_BLINK_NORMAL; @@ -570,8 +573,9 @@ static void SwLedBlink3(struct LED_871x *pLed) mod_timer(&pLed->BlinkTimer, jiffies + msecs_to_jiffies(LED_BLINK_WPS_SUCESS_INTERVAL_ALPHA)); bStopBlinking = false; - } else + } else { bStopBlinking = true; + } if (bStopBlinking) { pLed->CurrLedState = LED_ON; pLed->BlinkingLedState = LED_ON; @@ -1317,8 +1321,9 @@ static void SwLedControlMode3(struct _adapter *padapter, if (pLed->bLedWPSBlinkInProgress) { del_timer(&pLed->BlinkTimer); pLed->bLedWPSBlinkInProgress = false; - } else + } else { pLed->bLedWPSBlinkInProgress = true; + } pLed->CurrLedState = LED_BLINK_WPS_STOP; if (pLed->bLedOn) { pLed->BlinkingLedState = LED_OFF; diff --git a/drivers/staging/rtl8712/rtl8712_recv.c b/drivers/staging/rtl8712/rtl8712_recv.c index 83cdb6146216..b6b2b4201b1c 100644 --- a/drivers/staging/rtl8712/rtl8712_recv.c +++ b/drivers/staging/rtl8712/rtl8712_recv.c @@ -180,8 +180,9 @@ static void update_recvframe_attrib_from_recvstat(struct rx_pkt_attrib *pattrib, pattrib->ip_chkrpt = 1; /* correct */ else pattrib->ip_chkrpt = 0; /* incorrect */ - } else + } else { pattrib->tcpchk_valid = 0; /* invalid */ + } pattrib->mcs_rate = (u8)((le32_to_cpu(prxstat->rxdw3)) & 0x3f); pattrib->htc = (u8)((le32_to_cpu(prxstat->rxdw3) >> 14) & 0x1); /*Offset 16*/ @@ -414,8 +415,9 @@ static int amsdu_to_msdu(struct _adapter *padapter, union recv_frame *prframe) if ((pattrib->tcpchk_valid == 1) && (pattrib->tcp_chkrpt == 1)) { sub_skb->ip_summed = CHECKSUM_UNNECESSARY; - } else + } else { sub_skb->ip_summed = CHECKSUM_NONE; + } netif_rx(sub_skb); } } @@ -580,8 +582,9 @@ static int recv_indicatepkt_reorder(struct _adapter *padapter, !padapter->bSurpriseRemoved) { r8712_recv_indicatepkt(padapter, prframe); return _SUCCESS; - } else + } else { return _FAIL; + } } } spin_lock_irqsave(&ppending_recvframe_queue->lock, irql); @@ -654,8 +657,9 @@ static int r8712_process_recv_indicatepkts(struct _adapter *padapter, if (!padapter->bDriverStopped && !padapter->bSurpriseRemoved) { /* indicate this recv_frame */ r8712_recv_indicatepkt(padapter, prframe); - } else + } else { return _FAIL; + } } return retval; } @@ -812,9 +816,9 @@ static void query_rx_phy_status(struct _adapter *padapter, /* * (3) Get Signal Quality (EVM) */ - if (pwdb_all > 40) + if (pwdb_all > 40) { sq = 100; - else { + } else { sq = pcck_buf->sq_rpt; if (pcck_buf->sq_rpt > 64) sq = 0; diff --git a/drivers/staging/rtl8712/rtl8712_xmit.c b/drivers/staging/rtl8712/rtl8712_xmit.c index 296591902e19..02140b0ebf7f 100644 --- a/drivers/staging/rtl8712/rtl8712_xmit.c +++ b/drivers/staging/rtl8712/rtl8712_xmit.c @@ -98,11 +98,11 @@ static u32 get_ff_hwaddr(struct xmit_frame *pxmitframe) struct _adapter *padapter = pxmitframe->padapter; struct dvobj_priv *pdvobj = &padapter->dvobjpriv; - if (pxmitframe->frame_tag == TXAGG_FRAMETAG) + if (pxmitframe->frame_tag == TXAGG_FRAMETAG) { addr = RTL8712_DMA_H2CCMD; - else if (pxmitframe->frame_tag == MGNT_FRAMETAG) + } else if (pxmitframe->frame_tag == MGNT_FRAMETAG) { addr = RTL8712_DMA_MGTQ; - else if (pdvobj->nr_endpoint == 6) { + } else if (pdvobj->nr_endpoint == 6) { switch (pattrib->priority) { case 0: case 3: @@ -239,9 +239,9 @@ void r8712_do_queue_select(struct _adapter *padapter, unsigned int qsel = 0; struct dvobj_priv *pdvobj = &padapter->dvobjpriv; - if (pdvobj->nr_endpoint == 6) + if (pdvobj->nr_endpoint == 6) { qsel = (unsigned int) pattrib->priority; - else if (pdvobj->nr_endpoint == 4) { + } else if (pdvobj->nr_endpoint == 4) { qsel = (unsigned int) pattrib->priority; if (qsel == 0 || qsel == 3) qsel = 3; diff --git a/drivers/staging/rtl8712/rtl871x_cmd.c b/drivers/staging/rtl8712/rtl871x_cmd.c index 83317815be40..1f6e69b1bba3 100644 --- a/drivers/staging/rtl8712/rtl871x_cmd.c +++ b/drivers/staging/rtl8712/rtl871x_cmd.c @@ -137,9 +137,9 @@ static struct cmd_obj *_dequeue_cmd(struct __queue *queue) struct cmd_obj *obj; spin_lock_irqsave(&(queue->lock), irqL); - if (list_empty(&(queue->queue))) + if (list_empty(&(queue->queue))) { obj = NULL; - else { + } else { obj = LIST_CONTAINOR(queue->queue.next, struct cmd_obj, list); list_del_init(&obj->list); @@ -538,8 +538,9 @@ u8 r8712_joinbss_cmd(struct _adapter *padapter, struct wlan_network *pnetwork) if (psecnetwork->IELength != tmp_len) { psecnetwork->IELength = tmp_len; pqospriv->qos_option = 1; /* WMM IE in beacon */ - } else + } else { pqospriv->qos_option = 0; /* no WMM IE in beacon */ + } } if (pregistrypriv->ht_enable) { /* For WEP mode, we will use the bg mode to do the connection diff --git a/drivers/staging/rtl8712/rtl871x_ioctl_linux.c b/drivers/staging/rtl8712/rtl871x_ioctl_linux.c index a7f581633c23..e70513d06a35 100644 --- a/drivers/staging/rtl8712/rtl871x_ioctl_linux.c +++ b/drivers/staging/rtl8712/rtl871x_ioctl_linux.c @@ -356,8 +356,9 @@ static int wpa_set_auth_algs(struct net_device *dev, u32 value) Ndis802_11AuthModeOpen; padapter->securitypriv.AuthAlgrthm = 0; } - } else + } else { ret = -EINVAL; + } return ret; } @@ -381,8 +382,9 @@ static int wpa_set_encryption(struct net_device *dev, struct ieee_param *param, /* for large key indices, set the default (0) */ param->u.crypt.idx = 0; } - } else + } else { return -EINVAL; + } if (strcmp(param->u.crypt.alg, "WEP") == 0) { netdev_info(dev, "r8712u: %s: crypt.alg = WEP\n", __func__); padapter->securitypriv.ndisencryptstatus = @@ -411,8 +413,9 @@ static int wpa_set_encryption(struct net_device *dev, struct ieee_param *param, padapter->securitypriv.XGrpPrivacy = _WEP104_; } - } else + } else { return -EINVAL; + } pwep->KeyIndex = wep_key_idx; pwep->KeyIndex |= 0x80000000; memcpy(pwep->KeyMaterial, param->u.crypt.key, pwep->KeyLength); @@ -587,8 +590,9 @@ static int r871x_set_wpa_ie(struct _adapter *padapter, char *pie, netdev_info(padapter->pnetdev, "r8712u: SET WPS_IE, wps_phase==true\n"); cnt += buf[cnt+1]+2; break; - } else + } else { cnt += buf[cnt + 1] + 2; + } } } } @@ -639,8 +643,9 @@ static int r8711_wx_get_name(struct net_device *dev, snprintf(wrqu->name, IFNAMSIZ, "IEEE 802.11g"); } - } else + } else { snprintf(wrqu->name, IFNAMSIZ, "unassociated"); + } return 0; } @@ -674,14 +679,14 @@ static int r8711_wx_set_freq(struct net_device *dev, fwrq->m = c + 1; } /* Setting by channel number */ - if ((fwrq->m > 14) || (fwrq->e > 0)) + if ((fwrq->m > 14) || (fwrq->e > 0)) { rc = -EOPNOTSUPP; - else { + } else { int channel = fwrq->m; - if ((channel < 1) || (channel > 14)) + if ((channel < 1) || (channel > 14)) { rc = -EINVAL; - else { + } else { /* Yes ! We can set it !!! */ padapter->registrypriv.channel = channel; } @@ -1069,9 +1074,9 @@ static int r8711_wx_set_wap(struct net_device *dev, } spin_unlock_irqrestore(&queue->lock, irqL); if (!ret) { - if (!r8712_set_802_11_authentication_mode(padapter, authmode)) + if (!r8712_set_802_11_authentication_mode(padapter, authmode)) { ret = -ENOMEM; - else { + } else { if (!r8712_set_802_11_bssid(padapter, temp->sa_data)) ret = -1; } @@ -1167,12 +1172,14 @@ static int r8711_wx_set_scan(struct net_device *dev, (pmlmepriv->sitesurveyctrl.traffic_busy)) { if (check_fwstate(pmlmepriv, _FW_UNDER_LINKING)) status = false; - } else + } else { status = r8712_sitesurvey_cmd(padapter, &ssid); + } spin_unlock_irqrestore(&pmlmepriv->lock, irqL); } - } else + } else { status = r8712_set_802_11_bssid_list_scan(padapter); + } if (!status) return -1; return 0; @@ -1379,8 +1386,9 @@ set_rate: datarates[i] = mpdatarate[i]; if (fixed == 0) break; - } else + } else { datarates[i] = 0xff; + } } if (r8712_setdatarate_cmd(padapter, datarates) != _SUCCESS) ret = -ENOMEM; @@ -1439,8 +1447,9 @@ static int r8711_wx_get_rate(struct net_device *dev, max_rate *= 2; /* Mbps/2 */ } wrqu->bitrate.value = max_rate * 500000; - } else + } else { return -ENOLINK; + } return 0; } @@ -1461,9 +1470,9 @@ static int r8711_wx_set_frag(struct net_device *dev, { struct _adapter *padapter = netdev_priv(dev); - if (wrqu->frag.disabled) + if (wrqu->frag.disabled) { padapter->xmitpriv.frag_len = MAX_FRAG_THRESHOLD; - else { + } else { if (wrqu->frag.value < MIN_FRAG_THRESHOLD || wrqu->frag.value > MAX_FRAG_THRESHOLD) return -EINVAL; @@ -1898,9 +1907,9 @@ static int r871x_mp_ioctl_hdl(struct net_device *dev, ret = -EINVAL; goto _r871x_mp_ioctl_hdl_exit; } - if (phandler->oid == 0 && phandler->handler) + if (phandler->oid == 0 && phandler->handler) { status = phandler->handler(&oid_par); - else if (phandler->handler) { + } else if (phandler->handler) { oid_par.adapter_context = padapter; oid_par.oid = phandler->oid; oid_par.information_buf = poidparam->data; @@ -1967,8 +1976,9 @@ static int r871x_get_ap_info(struct net_device *dev, if (pdata->length >= 32) { if (copy_from_user(data, pdata->pointer, 32)) return -EINVAL; - } else + } else { return -EINVAL; + } spin_lock_irqsave(&(pmlmepriv->scanned_queue.lock), irqL); phead = &queue->queue; plist = phead->next; diff --git a/drivers/staging/rtl8712/rtl871x_ioctl_rtl.c b/drivers/staging/rtl8712/rtl871x_ioctl_rtl.c index d8e62ec697b3..b10b3e82994e 100644 --- a/drivers/staging/rtl8712/rtl871x_ioctl_rtl.c +++ b/drivers/staging/rtl8712/rtl871x_ioctl_rtl.c @@ -58,8 +58,9 @@ uint oid_rt_get_small_packet_crc_hdl(struct oid_par_priv *poid_par_priv) *(u32 *)poid_par_priv->information_buf = padapter->recvpriv.rx_smallpacket_crcerr; *poid_par_priv->bytes_rw = poid_par_priv->information_buf_len; - } else + } else { return RNDIS_STATUS_INVALID_LENGTH; + } return RNDIS_STATUS_SUCCESS; } @@ -74,8 +75,9 @@ uint oid_rt_get_middle_packet_crc_hdl(struct oid_par_priv *poid_par_priv) *(u32 *)poid_par_priv->information_buf = padapter->recvpriv.rx_middlepacket_crcerr; *poid_par_priv->bytes_rw = poid_par_priv->information_buf_len; - } else + } else { return RNDIS_STATUS_INVALID_LENGTH; + } return RNDIS_STATUS_SUCCESS; } @@ -90,8 +92,9 @@ uint oid_rt_get_large_packet_crc_hdl(struct oid_par_priv *poid_par_priv) *(u32 *)poid_par_priv->information_buf = padapter->recvpriv.rx_largepacket_crcerr; *poid_par_priv->bytes_rw = poid_par_priv->information_buf_len; - } else + } else { return RNDIS_STATUS_INVALID_LENGTH; + } return RNDIS_STATUS_SUCCESS; } @@ -122,8 +125,9 @@ uint oid_rt_get_rx_total_packet_hdl(struct oid_par_priv *poid_par_priv) padapter->recvpriv.rx_pkts + padapter->recvpriv.rx_drop; *poid_par_priv->bytes_rw = poid_par_priv->information_buf_len; - } else + } else { return RNDIS_STATUS_INVALID_LENGTH; + } return RNDIS_STATUS_SUCCESS; } @@ -152,8 +156,9 @@ uint oid_rt_get_rx_icv_err_hdl(struct oid_par_priv *poid_par_priv) *(uint *)poid_par_priv->information_buf = padapter->recvpriv.rx_icv_err; *poid_par_priv->bytes_rw = poid_par_priv->information_buf_len; - } else + } else { return RNDIS_STATUS_INVALID_LENGTH; + } return RNDIS_STATUS_SUCCESS; } @@ -182,8 +187,9 @@ uint oid_rt_get_preamble_mode_hdl(struct oid_par_priv *poid_par_priv) preamblemode = 2; *(u32 *)poid_par_priv->information_buf = preamblemode; *poid_par_priv->bytes_rw = poid_par_priv->information_buf_len; - } else + } else { return RNDIS_STATUS_INVALID_LENGTH; + } return RNDIS_STATUS_SUCCESS; } @@ -239,8 +245,9 @@ uint oid_rt_set_preamble_mode_hdl(struct oid_par_priv padapter->registrypriv.preamble = PREAMBLE_SHORT; *(u32 *)poid_par_priv->information_buf = preamblemode; *poid_par_priv->bytes_rw = poid_par_priv->information_buf_len; - } else + } else { return RNDIS_STATUS_INVALID_LENGTH; + } return RNDIS_STATUS_SUCCESS; } @@ -269,8 +276,9 @@ uint oid_rt_get_total_tx_bytes_hdl(struct oid_par_priv *(u32 *)poid_par_priv->information_buf = padapter->xmitpriv.tx_bytes; *poid_par_priv->bytes_rw = poid_par_priv->information_buf_len; - } else + } else { return RNDIS_STATUS_INVALID_LENGTH; + } return RNDIS_STATUS_SUCCESS; } @@ -287,8 +295,9 @@ uint oid_rt_get_total_rx_bytes_hdl(struct oid_par_priv padapter->recvpriv.rx_bytes; *poid_par_priv->bytes_rw = poid_par_priv-> information_buf_len; - } else + } else { return RNDIS_STATUS_INVALID_LENGTH; + } return RNDIS_STATUS_SUCCESS; } @@ -364,8 +373,9 @@ uint oid_rt_supported_wireless_mode_hdl(struct oid_par_priv ulInfo |= 0x0400; /* WIRELESS_MODE_A */ *(u32 *) poid_par_priv->information_buf = ulInfo; *poid_par_priv->bytes_rw = poid_par_priv->information_buf_len; - } else + } else { return RNDIS_STATUS_INVALID_LENGTH; + } return RNDIS_STATUS_SUCCESS; } @@ -451,8 +461,9 @@ uint oid_rt_pro_rf_write_registry_hdl(struct oid_par_priv* (unsigned long)(*((unsigned long *) poid_par_priv->information_buf + 2)))) status = RNDIS_STATUS_NOT_ACCEPTED; - } else + } else { status = RNDIS_STATUS_INVALID_LENGTH; + } return status; } @@ -465,9 +476,9 @@ uint oid_rt_pro_rf_read_registry_hdl(struct oid_par_priv *poid_par_priv) if (poid_par_priv->type_of_oid != SET_OID) /* QUERY_OID */ return RNDIS_STATUS_NOT_ACCEPTED; if (poid_par_priv->information_buf_len == (sizeof(unsigned long)*3)) { - if (Adapter->mppriv.act_in_progress) + if (Adapter->mppriv.act_in_progress) { status = RNDIS_STATUS_NOT_ACCEPTED; - else { + } else { /* init workparam */ Adapter->mppriv.act_in_progress = true; Adapter->mppriv.workparam.bcompleted = false; @@ -489,8 +500,9 @@ uint oid_rt_pro_rf_read_registry_hdl(struct oid_par_priv *poid_par_priv) io_value)) status = RNDIS_STATUS_NOT_ACCEPTED; } - } else + } else { status = RNDIS_STATUS_INVALID_LENGTH; + } return status; } diff --git a/drivers/staging/rtl8712/rtl871x_ioctl_set.c b/drivers/staging/rtl8712/rtl871x_ioctl_set.c index 67a2695fbeed..ab84a4032fe4 100644 --- a/drivers/staging/rtl8712/rtl871x_ioctl_set.c +++ b/drivers/staging/rtl8712/rtl871x_ioctl_set.c @@ -207,9 +207,10 @@ void r8712_set_802_11_ssid(struct _adapter *padapter, set_fwstate(pmlmepriv, WIFI_ADHOC_STATE); } - } else + } else { goto _Abort_Set_SSID; /* driver is in * WIFI_ADHOC_MASTER_STATE */ + } } } else { r8712_disassoc_cmd(padapter); diff --git a/drivers/staging/rtl8712/rtl871x_mlme.c b/drivers/staging/rtl8712/rtl871x_mlme.c index c1890f54b527..98113c4e699e 100644 --- a/drivers/staging/rtl8712/rtl871x_mlme.c +++ b/drivers/staging/rtl8712/rtl871x_mlme.c @@ -191,8 +191,9 @@ sint r8712_if_up(struct _adapter *padapter) if (padapter->bDriverStopped || padapter->bSurpriseRemoved || !check_fwstate(&padapter->mlmepriv, _FW_LINKED)) { res = false; - } else + } else { res = true; + } return res; } @@ -354,8 +355,9 @@ static void update_network(struct wlan_bssid_ex *dst, padapter->recvpriv.signal = (u8)tmpVal; src->Rssi = padapter->recvpriv.signal; - } else + } else { src->Rssi = (src->Rssi + dst->Rssi) / 2; + } memcpy((u8 *)dst, (u8 *)src, r8712_get_wlan_bssid_ex_sz(src)); } @@ -552,9 +554,9 @@ void r8712_survey_event_callback(struct _adapter *adapter, u8 *pbuf) } /* lock pmlmepriv->lock when you accessing network_q */ if (!check_fwstate(pmlmepriv, _FW_UNDER_LINKING)) { - if (pnetwork->Ssid.Ssid[0] != 0) + if (pnetwork->Ssid.Ssid[0] != 0) { rtl8711_add_network(adapter, pnetwork); - else { + } else { pnetwork->Ssid.SsidLength = 8; memcpy(pnetwork->Ssid.Ssid, "<hidden>", 8); rtl8711_add_network(adapter, pnetwork); @@ -719,8 +721,9 @@ void r8712_joinbss_event_callback(struct _adapter *adapter, u8 *pbuf) return; memcpy((u8 *)pnetwork+16, (u8 *)pbuf + 8, sizeof(struct wlan_network) - 16); - } else + } else { pnetwork = (struct wlan_network *)pbuf; + } #ifdef __BIG_ENDIAN /* endian_convert */ @@ -767,12 +770,12 @@ void r8712_joinbss_event_callback(struct _adapter *adapter, u8 *pbuf) if (check_fwstate(pmlmepriv, _FW_UNDER_LINKING)) { /*s1. find ptarget_wlan*/ if (check_fwstate(pmlmepriv, _FW_LINKED)) { - if (the_same_macaddr) + if (the_same_macaddr) { ptarget_wlan = r8712_find_network(&pmlmepriv-> scanned_queue, cur_network->network.MacAddress); - else { + } else { pcur_wlan = r8712_find_network(&pmlmepriv-> scanned_queue, @@ -821,10 +824,11 @@ void r8712_joinbss_event_callback(struct _adapter *adapter, u8 *pbuf) ptarget_sta = r8712_alloc_stainfo(pstapriv, pnetwork->network.MacAddress); - } else + } else { ptarget_sta = r8712_alloc_stainfo(pstapriv, pnetwork->network.MacAddress); + } if (ptarget_sta) /*update ptarget_sta*/ { ptarget_sta->aid = pnetwork->join_res; ptarget_sta->qos_option = 1; @@ -900,8 +904,9 @@ void r8712_joinbss_event_callback(struct _adapter *adapter, u8 *pbuf) if (check_fwstate(pmlmepriv, WIFI_STATION_STATE)) r8712_indicate_connect(adapter); del_timer(&pmlmepriv->assoc_timer); - } else + } else { goto ignore_joinbss_callback; + } } else { if (check_fwstate(pmlmepriv, _FW_UNDER_LINKING)) { mod_timer(&pmlmepriv->assoc_timer, @@ -1163,8 +1168,9 @@ int r8712_select_and_join_from_scan(struct mlme_priv *pmlmepriv) } goto ask_for_joinbss; } - } else if (pmlmepriv->assoc_ssid.SsidLength == 0) + } else if (pmlmepriv->assoc_ssid.SsidLength == 0) { goto ask_for_joinbss; + } dst_ssid = pnetwork->network.Ssid.Ssid; src_ssid = pmlmepriv->assoc_ssid.Ssid; if ((pnetwork->network.Ssid.SsidLength == @@ -1178,8 +1184,9 @@ int r8712_select_and_join_from_scan(struct mlme_priv *pmlmepriv) if (pnetwork->network.Rssi > pnetwork_max_rssi->network.Rssi) pnetwork_max_rssi = pnetwork; - } else + } else { pnetwork_max_rssi = pnetwork; + } } else if (is_desired_network(adapter, pnetwork)) { if (check_fwstate(pmlmepriv, _FW_LINKED)) { r8712_disassoc_cmd(adapter); diff --git a/drivers/staging/rtl8712/rtl871x_mp.c b/drivers/staging/rtl8712/rtl871x_mp.c index 26201ea3cca6..678305501d63 100644 --- a/drivers/staging/rtl8712/rtl871x_mp.c +++ b/drivers/staging/rtl8712/rtl871x_mp.c @@ -237,8 +237,9 @@ static u8 set_bb_reg(struct _adapter *pAdapter, org_value = r8712_bb_reg_read(pAdapter, offset); bit_shift = bitshift(bitmask); new_value = ((org_value & (~bitmask)) | (value << bit_shift)); - } else + } else { new_value = value; + } return r8712_bb_reg_write(pAdapter, offset, new_value); } @@ -262,8 +263,9 @@ static u8 set_rf_reg(struct _adapter *pAdapter, u8 path, u8 offset, u32 bitmask, org_value = r8712_rf_reg_read(pAdapter, path, offset); bit_shift = bitshift(bitmask); new_value = ((org_value & (~bitmask)) | (value << bit_shift)); - } else + } else { new_value = value; + } return r8712_rf_reg_write(pAdapter, path, offset, new_value); } diff --git a/drivers/staging/rtl8712/rtl871x_mp_ioctl.c b/drivers/staging/rtl8712/rtl871x_mp_ioctl.c index 7b00c350d147..26786ad19b71 100644 --- a/drivers/staging/rtl8712/rtl871x_mp_ioctl.c +++ b/drivers/staging/rtl8712/rtl871x_mp_ioctl.c @@ -56,8 +56,9 @@ uint oid_rt_wireless_mode_hdl(struct oid_par_priv *poid_par_priv) Adapter->registrypriv.wireless_mode; *poid_par_priv->bytes_rw = poid_par_priv->information_buf_len; - } else + } else { status = RNDIS_STATUS_INVALID_LENGTH; + } } else { status = RNDIS_STATUS_NOT_ACCEPTED; } @@ -178,8 +179,9 @@ static int mp_start_test(struct _adapter *padapter) if (length % 4) { /*round up to multiple of 4 bytes.*/ bssid.Length = ((length >> 2) + 1) << 2; - } else + } else { bssid.Length = length; + } spin_lock_irqsave(&pmlmepriv->lock, irqL); if (check_fwstate(pmlmepriv, WIFI_MP_STATE)) goto end_of_mp_start_test; @@ -388,8 +390,9 @@ uint oid_rt_pro_query_tx_packet_sent_hdl( *(u32 *)poid_par_priv->information_buf = Adapter->mppriv.tx_pktcount; *poid_par_priv->bytes_rw = poid_par_priv->information_buf_len; - } else + } else { status = RNDIS_STATUS_INVALID_LENGTH; + } return status; } @@ -408,8 +411,9 @@ uint oid_rt_pro_query_rx_packet_received_hdl( *(u32 *)poid_par_priv->information_buf = Adapter->mppriv.rx_pktcount; *poid_par_priv->bytes_rw = poid_par_priv->information_buf_len; - } else + } else { status = RNDIS_STATUS_INVALID_LENGTH; + } return status; } @@ -428,8 +432,9 @@ uint oid_rt_pro_query_rx_packet_crc32_error_hdl( *(u32 *)poid_par_priv->information_buf = Adapter->mppriv.rx_crcerrpktcount; *poid_par_priv->bytes_rw = poid_par_priv->information_buf_len; - } else + } else { status = RNDIS_STATUS_INVALID_LENGTH; + } return status; } @@ -457,8 +462,9 @@ uint oid_rt_pro_reset_rx_packet_received_hdl(struct oid_par_priv if (poid_par_priv->information_buf_len == sizeof(u32)) { Adapter->mppriv.rx_pktcount = 0; Adapter->mppriv.rx_crcerrpktcount = 0; - } else + } else { status = RNDIS_STATUS_INVALID_LENGTH; + } return status; } diff --git a/drivers/staging/rtl8712/rtl871x_recv.c b/drivers/staging/rtl8712/rtl871x_recv.c index 8a544364b86b..e9dc1f472756 100644 --- a/drivers/staging/rtl8712/rtl871x_recv.c +++ b/drivers/staging/rtl8712/rtl871x_recv.c @@ -112,9 +112,9 @@ union recv_frame *r8712_alloc_recvframe(struct __queue *pfree_recv_queue) struct recv_priv *precvpriv; spin_lock_irqsave(&pfree_recv_queue->lock, irqL); - if (list_empty(&pfree_recv_queue->queue)) + if (list_empty(&pfree_recv_queue->queue)) { precvframe = NULL; - else { + } else { phead = &pfree_recv_queue->queue; plist = phead->next; precvframe = LIST_CONTAINOR(plist, union recv_frame, u); @@ -180,8 +180,9 @@ sint r8712_recvframe_chkmic(struct _adapter *adapter, 6) & 0x3)) - 1].skey[0]; if (!psecuritypriv->binstallGrpkey) return _FAIL; - } else + } else { mickey = &stainfo->tkiprxmickey.skey[0]; + } /*icv_len included the mic code*/ datalen = precvframe->u.hdr.len - prxattrib->hdrlen - prxattrib->iv_len - prxattrib->icv_len - 8; @@ -239,8 +240,9 @@ union recv_frame *r8712_decryptor(struct _adapter *padapter, default: break; } - } else if (prxattrib->bdecrypted == 1) + } else if (prxattrib->bdecrypted == 1) { psecuritypriv->hw_decrypted = true; + } return return_packet; } /*###set the security information in the recv_frame */ @@ -270,9 +272,9 @@ union recv_frame *r8712_portctrl(struct _adapter *adapter, if ((psta != NULL) && (psta->ieee8021x_blocked)) { /* blocked * only accept EAPOL frame */ - if (ether_type == 0x888e) + if (ether_type == 0x888e) { prtnframe = precv_frame; - else { + } else { /*free this frame*/ r8712_free_recvframe(precv_frame, &adapter->recvpriv.free_recv_queue); @@ -289,8 +291,9 @@ union recv_frame *r8712_portctrl(struct _adapter *adapter, prtnframe = precv_frame; } } - } else + } else { prtnframe = precv_frame; + } return prtnframe; } @@ -341,7 +344,7 @@ static sint sta2sta_data_frame(struct _adapter *adapter, if (memcmp(pattrib->bssid, pattrib->src, ETH_ALEN)) return _FAIL; sta_addr = pattrib->bssid; - } else if (check_fwstate(pmlmepriv, WIFI_AP_STATE)) { + } else if (check_fwstate(pmlmepriv, WIFI_AP_STATE)) { if (bmcast) { /* For AP mode, if DA == MCAST, then BSSID should * be also MCAST */ @@ -354,15 +357,16 @@ static sint sta2sta_data_frame(struct _adapter *adapter, return _FAIL; sta_addr = pattrib->src; } - } else if (check_fwstate(pmlmepriv, WIFI_MP_STATE)) { + } else if (check_fwstate(pmlmepriv, WIFI_MP_STATE)) { memcpy(pattrib->dst, GetAddr1Ptr(ptr), ETH_ALEN); memcpy(pattrib->src, GetAddr2Ptr(ptr), ETH_ALEN); memcpy(pattrib->bssid, GetAddr3Ptr(ptr), ETH_ALEN); memcpy(pattrib->ra, pattrib->dst, ETH_ALEN); memcpy(pattrib->ta, pattrib->src, ETH_ALEN); sta_addr = mybssid; - } else + } else { ret = _FAIL; + } if (bmcast) *psta = r8712_get_bcmc_stainfo(adapter); else @@ -429,8 +433,9 @@ static sint ap2sta_data_frame(struct _adapter *adapter, *psta = r8712_get_stainfo(pstapriv, pattrib->bssid); if (*psta == NULL) return _FAIL; - } else + } else { return _FAIL; + } return _SUCCESS; } diff --git a/drivers/staging/rtl8712/rtl871x_security.c b/drivers/staging/rtl8712/rtl871x_security.c index 48b05578e80e..1d7888a19387 100644 --- a/drivers/staging/rtl8712/rtl871x_security.c +++ b/drivers/staging/rtl8712/rtl871x_security.c @@ -636,8 +636,9 @@ u32 r8712_tkip_encrypt(struct _adapter *padapter, u8 *pxmitframe) pframe = (u8 *)RND4((addr_t)(pframe)); } } - } else + } else { res = _FAIL; + } } return res; } @@ -677,8 +678,9 @@ u32 r8712_tkip_decrypt(struct _adapter *padapter, u8 *precvframe) ((idx >> 6) & 0x3) - 1].skey[0]; if (!psecuritypriv->binstallGrpkey) return _FAIL; - } else + } else { prwskey = &stainfo->x_UncstKey.skey[0]; + } GET_TKIP_PN(iv, txpn); pnl = (u16)(txpn.val); pnh = (u32)(txpn.val >> 16); @@ -696,8 +698,9 @@ u32 r8712_tkip_decrypt(struct _adapter *padapter, u8 *precvframe) crc[1] != payload[length - 3] || crc[0] != payload[length - 4]) return _FAIL; - } else + } else { return _FAIL; + } } return _SUCCESS; } @@ -1069,8 +1072,9 @@ static sint aes_cipher(u8 *key, uint hdrlen, if (hdrlen != WLAN_HDR_A3_QOS_LEN) hdrlen += 2; qc_exists = 1; - } else + } else { qc_exists = 0; + } pn_vector[0] = pframe[hdrlen]; pn_vector[1] = pframe[hdrlen+1]; pn_vector[2] = pframe[hdrlen+4]; @@ -1188,8 +1192,9 @@ u32 r8712_aes_encrypt(struct _adapter *padapter, u8 *pxmitframe) pframe = (u8 *)RND4((addr_t)(pframe)); } } - } else + } else { res = _FAIL; + } } return res; } @@ -1377,14 +1382,16 @@ u32 r8712_aes_decrypt(struct _adapter *padapter, u8 *precvframe) if (!psecuritypriv->binstallGrpkey) return _FAIL; - } else + } else { prwskey = &stainfo->x_UncstKey.skey[0]; + } length = ((union recv_frame *)precvframe)-> u.hdr.len-prxattrib->hdrlen-prxattrib->iv_len; aes_decipher(prwskey, prxattrib->hdrlen, pframe, length); - } else + } else { return _FAIL; + } } return _SUCCESS; } diff --git a/drivers/staging/rtl8712/rtl871x_sta_mgt.c b/drivers/staging/rtl8712/rtl871x_sta_mgt.c index 400dfb612183..162e61c6ea06 100644 --- a/drivers/staging/rtl8712/rtl871x_sta_mgt.c +++ b/drivers/staging/rtl8712/rtl871x_sta_mgt.c @@ -117,9 +117,9 @@ struct sta_info *r8712_alloc_stainfo(struct sta_priv *pstapriv, u8 *hwaddr) pfree_sta_queue = &pstapriv->free_sta_queue; spin_lock_irqsave(&(pfree_sta_queue->lock), flags); - if (list_empty(&pfree_sta_queue->queue)) + if (list_empty(&pfree_sta_queue->queue)) { psta = NULL; - else { + } else { psta = LIST_CONTAINOR(pfree_sta_queue->queue.next, struct sta_info, list); list_del_init(&(psta->list)); diff --git a/drivers/staging/rtl8712/rtl871x_xmit.c b/drivers/staging/rtl8712/rtl871x_xmit.c index d41413991017..eb41f7635d13 100644 --- a/drivers/staging/rtl8712/rtl871x_xmit.c +++ b/drivers/staging/rtl8712/rtl871x_xmit.c @@ -293,9 +293,9 @@ sint r8712_update_attrib(struct _adapter *padapter, _pkt *pkt, /* get ether_hdr_len */ pattrib->pkt_hdrlen = ETH_HLEN; - if (pqospriv->qos_option) + if (pqospriv->qos_option) { r8712_set_qos(&pktfile, pattrib); - else { + } else { pattrib->hdrlen = WLAN_HDR_A3_LEN; pattrib->subtype = WIFI_DATA_TYPE; pattrib->priority = 0; @@ -305,8 +305,9 @@ sint r8712_update_attrib(struct _adapter *padapter, _pkt *pkt, if ((pattrib->ether_type != 0x888e) && !check_fwstate(pmlmepriv, WIFI_MP_STATE)) return _FAIL; - } else + } else { GET_ENCRY_ALGO(psecuritypriv, psta, pattrib->encrypt, bmcast); + } switch (pattrib->encrypt) { case _WEP40_: case _WEP104_: @@ -509,8 +510,9 @@ static sint make_wlanhdr(struct _adapter *padapter, u8 *hdr, memcpy(pwlanhdr->addr2, pattrib->src, ETH_ALEN); memcpy(pwlanhdr->addr3, get_bssid(pmlmepriv), ETH_ALEN); - } else + } else { return _FAIL; + } if (pattrib->encrypt) SetPrivacy(fctrl); @@ -526,9 +528,9 @@ static sint make_wlanhdr(struct _adapter *padapter, u8 *hdr, struct sta_info *psta; sint bmcst = IS_MCAST(pattrib->ra); - if (pattrib->psta) + if (pattrib->psta) { psta = pattrib->psta; - else { + } else { if (bmcst) psta = r8712_get_bcmc_stainfo(padapter); else @@ -719,17 +721,18 @@ void r8712_update_protection(struct _adapter *padapter, u8 *ie, uint ie_len) case AUTO_VCS: default: perp = r8712_get_ie(ie, _ERPINFO_IE_, &erp_len, ie_len); - if (perp == NULL) + if (perp == NULL) { pxmitpriv->vcs = NONE_VCS; - else { + } else { protection = (*(perp + 2)) & BIT(1); if (protection) { if (pregistrypriv->vcs_type == RTS_CTS) pxmitpriv->vcs = RTS_CTS; else pxmitpriv->vcs = CTS_TO_SELF; - } else + } else { pxmitpriv->vcs = NONE_VCS; + } } break; } @@ -743,9 +746,9 @@ struct xmit_buf *r8712_alloc_xmitbuf(struct xmit_priv *pxmitpriv) struct __queue *pfree_xmitbuf_queue = &pxmitpriv->free_xmitbuf_queue; spin_lock_irqsave(&pfree_xmitbuf_queue->lock, irqL); - if (list_empty(&pfree_xmitbuf_queue->queue)) + if (list_empty(&pfree_xmitbuf_queue->queue)) { pxmitbuf = NULL; - else { + } else { phead = &pfree_xmitbuf_queue->queue; plist = phead->next; pxmitbuf = LIST_CONTAINOR(plist, struct xmit_buf, list); @@ -797,9 +800,9 @@ struct xmit_frame *r8712_alloc_xmitframe(struct xmit_priv *pxmitpriv) struct __queue *pfree_xmit_queue = &pxmitpriv->free_xmit_queue; spin_lock_irqsave(&pfree_xmit_queue->lock, irqL); - if (list_empty(&pfree_xmit_queue->queue)) + if (list_empty(&pfree_xmit_queue->queue)) { pxframe = NULL; - else { + } else { phead = &pfree_xmit_queue->queue; plist = phead->next; pxframe = LIST_CONTAINOR(plist, struct xmit_frame, list); @@ -917,12 +920,12 @@ sint r8712_xmit_classifier(struct _adapter *padapter, struct mlme_priv *pmlmepriv = &padapter->mlmepriv; sint bmcst = IS_MCAST(pattrib->ra); - if (pattrib->psta) + if (pattrib->psta) { psta = pattrib->psta; - else { - if (bmcst) + } else { + if (bmcst) { psta = r8712_get_bcmc_stainfo(padapter); - else { + } else { if (check_fwstate(pmlmepriv, WIFI_MP_STATE)) psta = r8712_get_stainfo(pstapriv, get_bssid(pmlmepriv)); diff --git a/drivers/staging/rtl8712/usb_halinit.c b/drivers/staging/rtl8712/usb_halinit.c index b4ae11a78b46..944df8543941 100644 --- a/drivers/staging/rtl8712/usb_halinit.c +++ b/drivers/staging/rtl8712/usb_halinit.c @@ -285,8 +285,9 @@ u8 r8712_usb_hal_bus_init(struct _adapter *padapter) /* Reset TxDMA */ r8712_write8(padapter, CR, val8|_TXDMA_EN); } - } else + } else { ret = _FAIL; + } return ret; } diff --git a/drivers/staging/rtl8712/usb_intf.c b/drivers/staging/rtl8712/usb_intf.c index 91d33e77b434..de447da02cdb 100644 --- a/drivers/staging/rtl8712/usb_intf.c +++ b/drivers/staging/rtl8712/usb_intf.c @@ -395,9 +395,9 @@ static int r871xu_drv_init(struct usb_interface *pusb_intf, /* step 3. * initialize the dvobj_priv */ - if (!padapter->dvobj_init) - goto error; - else { + if (!padapter->dvobj_init) { + goto error; + } else { status = padapter->dvobj_init(padapter); if (status != _SUCCESS) goto error; @@ -553,8 +553,9 @@ static int r871xu_drv_init(struct usb_interface *pusb_intf, padapter->ledpriv.bRegUseLed = false; break; } - } else + } else { AutoloadFail = false; + } if (((mac[0] == 0xff) && (mac[1] == 0xff) && (mac[2] == 0xff) && (mac[3] == 0xff) && (mac[4] == 0xff) && (mac[5] == 0xff)) || diff --git a/drivers/staging/rtl8712/usb_ops_linux.c b/drivers/staging/rtl8712/usb_ops_linux.c index e33eeedfdddf..f35b3b6a4b8b 100644 --- a/drivers/staging/rtl8712/usb_ops_linux.c +++ b/drivers/staging/rtl8712/usb_ops_linux.c @@ -144,8 +144,9 @@ static unsigned int ffaddr2pipehdl(struct dvobj_priv *pdvobj, u32 addr) pipe = usb_sndbulkpipe(pusbd, 0x0d); break; } - } else + } else { pipe = 0; + } return pipe; } @@ -306,8 +307,9 @@ u32 r8712_usb_read_port(struct intf_hdl *pintfhdl, u32 addr, u32 cnt, u8 *rmem) err = usb_submit_urb(purb, GFP_ATOMIC); if ((err) && (err != (-EPERM))) ret = _FAIL; - } else + } else { ret = _FAIL; + } return ret; } |