diff --git a/core/rtw_ap.c b/core/rtw_ap.c index d61842e..9224e02 100644 --- a/core/rtw_ap.c +++ b/core/rtw_ap.c @@ -888,7 +888,7 @@ int rtw_check_beacon_data(struct adapter *padapter, u8 *pbuf, int len) pbss_network->Rssi = 0; - ether_addr_copy(pbss_network->MacAddress, myid(&(padapter->eeprompriv))); + memcpy(pbss_network->MacAddress, myid(&(padapter->eeprompriv)), ETH_ALEN); /* beacon interval */ p = rtw_get_beacon_interval_from_ie(ie);/* 8: TimeStamp, 2: Beacon Interval 2:Capability */ @@ -1164,7 +1164,7 @@ int rtw_acl_add_sta(struct adapter *padapter, u8 *addr) if (!paclnode->valid) { INIT_LIST_HEAD(&paclnode->list); - ether_addr_copy(paclnode->addr, addr); + memcpy(paclnode->addr, addr, ETH_ALEN); paclnode->valid = true; @@ -1186,6 +1186,7 @@ int rtw_acl_add_sta(struct adapter *padapter, u8 *addr) int rtw_acl_remove_sta(struct adapter *padapter, u8 *addr) { struct list_head *plist, *phead; + int ret = 0; struct rtw_wlan_acl_node *paclnode; struct sta_priv *pstapriv = &padapter->stapriv; struct wlan_acl_pool *pacl_list = &pstapriv->acl_list; @@ -1216,7 +1217,7 @@ int rtw_acl_remove_sta(struct adapter *padapter, u8 *addr) spin_unlock_bh(&(pacl_node_q->lock)); DBG_88E("%s, acl_num =%d\n", __func__, pacl_list->num); - return 0; + return ret; } static void update_bcn_fixed_ie(struct adapter *padapter) @@ -1752,6 +1753,7 @@ u8 ap_free_sta(struct adapter *padapter, struct sta_info *psta, int rtw_ap_inform_ch_switch(struct adapter *padapter, u8 new_ch, u8 ch_offset) { struct list_head *phead, *plist; + int ret = 0; struct sta_info *psta = NULL; struct sta_priv *pstapriv = &padapter->stapriv; struct mlme_ext_priv *pmlmeext = &padapter->mlmeextpriv; @@ -1759,7 +1761,7 @@ int rtw_ap_inform_ch_switch(struct adapter *padapter, u8 new_ch, u8 ch_offset) u8 bc_addr[ETH_ALEN] = {0xff, 0xff, 0xff, 0xff, 0xff, 0xff}; if ((pmlmeinfo->state&0x03) != WIFI_FW_AP_STATE) - return 0; + return ret; DBG_88E(FUNC_NDEV_FMT" with ch:%u, offset:%u\n", FUNC_NDEV_ARG(padapter->pnetdev), new_ch, ch_offset); @@ -1780,12 +1782,13 @@ int rtw_ap_inform_ch_switch(struct adapter *padapter, u8 new_ch, u8 ch_offset) issue_action_spct_ch_switch(padapter, bc_addr, new_ch, ch_offset); - return 0; + return ret; } int rtw_sta_flush(struct adapter *padapter) { struct list_head *phead, *plist; + int ret = 0; struct sta_info *psta = NULL; struct sta_priv *pstapriv = &padapter->stapriv; struct mlme_ext_priv *pmlmeext = &padapter->mlmeextpriv; @@ -1795,7 +1798,7 @@ int rtw_sta_flush(struct adapter *padapter) DBG_88E(FUNC_NDEV_FMT"\n", FUNC_NDEV_ARG(padapter->pnetdev)); if ((pmlmeinfo->state&0x03) != WIFI_FW_AP_STATE) - return 0; + return ret; spin_lock_bh(&pstapriv->asoc_list_lock); phead = &pstapriv->asoc_list; @@ -1819,7 +1822,7 @@ int rtw_sta_flush(struct adapter *padapter) associated_clients_update(padapter, true); - return 0; + return ret; } /* called > TSR LEVEL for USB or SDIO Interface*/ diff --git a/core/rtw_cmd.c b/core/rtw_cmd.c index 4b43462..eddef9c 100644 --- a/core/rtw_cmd.c +++ b/core/rtw_cmd.c @@ -167,7 +167,7 @@ int rtw_cmd_thread(void *context) struct cmd_obj *pcmd; u8 (*cmd_hdl)(struct adapter *padapter, u8 *pbuf); void (*pcmd_callback)(struct adapter *dev, struct cmd_obj *pcmd); - struct adapter *padapter = context; + struct adapter *padapter = (struct adapter *)context; struct cmd_priv *pcmdpriv = &(padapter->cmdpriv); allow_signal(SIGTERM); @@ -433,7 +433,8 @@ u8 rtw_joinbss_cmd(struct adapter *padapter, struct wlan_network *pnetwork) psecnetwork = (struct wlan_bssid_ex *)&psecuritypriv->sec_bss; if (psecnetwork == NULL) { - kfree(pcmd); + if (pcmd != NULL) + kfree(pcmd); res = _FAIL; @@ -455,7 +456,7 @@ u8 rtw_joinbss_cmd(struct adapter *padapter, struct wlan_network *pnetwork) psecnetwork->IELength = 0; /* Added by Albert 2009/02/18 */ - /* If the driver wants to use the bssid to create the connection. */ + /* If the the driver wants to use the bssid to create the connection. */ /* If not, we have to copy the connecting AP's MAC address to it so that */ /* the driver just has the bssid information for PMKIDList searching. */ @@ -637,7 +638,7 @@ u8 rtw_setstakey_cmd(struct adapter *padapter, u8 *psta, u8 unicast_key) ether_addr_copy(psetstakey_para->addr, sta->hwaddr); if (check_fwstate(pmlmepriv, WIFI_STATION_STATE)) - psetstakey_para->algorithm = (unsigned char)psecuritypriv->dot11PrivacyAlgrthm; + psetstakey_para->algorithm = (unsigned char) psecuritypriv->dot11PrivacyAlgrthm; else GET_ENCRY_ALGO(psecuritypriv, sta, psetstakey_para->algorithm, false); diff --git a/core/rtw_debug.c b/core/rtw_debug.c index bc3fe10..1f72f7d 100644 --- a/core/rtw_debug.c +++ b/core/rtw_debug.c @@ -45,7 +45,7 @@ int proc_get_write_reg(char *page, char **start, int proc_set_write_reg(struct file *file, const char __user *buffer, unsigned long count, void *data) { - struct net_device *dev = data; + struct net_device *dev = (struct net_device *)data; struct adapter *padapter = (struct adapter *)rtw_netdev_priv(dev); char tmp[32]; u32 addr, val, len; @@ -577,7 +577,7 @@ int proc_get_rx_signal(char *page, char **start, int proc_set_rx_signal(struct file *file, const char __user *buffer, unsigned long count, void *data) { - struct net_device *dev = data; + struct net_device *dev = (struct net_device *)data; struct adapter *padapter = (struct adapter *)rtw_netdev_priv(dev); char tmp[32]; u32 is_signal_dbg; @@ -627,7 +627,7 @@ int proc_get_ht_enable(char *page, char **start, int proc_set_ht_enable(struct file *file, const char __user *buffer, unsigned long count, void *data) { - struct net_device *dev = data; + struct net_device *dev = (struct net_device *)data; struct adapter *padapter = (struct adapter *)rtw_netdev_priv(dev); struct registry_priv *pregpriv = &padapter->registrypriv; char tmp[32]; @@ -669,7 +669,7 @@ int proc_get_cbw40_enable(char *page, char **start, int proc_set_cbw40_enable(struct file *file, const char __user *buffer, unsigned long count, void *data) { - struct net_device *dev = data; + struct net_device *dev = (struct net_device *)data; struct adapter *padapter = (struct adapter *)rtw_netdev_priv(dev); struct registry_priv *pregpriv = &padapter->registrypriv; char tmp[32]; @@ -710,7 +710,7 @@ int proc_get_ampdu_enable(char *page, char **start, int proc_set_ampdu_enable(struct file *file, const char __user *buffer, unsigned long count, void *data) { - struct net_device *dev = data; + struct net_device *dev = (struct net_device *)data; struct adapter *padapter = (struct adapter *)rtw_netdev_priv(dev); struct registry_priv *pregpriv = &padapter->registrypriv; char tmp[32]; @@ -771,7 +771,7 @@ int proc_get_rx_stbc(char *page, char **start, int proc_set_rx_stbc(struct file *file, const char __user *buffer, unsigned long count, void *data) { - struct net_device *dev = data; + struct net_device *dev = (struct net_device *)data; struct adapter *padapter = (struct adapter *)rtw_netdev_priv(dev); struct registry_priv *pregpriv = &padapter->registrypriv; char tmp[32]; @@ -800,7 +800,7 @@ int proc_get_rssi_disp(char *page, char **start, int proc_set_rssi_disp(struct file *file, const char __user *buffer, unsigned long count, void *data) { - struct net_device *dev = data; + struct net_device *dev = (struct net_device *)data; struct adapter *padapter = (struct adapter *)rtw_netdev_priv(dev); char tmp[32]; u32 enable = 0; diff --git a/core/rtw_efuse.c b/core/rtw_efuse.c index 8816d11..2b62c83 100644 --- a/core/rtw_efuse.c +++ b/core/rtw_efuse.c @@ -106,13 +106,13 @@ efuse_phymap_to_logical(u8 *phymap, u16 _offset, u16 _size_byte, u8 *pbuf) efuseTbl = kzalloc(EFUSE_MAP_LEN_88E, GFP_KERNEL); if (efuseTbl == NULL) { DBG_88E("%s: alloc efuseTbl fail!\n", __func__); - return; + goto exit; } eFuseWord = (u16 **)rtw_malloc2d(EFUSE_MAX_SECTION_88E, EFUSE_MAX_WORD_UNIT, sizeof(u16)); if (eFuseWord == NULL) { DBG_88E("%s: alloc eFuseWord fail!\n", __func__); - goto eFuseWord_failed; + goto exit; } /* 0. Refresh efuse init map as all oxFF. */ @@ -210,10 +210,10 @@ efuse_phymap_to_logical(u8 *phymap, u16 _offset, u16 _size_byte, u8 *pbuf) /* */ exit: - kfree(eFuseWord); - -eFuseWord_failed: kfree(efuseTbl); + + if (eFuseWord) + kfree(eFuseWord); } static void efuse_read_phymap_from_txpktbuf( @@ -250,11 +250,11 @@ static void efuse_read_phymap_from_txpktbuf( while (!(reg_0x143 = usb_read8(adapter, REG_TXPKTBUF_DBG)) && (passing_time = rtw_get_passing_time_ms(start)) < 1000) { DBG_88E("%s polling reg_0x143:0x%02x, reg_0x106:0x%02x\n", __func__, reg_0x143, usb_read8(adapter, 0x106)); - usleep_range(1000, 2000); + msleep(1); } - lo32 = usb_read32(adapter, REG_PKTBUF_DBG_DATA_L); - hi32 = usb_read32(adapter, REG_PKTBUF_DBG_DATA_H); + lo32 = le32_to_cpu((__le32)usb_read32(adapter, REG_PKTBUF_DBG_DATA_L)); + hi32 = le32_to_cpu((__le32)usb_read32(adapter, REG_PKTBUF_DBG_DATA_H)); if (i == 0) { u8 lenc[2]; @@ -322,6 +322,7 @@ void efuse_ReadEFuse(struct adapter *Adapter, u8 efuseType, u16 _offset, u16 _si iol_read_efuse(Adapter, 0, _offset, _size_byte, pbuf); iol_mode_enable(Adapter, 0); } + return; } /* Do not support BT */ @@ -331,56 +332,56 @@ void EFUSE_GetEfuseDefinition(struct adapter *pAdapter, u8 efuseType, u8 type, v case TYPE_EFUSE_MAX_SECTION: { u8 *pMax_section; - pMax_section = pOut; + pMax_section = (u8 *)pOut; *pMax_section = EFUSE_MAX_SECTION_88E; } break; case TYPE_EFUSE_REAL_CONTENT_LEN: { u16 *pu2Tmp; - pu2Tmp = pOut; + pu2Tmp = (u16 *)pOut; *pu2Tmp = EFUSE_REAL_CONTENT_LEN_88E; } break; case TYPE_EFUSE_CONTENT_LEN_BANK: { u16 *pu2Tmp; - pu2Tmp = pOut; + pu2Tmp = (u16 *)pOut; *pu2Tmp = EFUSE_REAL_CONTENT_LEN_88E; } break; case TYPE_AVAILABLE_EFUSE_BYTES_BANK: { u16 *pu2Tmp; - pu2Tmp = pOut; + pu2Tmp = (u16 *)pOut; *pu2Tmp = (u16)(EFUSE_REAL_CONTENT_LEN_88E-EFUSE_OOB_PROTECT_BYTES_88E); } break; case TYPE_AVAILABLE_EFUSE_BYTES_TOTAL: { u16 *pu2Tmp; - pu2Tmp = pOut; + pu2Tmp = (u16 *)pOut; *pu2Tmp = (u16)(EFUSE_REAL_CONTENT_LEN_88E-EFUSE_OOB_PROTECT_BYTES_88E); } break; case TYPE_EFUSE_MAP_LEN: { u16 *pu2Tmp; - pu2Tmp = pOut; + pu2Tmp = (u16 *)pOut; *pu2Tmp = (u16)EFUSE_MAP_LEN_88E; } break; case TYPE_EFUSE_PROTECT_BYTES_BANK: { u8 *pu1Tmp; - pu1Tmp = pOut; + pu1Tmp = (u8 *)pOut; *pu1Tmp = (u8)(EFUSE_OOB_PROTECT_BYTES_88E); } break; default: { u8 *pu1Tmp; - pu1Tmp = pOut; + pu1Tmp = (u8 *)pOut; *pu1Tmp = 0; } break; @@ -637,9 +638,10 @@ static bool hal_EfusePgPacketWrite2ByteHeader(struct adapter *pAdapter, u8 efuse if ((tmp_header & 0x0F) == 0x0F) { /* word_en PG fail */ if (repeatcnt++ > EFUSE_REPEAT_THRESHOLD_) { return false; + } else { + efuse_addr++; + continue; } - efuse_addr++; - continue; } else if (pg_header != tmp_header) { /* offset PG fail */ struct pgpkt fixPkt; fixPkt.offset = ((pg_header_temp & 0xE0) >> 5) | ((tmp_header & 0xF0) >> 1); @@ -706,13 +708,14 @@ static bool hal_EfusePgPacketWriteData(struct adapter *pAdapter, u8 efuseType, u if (badworden == 0x0F) { /* write ok */ return true; + } else { + /* reorganize other pg packet */ + PgWriteSuccess = Efuse_PgPacketWrite(pAdapter, pTargetPkt->offset, badworden, pTargetPkt->data); + if (!PgWriteSuccess) + return false; + else + return true; } - /* reorganize other pg packet */ - PgWriteSuccess = Efuse_PgPacketWrite(pAdapter, pTargetPkt->offset, badworden, pTargetPkt->data); - if (!PgWriteSuccess) - return false; - else - return true; } static bool diff --git a/core/rtw_ieee80211.c b/core/rtw_ieee80211.c index f2c3ca7..755d3ef 100644 --- a/core/rtw_ieee80211.c +++ b/core/rtw_ieee80211.c @@ -159,7 +159,7 @@ u8 *rtw_set_ie return pbuf + len + 2; } -inline u8 *rtw_set_ie_ch_switch(u8 *buf, u32 *buf_len, u8 ch_switch_mode, +inline u8 *rtw_set_ie_ch_switch (u8 *buf, u32 *buf_len, u8 ch_switch_mode, u8 new_ch, u8 ch_switch_cnt) { u8 ie_data[3]; @@ -870,7 +870,7 @@ static int rtw_ieee802_11_parse_vendor_specific(u8 *pos, uint elen, if (elen < 4) { if (show_errors) { DBG_88E("short vendor specific information element ignored (len=%lu)\n", - (unsigned long)elen); + (unsigned long) elen); } return -1; } @@ -890,7 +890,7 @@ static int rtw_ieee802_11_parse_vendor_specific(u8 *pos, uint elen, case WME_OUI_TYPE: /* this is a Wi-Fi WME info. element */ if (elen < 5) { DBG_88E("short WME information element ignored (len=%lu)\n", - (unsigned long)elen); + (unsigned long) elen); return -1; } switch (pos[4]) { @@ -905,7 +905,7 @@ static int rtw_ieee802_11_parse_vendor_specific(u8 *pos, uint elen, break; default: DBG_88E("unknown WME information element ignored (subtype=%d len=%lu)\n", - pos[4], (unsigned long)elen); + pos[4], (unsigned long) elen); return -1; } break; @@ -916,7 +916,7 @@ static int rtw_ieee802_11_parse_vendor_specific(u8 *pos, uint elen, break; default: DBG_88E("Unknown Microsoft information element ignored (type=%d len=%lu)\n", - pos[3], (unsigned long)elen); + pos[3], (unsigned long) elen); return -1; } break; @@ -929,13 +929,13 @@ static int rtw_ieee802_11_parse_vendor_specific(u8 *pos, uint elen, break; default: DBG_88E("Unknown Broadcom information element ignored (type=%d len=%lu)\n", - pos[3], (unsigned long)elen); + pos[3], (unsigned long) elen); return -1; } break; default: DBG_88E("unknown vendor specific information element ignored (vendor OUI %02x:%02x:%02x len=%lu)\n", - pos[0], pos[1], pos[2], (unsigned long)elen); + pos[0], pos[1], pos[2], (unsigned long) elen); return -1; } return 0; @@ -969,7 +969,7 @@ enum parse_res rtw_ieee802_11_parse_elems(u8 *start, uint len, if (elen > left) { if (show_errors) { DBG_88E("IEEE 802.11 element parse failed (id=%d elen=%d left=%lu)\n", - id, elen, (unsigned long)left); + id, elen, (unsigned long) left); } return ParseFailed; } diff --git a/core/rtw_ioctl_set.c b/core/rtw_ioctl_set.c index 2faf6b2..fc280ce 100644 --- a/core/rtw_ioctl_set.c +++ b/core/rtw_ioctl_set.c @@ -98,6 +98,7 @@ u8 rtw_do_join(struct adapter *padapter) pibss = padapter->registrypriv.dev_network.MacAddress; + memset(&pdev_network->Ssid, 0, sizeof(struct ndis_802_11_ssid)); memcpy(&pdev_network->Ssid, &pmlmepriv->assoc_ssid, sizeof(struct ndis_802_11_ssid)); rtw_update_registrypriv_dev_network(padapter); diff --git a/core/rtw_led.c b/core/rtw_led.c index 2aa6251..384be22 100644 --- a/core/rtw_led.c +++ b/core/rtw_led.c @@ -28,7 +28,7 @@ /* */ void BlinkTimerCallback(void *data) { - struct LED_871x *pLed = data; + struct LED_871x *pLed = (struct LED_871x *)data; struct adapter *padapter = pLed->padapter; if ((padapter->bSurpriseRemoved) || (padapter->bDriverStopped)) diff --git a/core/rtw_mlme.c b/core/rtw_mlme.c index d4632da..149c271 100644 --- a/core/rtw_mlme.c +++ b/core/rtw_mlme.c @@ -674,6 +674,7 @@ void rtw_surveydone_event_callback(struct adapter *adapter, u8 *pbuf) RT_TRACE(_module_rtl871x_mlme_c_, _drv_err_, ("switching to adhoc master\n")); + memset(&pdev_network->Ssid, 0, sizeof(struct ndis_802_11_ssid)); memcpy(&pdev_network->Ssid, &pmlmepriv->assoc_ssid, sizeof(struct ndis_802_11_ssid)); rtw_update_registrypriv_dev_network(adapter); @@ -1333,6 +1334,7 @@ void rtw_stadel_event_callback(struct adapter *adapter, u8 *pbuf) memcpy(pdev_network, &tgt_network->network, get_wlan_bssid_ex_sz(&tgt_network->network)); + memset(&pdev_network->Ssid, 0, sizeof(struct ndis_802_11_ssid)); memcpy(&pdev_network->Ssid, &pmlmepriv->assoc_ssid, sizeof(struct ndis_802_11_ssid)); rtw_update_registrypriv_dev_network(adapter); @@ -1362,7 +1364,7 @@ void rtw_cpwm_event_callback(struct adapter *padapter, u8 *pbuf) */ void _rtw_join_timeout_handler (void *function_context) { - struct adapter *adapter = function_context; + struct adapter *adapter = (struct adapter *)function_context; struct mlme_priv *pmlmepriv = &adapter->mlmepriv; int do_join_r; @@ -1404,7 +1406,7 @@ void _rtw_join_timeout_handler (void *function_context) */ void rtw_scan_timeout_handler (void *function_context) { - struct adapter *adapter = function_context; + struct adapter *adapter = (struct adapter *)function_context; struct mlme_priv *pmlmepriv = &adapter->mlmepriv; DBG_88E(FUNC_ADPT_FMT" fw_state=%x\n", FUNC_ADPT_ARG(adapter), get_fwstate(pmlmepriv)); @@ -1435,7 +1437,7 @@ void rtw_dynamic_check_timer_handlder(void *function_context) struct registry_priv *pregistrypriv = &adapter->registrypriv; if (!adapter) - return; + goto exit; if (!adapter->hw_init_completed) goto exit; if ((adapter->bDriverStopped) || (adapter->bSurpriseRemoved)) @@ -2115,7 +2117,7 @@ void rtw_issue_addbareq_cmd(struct adapter *padapter, struct xmit_frame *pxmitfr if (0 == issued) { DBG_88E("rtw_issue_addbareq_cmd, p=%d\n", priority); psta->htpriv.candidate_tid_bitmap |= BIT((u8)priority); - rtw_addbareq_cmd(padapter, (u8)priority, pattrib->ra); + rtw_addbareq_cmd(padapter, (u8) priority, pattrib->ra); } } } diff --git a/core/rtw_mlme_ext.c b/core/rtw_mlme_ext.c index e4b7ee4..1816154 100644 --- a/core/rtw_mlme_ext.c +++ b/core/rtw_mlme_ext.c @@ -227,7 +227,7 @@ static void init_mlme_ext_priv_value(struct adapter *padapter) pmlmeext->cur_channel = padapter->registrypriv.channel; pmlmeext->cur_bwmode = HT_CHANNEL_WIDTH_20; pmlmeext->cur_ch_offset = HAL_PRIME_CHNL_OFFSET_DONT_CARE; - pmlmeext->oper_channel = pmlmeext->cur_channel; + pmlmeext->oper_channel = pmlmeext->cur_channel ; pmlmeext->oper_bwmode = pmlmeext->cur_bwmode; pmlmeext->oper_ch_offset = pmlmeext->cur_ch_offset; pmlmeext->retry = 0; @@ -371,6 +371,7 @@ static u8 init_channel_set(struct adapter *padapter, u8 ChannelPlan, struct rt_c int init_mlme_ext_priv(struct adapter *padapter) { + int res = _SUCCESS; struct registry_priv *pregistrypriv = &padapter->registrypriv; struct mlme_ext_priv *pmlmeext = &padapter->mlmeextpriv; struct mlme_priv *pmlmepriv = &(padapter->mlmepriv); @@ -396,7 +397,7 @@ int init_mlme_ext_priv(struct adapter *padapter) pmlmeext->active_keep_alive_check = true; - return _SUCCESS; + return res; } void free_mlme_ext_priv(struct mlme_ext_priv *pmlmeext) @@ -944,7 +945,7 @@ unsigned int OnAssocReq(struct adapter *padapter, struct recv_frame *precv_frame } pstat = rtw_get_stainfo(pstapriv, GetAddr2Ptr(pframe)); - if (pstat == NULL) { + if (pstat == (struct sta_info *)NULL) { status = _RSON_CLS2_; goto asoc_class2_error; } @@ -1553,6 +1554,7 @@ unsigned int OnAtim(struct adapter *padapter, struct recv_frame *precv_frame) unsigned int on_action_spct(struct adapter *padapter, struct recv_frame *precv_frame) { + unsigned int ret = _FAIL; struct sta_info *psta = NULL; struct sta_priv *pstapriv = &padapter->stapriv; u8 *pframe = precv_frame->rx_data; @@ -1585,7 +1587,7 @@ unsigned int on_action_spct(struct adapter *padapter, struct recv_frame *precv_f } exit: - return _FAIL; + return ret; } unsigned int OnAction_qos(struct adapter *padapter, struct recv_frame *precv_frame) @@ -1998,7 +2000,7 @@ void issue_beacon(struct adapter *padapter, int timeout_ms) DBG_88E("%s, alloc mgnt frame fail\n", __func__); return; } -#if defined(CONFIG_88EU_AP_MODE) +#if defined (CONFIG_88EU_AP_MODE) spin_lock_bh(&pmlmepriv->bcn_update_lock); #endif /* if defined (CONFIG_88EU_AP_MODE) */ @@ -2025,7 +2027,7 @@ void issue_beacon(struct adapter *padapter, int timeout_ms) SetFrameSubType(pframe, WIFI_BEACON); pframe += sizeof(struct rtw_ieee80211_hdr_3addr); - pattrib->pktlen = sizeof(struct rtw_ieee80211_hdr_3addr); + pattrib->pktlen = sizeof (struct rtw_ieee80211_hdr_3addr); if ((pmlmeinfo->state&0x03) == WIFI_FW_AP_STATE) { int len_diff; @@ -2040,8 +2042,8 @@ void issue_beacon(struct adapter *padapter, int timeout_ms) ); pframe += (cur_network->IELength+len_diff); pattrib->pktlen += (cur_network->IELength+len_diff); - wps_ie = rtw_get_wps_ie(pmgntframe->buf_addr+TXDESC_OFFSET+sizeof(struct rtw_ieee80211_hdr_3addr)+_BEACON_IE_OFFSET_, - pattrib->pktlen-sizeof(struct rtw_ieee80211_hdr_3addr)-_BEACON_IE_OFFSET_, NULL, &wps_ielen); + wps_ie = rtw_get_wps_ie(pmgntframe->buf_addr+TXDESC_OFFSET+sizeof (struct rtw_ieee80211_hdr_3addr)+_BEACON_IE_OFFSET_, + pattrib->pktlen-sizeof (struct rtw_ieee80211_hdr_3addr)-_BEACON_IE_OFFSET_, NULL, &wps_ielen); if (wps_ie && wps_ielen > 0) rtw_get_wps_attr_content(wps_ie, wps_ielen, WPS_ATTR_SELECTED_REGISTRAR, (u8 *)(&sr), NULL); if (sr != 0) @@ -2099,7 +2101,7 @@ void issue_beacon(struct adapter *padapter, int timeout_ms) /* todo:HT for adhoc */ _issue_bcn: -#if defined(CONFIG_88EU_AP_MODE) +#if defined (CONFIG_88EU_AP_MODE) pmlmepriv->update_bcn = false; spin_unlock_bh(&pmlmepriv->bcn_update_lock); @@ -2128,7 +2130,7 @@ void issue_probersp(struct adapter *padapter, unsigned char *da, u8 is_valid_p2p __le16 *fctrl; unsigned char *mac, *bssid; struct xmit_priv *pxmitpriv = &(padapter->xmitpriv); -#if defined(CONFIG_88EU_AP_MODE) +#if defined (CONFIG_88EU_AP_MODE) u8 *pwps_ie; uint wps_ielen; struct mlme_priv *pmlmepriv = &padapter->mlmepriv; @@ -2321,8 +2323,8 @@ static int _issue_probereq(struct adapter *padapter, struct ndis_802_11_ssid *ps pmlmeext->mgnt_seq++; SetFrameSubType(pframe, WIFI_PROBEREQ); - pframe += sizeof(struct rtw_ieee80211_hdr_3addr); - pattrib->pktlen = sizeof(struct rtw_ieee80211_hdr_3addr); + pframe += sizeof (struct rtw_ieee80211_hdr_3addr); + pattrib->pktlen = sizeof (struct rtw_ieee80211_hdr_3addr); if (pssid) pframe = rtw_set_ie(pframe, _SSID_IE_, pssid->SsidLength, pssid->Ssid, &(pattrib->pktlen)); @@ -3207,7 +3209,7 @@ exit: return ret; } -void issue_action_spct_ch_switch(struct adapter *padapter, u8 *ra, u8 new_ch, u8 ch_offset) +void issue_action_spct_ch_switch (struct adapter *padapter, u8 *ra, u8 new_ch, u8 ch_offset) { struct xmit_frame *pmgntframe; struct pkt_attrib *pattrib; @@ -3258,7 +3260,7 @@ void issue_action_spct_ch_switch(struct adapter *padapter, u8 *ra, u8 new_ch, u8 pframe = rtw_set_fixed_ie(pframe, 1, &(action), &(pattrib->pktlen)); } - pframe = rtw_set_ie_ch_switch(pframe, &(pattrib->pktlen), 0, new_ch, 0); + pframe = rtw_set_ie_ch_switch (pframe, &(pattrib->pktlen), 0, new_ch, 0); pframe = rtw_set_ie_secondary_ch_offset(pframe, &(pattrib->pktlen), hal_ch_offset_to_secondary_ch_offset(ch_offset)); @@ -3355,7 +3357,7 @@ void issue_action_BA(struct adapter *padapter, unsigned char *raddr, unsigned ch pframe = rtw_set_fixed_ie(pframe, 1, &(pmlmeinfo->ADDBA_req.dialog_token), &(pattrib->pktlen)); pframe = rtw_set_fixed_ie(pframe, 2, (unsigned char *)(&status), &(pattrib->pktlen)); - BA_para_set = le16_to_cpu(pmlmeinfo->ADDBA_req.BA_para_set) & 0x3f; + BA_para_set = pmlmeinfo->ADDBA_req.BA_para_set & 0x3f; rtw_hal_get_def_var(padapter, HW_VAR_MAX_RX_AMPDU_FACTOR, &max_rx_ampdu_factor); switch (max_rx_ampdu_factor) { case MAX_AMPDU_FACTOR_64K: @@ -4833,7 +4835,7 @@ void linked_status_chk(struct adapter *padapter) void survey_timer_hdl(void *function_context) { - struct adapter *padapter = function_context; + struct adapter *padapter = (struct adapter *)function_context; struct cmd_obj *ph2c; struct sitesurvey_parm *psurveyPara; struct cmd_priv *pcmdpriv = &padapter->cmdpriv; @@ -4910,7 +4912,7 @@ void link_timer_hdl(void *function_context) void addba_timer_hdl(void *function_context) { - struct sta_info *psta = function_context; + struct sta_info *psta = (struct sta_info *)function_context; struct ht_priv *phtpriv; if (!psta) diff --git a/core/rtw_pwrctrl.c b/core/rtw_pwrctrl.c index df463a2..27ed83c 100644 --- a/core/rtw_pwrctrl.c +++ b/core/rtw_pwrctrl.c @@ -279,11 +279,12 @@ void rtw_ps_processor(struct adapter *padapter) exit: rtw_set_pwr_state_check_timer(&padapter->pwrctrlpriv); pwrpriv->ps_processing = false; + return; } static void pwr_state_check_handler(void *FunctionContext) { - struct adapter *padapter = FunctionContext; + struct adapter *padapter = (struct adapter *)FunctionContext; rtw_ps_cmd(padapter); } @@ -526,7 +527,7 @@ void rtw_init_pwrctrl_priv(struct adapter *padapter) pwrctrlpriv->LpsIdleCount = 0; if (padapter->registrypriv.mp_mode == 1) - pwrctrlpriv->power_mgnt = PS_MODE_ACTIVE; + pwrctrlpriv->power_mgnt = PS_MODE_ACTIVE ; else pwrctrlpriv->power_mgnt = padapter->registrypriv.power_mgnt;/* PS_MODE_MIN; */ pwrctrlpriv->bLeisurePs = (PS_MODE_ACTIVE != pwrctrlpriv->power_mgnt) ? true : false; @@ -576,7 +577,7 @@ int _rtw_pwr_wakeup(struct adapter *padapter, u32 ips_deffer_ms, const char *cal if (pwrpriv->ps_processing) { DBG_88E("%s wait ps_processing...\n", __func__); while (pwrpriv->ps_processing && rtw_get_passing_time_ms(start) <= 3000) - usleep_range(1000, 3000); + msleep(10); if (pwrpriv->ps_processing) DBG_88E("%s wait ps_processing timeout\n", __func__); else diff --git a/core/rtw_recv.c b/core/rtw_recv.c index bd79e9e..4d56dba 100644 --- a/core/rtw_recv.c +++ b/core/rtw_recv.c @@ -46,7 +46,7 @@ void rtw_signal_stat_timer_hdl(RTW_TIMER_HDL_ARGS); void _rtw_init_sta_recv_priv(struct sta_recv_priv *psta_recvpriv) { - memset((u8 *)psta_recvpriv, 0, sizeof(struct sta_recv_priv)); + memset((u8 *)psta_recvpriv, 0, sizeof (struct sta_recv_priv)); spin_lock_init(&psta_recvpriv->lock); @@ -109,7 +109,7 @@ exit: return res; } -void _rtw_free_recv_priv(struct recv_priv *precvpriv) +void _rtw_free_recv_priv (struct recv_priv *precvpriv) { struct adapter *padapter = precvpriv->adapter; @@ -124,7 +124,7 @@ void _rtw_free_recv_priv(struct recv_priv *precvpriv) } -struct recv_frame *_rtw_alloc_recvframe(struct __queue *pfree_recv_queue) +struct recv_frame *_rtw_alloc_recvframe (struct __queue *pfree_recv_queue) { struct recv_frame *hdr; struct list_head *plist, *phead; @@ -797,7 +797,7 @@ exit: return ret; } -static int ap2sta_data_frame( +static int ap2sta_data_frame ( struct adapter *adapter, struct recv_frame *precv_frame, struct sta_info **psta) @@ -1266,7 +1266,7 @@ static int validate_recv_frame(struct adapter *adapter, u8 bDumpRxPkt; struct rx_pkt_attrib *pattrib = &precv_frame->attrib; u8 *ptr = precv_frame->rx_data; - u8 ver = (unsigned char)(*ptr)&0x3; + u8 ver = (unsigned char) (*ptr)&0x3; struct mlme_ext_priv *pmlmeext = &adapter->mlmeextpriv; @@ -1373,6 +1373,7 @@ static int wlanhdr_to_ethhdr(struct recv_frame *precvframe) u8 *psnap_type; struct ieee80211_snap_hdr *psnap; + int ret = _SUCCESS; struct adapter *adapter = precvframe->adapter; struct mlme_priv *pmlmepriv = &adapter->mlmepriv; u8 *ptr = precvframe->rx_data; @@ -1427,7 +1428,7 @@ static int wlanhdr_to_ethhdr(struct recv_frame *precvframe) memcpy(ptr+12, &be_tmp, 2); } - return _SUCCESS; + return ret; } /* perform defrag */ @@ -1623,6 +1624,7 @@ static int amsdu_to_msdu(struct adapter *padapter, struct recv_frame *prframe) struct sk_buff *sub_skb, *subframes[MAX_SUBFRAME_COUNT]; struct recv_priv *precvpriv = &padapter->recvpriv; struct __queue *pfree_recv_queue = &(precvpriv->free_recv_queue); + int ret = _SUCCESS; nr_subframes = 0; pattrib = &prframe->attrib; @@ -1726,7 +1728,7 @@ exit: prframe->len = 0; rtw_free_recvframe(prframe, pfree_recv_queue);/* free this recv_frame */ - return _SUCCESS; + return ret; } static int check_indicate_seq(struct recv_reorder_ctrl *preorder_ctrl, u16 seq_num) @@ -1947,7 +1949,7 @@ _err_exit: void rtw_reordering_ctrl_timeout_handler(void *pcontext) { - struct recv_reorder_ctrl *preorder_ctrl = pcontext; + struct recv_reorder_ctrl *preorder_ctrl = (struct recv_reorder_ctrl *)pcontext; struct adapter *padapter = preorder_ctrl->padapter; struct __queue *ppending_recvframe_queue = &preorder_ctrl->pending_recvframe_queue; @@ -1979,7 +1981,7 @@ static int process_recv_indicatepkts(struct adapter *padapter, } } } else { /* B/G mode */ - retval = wlanhdr_to_ethhdr(prframe); + retval = wlanhdr_to_ethhdr (prframe); if (retval != _SUCCESS) { RT_TRACE(_module_rtl871x_recv_c_, _drv_err_, ("wlanhdr_to_ethhdr: drop pkt\n")); return retval; diff --git a/core/rtw_security.c b/core/rtw_security.c index bd8d60a..f9096a5 100644 --- a/core/rtw_security.c +++ b/core/rtw_security.c @@ -189,7 +189,7 @@ void rtw_wep_encrypt(struct adapter *padapter, u8 *pxmitframe) arcfour_encrypt(&mycontext, payload+length, crc, 4); pframe += pxmitpriv->frag_len; - pframe = (u8 *)round_up((size_t)(pframe), 4); + pframe = (u8 *) round_up((size_t)(pframe), 4); } } } @@ -258,7 +258,7 @@ static void secmicputuint32(u8 *p, u32 val) { long i; for (i = 0; i < 4; i++) { - *p++ = (u8)(val & 0xff); + *p++ = (u8) (val & 0xff); val >>= 8; } } @@ -621,14 +621,14 @@ u32 rtw_tkip_encrypt(struct adapter *padapter, u8 *pxmitframe) arcfour_encrypt(&mycontext, payload, payload, length); arcfour_encrypt(&mycontext, payload+length, crc, 4); } else { - length = pxmitpriv->frag_len-pattrib->hdrlen-pattrib->iv_len-pattrib->icv_len; + length = pxmitpriv->frag_len-pattrib->hdrlen-pattrib->iv_len-pattrib->icv_len ; *((__le32 *)crc) = getcrc32(payload, length);/* modified by Amy*/ arcfour_init(&mycontext, rc4key, 16); arcfour_encrypt(&mycontext, payload, payload, length); arcfour_encrypt(&mycontext, payload+length, crc, 4); pframe += pxmitpriv->frag_len; - pframe = (u8 *)round_up((size_t)(pframe), 4); + pframe = (u8 *) round_up((size_t)(pframe), 4); } } } else { @@ -953,8 +953,8 @@ static void construct_mic_iv(u8 *mic_iv, int qc_exists, int a4_exists, u8 *mpdu, mic_iv[i] = mpdu[i + 8]; /* mic_iv[2:7] = A2[0:5] = mpdu[10:15] */ for (i = 8; i < 14; i++) mic_iv[i] = pn_vector[13 - i]; /* mic_iv[8:13] = PN[5:0] */ - mic_iv[14] = (unsigned char)(payload_length / 256); - mic_iv[15] = (unsigned char)(payload_length % 256); + mic_iv[14] = (unsigned char) (payload_length / 256); + mic_iv[15] = (unsigned char) (payload_length % 256); } /************************************************/ @@ -1045,8 +1045,8 @@ static void construct_ctr_preload(u8 *ctr_preload, int a4_exists, int qc_exists, ctr_preload[i] = mpdu[i + 8]; /* ctr_preload[2:7] = A2[0:5] = mpdu[10:15] */ for (i = 8; i < 14; i++) ctr_preload[i] = pn_vector[13 - i]; /* ctr_preload[8:13] = PN[5:0] */ - ctr_preload[14] = (unsigned char)(c / 256); /* Ctr */ - ctr_preload[15] = (unsigned char)(c % 256); + ctr_preload[14] = (unsigned char) (c / 256); /* Ctr */ + ctr_preload[15] = (unsigned char) (c % 256); } /************************************/ @@ -1219,7 +1219,7 @@ u32 rtw_aes_encrypt(struct adapter *padapter, u8 *pxmitframe) pframe = ((struct xmit_frame *)pxmitframe)->buf_addr + hw_hdr_offset; /* 4 start to encrypt each fragment */ - if (pattrib->encrypt == _AES_) { + if ((pattrib->encrypt == _AES_)) { if (pattrib->psta) stainfo = pattrib->psta; else @@ -1238,11 +1238,11 @@ u32 rtw_aes_encrypt(struct adapter *padapter, u8 *pxmitframe) aes_cipher(prwskey, pattrib->hdrlen, pframe, length); } else{ - length = pxmitpriv->frag_len-pattrib->hdrlen-pattrib->iv_len-pattrib->icv_len; + length = pxmitpriv->frag_len-pattrib->hdrlen-pattrib->iv_len-pattrib->icv_len ; aes_cipher(prwskey, pattrib->hdrlen, pframe, length); pframe += pxmitpriv->frag_len; - pframe = (u8 *)round_up((size_t)(pframe), 8); + pframe = (u8 *) round_up((size_t)(pframe), 8); } } } else{ @@ -1460,7 +1460,7 @@ u32 rtw_aes_decrypt(struct adapter *padapter, u8 *precvframe) u32 res = _SUCCESS; pframe = (unsigned char *)((struct recv_frame *)precvframe)->rx_data; /* 4 start to encrypt each fragment */ - if (prxattrib->encrypt == _AES_) { + if ((prxattrib->encrypt == _AES_)) { stainfo = rtw_get_stainfo(&padapter->stapriv, &prxattrib->ta[0]); if (stainfo != NULL) { RT_TRACE(_module_rtl871x_security_c_, _drv_err_, ("rtw_aes_decrypt: stainfo!= NULL!!!\n")); diff --git a/core/rtw_sta_mgt.c b/core/rtw_sta_mgt.c index dc9d0dd..e1dc8fa 100644 --- a/core/rtw_sta_mgt.c +++ b/core/rtw_sta_mgt.c @@ -29,7 +29,7 @@ static void _rtw_init_stainfo(struct sta_info *psta) { - memset((u8 *)psta, 0, sizeof(struct sta_info)); + memset((u8 *)psta, 0, sizeof (struct sta_info)); spin_lock_init(&psta->lock); INIT_LIST_HEAD(&psta->list); diff --git a/core/rtw_wlan_util.c b/core/rtw_wlan_util.c index 324c1a7..d300369 100644 --- a/core/rtw_wlan_util.c +++ b/core/rtw_wlan_util.c @@ -1394,6 +1394,7 @@ unsigned char check_assoc_AP(u8 *pframe, uint len) DBG_88E("link to Artheros AP\n"); return HT_IOT_PEER_ATHEROS; } else if ((!memcmp(pIE->data, BROADCOM_OUI1, 3)) || + (!memcmp(pIE->data, BROADCOM_OUI2, 3)) || (!memcmp(pIE->data, BROADCOM_OUI2, 3))) { DBG_88E("link to Broadcom AP\n"); return HT_IOT_PEER_BROADCOM; diff --git a/core/rtw_xmit.c b/core/rtw_xmit.c index 7a71df1..639ace0 100644 --- a/core/rtw_xmit.c +++ b/core/rtw_xmit.c @@ -37,7 +37,7 @@ static void _init_txservq(struct tx_servq *ptxservq) void _rtw_init_sta_xmit_priv(struct sta_xmit_priv *psta_xmitpriv) { - memset((unsigned char *)psta_xmitpriv, 0, sizeof(struct sta_xmit_priv)); + memset((unsigned char *)psta_xmitpriv, 0, sizeof (struct sta_xmit_priv)); spin_lock_init(&psta_xmitpriv->lock); _init_txservq(&psta_xmitpriv->be_q); _init_txservq(&psta_xmitpriv->bk_q); @@ -223,7 +223,7 @@ exit: return res; } -void _rtw_free_xmit_priv(struct xmit_priv *pxmitpriv) +void _rtw_free_xmit_priv (struct xmit_priv *pxmitpriv) { int i; struct adapter *padapter = pxmitpriv->adapter; @@ -691,7 +691,7 @@ static s32 xmitframe_addmic(struct adapter *padapter, struct xmit_frame *pxmitfr payload = pframe; for (curfragnum = 0; curfragnum < pattrib->nr_frags; curfragnum++) { - payload = (u8 *)round_up((size_t)(payload), 4); + payload = (u8 *) round_up((size_t)(payload), 4); RT_TRACE(_module_rtl871x_xmit_c_, _drv_err_, ("=== curfragnum=%d, pframe = 0x%.2x, 0x%.2x, 0x%.2x, 0x%.2x, 0x%.2x, 0x%.2x, 0x%.2x, 0x%.2x,!!!\n", curfragnum, *payload, *(payload+1), @@ -772,7 +772,7 @@ static s32 xmitframe_swencrypt(struct adapter *padapter, struct xmit_frame *pxmi return _SUCCESS; } -s32 rtw_make_wlanhdr(struct adapter *padapter, u8 *hdr, struct pkt_attrib *pattrib) +s32 rtw_make_wlanhdr (struct adapter *padapter , u8 *hdr, struct pkt_attrib *pattrib) { u16 *qc; @@ -1025,7 +1025,8 @@ s32 rtw_xmitframe_coalesce(struct adapter *padapter, struct sk_buff *pkt, struct /* adding icv, if necessary... */ if (pattrib->iv_len) { - switch (pattrib->encrypt) { + if (psta != NULL) { + switch (pattrib->encrypt) { case _WEP40_: case _WEP104_: WEP_IV(pattrib->iv, psta->dot11txpn, pattrib->key_idx); @@ -1042,6 +1043,7 @@ s32 rtw_xmitframe_coalesce(struct adapter *padapter, struct sk_buff *pkt, struct else AES_IV(pattrib->iv, psta->dot11txpn, 0); break; + } } memcpy(pframe, pattrib->iv, pattrib->iv_len); @@ -1096,7 +1098,7 @@ s32 rtw_xmitframe_coalesce(struct adapter *padapter, struct sk_buff *pkt, struct addr = (size_t)(pframe); - mem_start = (unsigned char *)round_up(addr, 4) + hw_hdr_offset; + mem_start = (unsigned char *) round_up(addr, 4) + hw_hdr_offset; memcpy(mem_start, pbuf_start + hw_hdr_offset, pattrib->hdrlen); } diff --git a/hal/bb_cfg.c b/hal/bb_cfg.c index 1e963bf..80e8cc9 100644 --- a/hal/bb_cfg.c +++ b/hal/bb_cfg.c @@ -173,7 +173,7 @@ static bool set_baseband_agc_config(struct adapter *adapt) u32 v1 = array[i]; u32 v2 = array[i+1]; - if (v1 < 0xCDCDCDCD) { + if (v1 < 0xCDCDCDCD){ phy_set_bb_reg(adapt, v1, bMaskDWord, v2); udelay(1); } @@ -552,7 +552,7 @@ static void store_pwrindex_offset(struct adapter *Adapter, u32 regaddr, u32 bitm } } -static void rtl_addr_delay(struct adapter *adapt, u32 addr, u32 bit_mask, u32 data) +static void rtl_addr_delay(struct adapter *adapt, u32 addr, u32 bit_mask ,u32 data) { if (addr == 0xfe) { msleep(50); diff --git a/hal/fw.c b/hal/fw.c index 3b28754..17b7f37 100644 --- a/hal/fw.c +++ b/hal/fw.c @@ -84,7 +84,7 @@ static void _rtl88e_fw_block_write(struct adapter *adapt, static void _rtl88e_fill_dummy(u8 *pfwbuf, u32 *pfwlen) { u32 fwlen = *pfwlen; - u8 remain = (u8)(fwlen % 4); + u8 remain = (u8) (fwlen % 4); remain = (remain == 0) ? 0 : (4 - remain); @@ -101,7 +101,7 @@ static void _rtl88e_fw_page_write(struct adapter *adapt, u32 page, const u8 *buffer, u32 size) { u8 value8; - u8 u8page = (u8)(page & 0x07); + u8 u8page = (u8) (page & 0x07); value8 = (usb_read8(adapt, REG_MCUFWDL + 2) & 0xF8) | u8page; @@ -193,13 +193,13 @@ int rtl88eu_download_fw(struct adapter *adapt) u32 fwsize; int err; - if (request_firmware(&fw, fw_name, device)) { + if (request_firmware(&fw, fw_name, device)){ dev_err(device, "Firmware %s not available\n", fw_name); return -ENOENT; } if (fw->size > FW_8188E_SIZE) { - dev_err(device, "Firmware size exceed 0x%X. Check it.\n", + dev_err(device,"Firmware size exceed 0x%X. Check it.\n", FW_8188E_SIZE); return -1; } diff --git a/hal/mac_cfg.c b/hal/mac_cfg.c index febc83a..c0e7fa9 100644 --- a/hal/mac_cfg.c +++ b/hal/mac_cfg.c @@ -127,7 +127,7 @@ bool rtl88eu_phy_mac_config(struct adapter *adapt) ptrarray = array_MAC_REG_8188E; for (i = 0; i < arraylength; i = i + 2) - usb_write8(adapt, ptrarray[i], (u8)ptrarray[i + 1]); + usb_write8(adapt, ptrarray[i], (u8) ptrarray[i + 1]); usb_write8(adapt, REG_MAX_AGGR_NUM, MAX_AGGR_NUM); return true; diff --git a/hal/odm.c b/hal/odm.c index 9873998..e4df837 100644 --- a/hal/odm.c +++ b/hal/odm.c @@ -437,8 +437,8 @@ void odm_CommonInfoSelfInit(struct odm_dm_struct *pDM_Odm) { struct adapter *adapter = pDM_Odm->Adapter; - pDM_Odm->bCckHighPower = (bool)phy_query_bb_reg(adapter, 0x824, BIT9); - pDM_Odm->RFPathRxEnable = (u8)phy_query_bb_reg(adapter, 0xc04, 0x0F); + pDM_Odm->bCckHighPower = (bool) phy_query_bb_reg(adapter, 0x824, BIT9); + pDM_Odm->RFPathRxEnable = (u8) phy_query_bb_reg(adapter, 0xc04, 0x0F); ODM_InitDebugSetting(pDM_Odm); } @@ -529,7 +529,7 @@ void odm_DIGInit(struct odm_dm_struct *pDM_Odm) struct adapter *adapter = pDM_Odm->Adapter; struct rtw_dig *pDM_DigTable = &pDM_Odm->DM_DigTable; - pDM_DigTable->CurIGValue = (u8)phy_query_bb_reg(adapter, ODM_REG_IGI_A_11N, ODM_BIT_IGI_11N); + pDM_DigTable->CurIGValue = (u8) phy_query_bb_reg(adapter, ODM_REG_IGI_A_11N, ODM_BIT_IGI_11N); pDM_DigTable->RssiLowThresh = DM_DIG_THRESH_LOW; pDM_DigTable->RssiHighThresh = DM_DIG_THRESH_HIGH; pDM_DigTable->FALowThresh = DM_false_ALARM_THRESH_LOW; @@ -620,7 +620,7 @@ void odm_DIG(struct odm_dm_struct *pDM_Odm) } else if (pDM_Odm->SupportAbility & ODM_BB_ANT_DIV) { /* 1 Lower Bound for 88E AntDiv */ if (pDM_Odm->AntDivType == CG_TRX_HW_ANTDIV) { - DIG_Dynamic_MIN = (u8)pDM_DigTable->AntDiv_RSSI_max; + DIG_Dynamic_MIN = (u8) pDM_DigTable->AntDiv_RSSI_max; ODM_RT_TRACE(pDM_Odm, ODM_COMP_ANT_DIV, ODM_DBG_LOUD, ("odm_DIG(): pDM_DigTable->AntDiv_RSSI_max=%d\n", pDM_DigTable->AntDiv_RSSI_max)); diff --git a/hal/odm_HWConfig.c b/hal/odm_HWConfig.c index 29f87df..4e4e219 100644 --- a/hal/odm_HWConfig.c +++ b/hal/odm_HWConfig.c @@ -118,7 +118,7 @@ static void odm_RxPhyStatus92CSeries_Parsing(struct odm_dm_struct *dm_odm, cck_highpwr = dm_odm->bCckHighPower; - cck_agc_rpt = pPhyStaRpt->cck_agc_rpt_ofdm_cfosho_a; + cck_agc_rpt = pPhyStaRpt->cck_agc_rpt_ofdm_cfosho_a ; /* 2011.11.28 LukeLee: 88E use different LNA & VGA gain table */ /* The RSSI formula should be modified according to the gain table */ diff --git a/hal/odm_RTL8188E.c b/hal/odm_RTL8188E.c index d3c6873..5342af7 100644 --- a/hal/odm_RTL8188E.c +++ b/hal/odm_RTL8188E.c @@ -278,7 +278,7 @@ static void rtl88eu_dm_hw_ant_div(struct odm_dm_struct *dm_odm) struct rtw_dig *dig_table = &dm_odm->DM_DigTable; struct sta_info *entry; u32 i, min_rssi = 0xFF, ant_div_max_rssi = 0, max_rssi = 0; - u32 local_min_rssi, local_max_rssi; + u32 local_min_rssi,local_max_rssi; u32 main_rssi, aux_rssi; u8 RxIdleAnt = 0, target_ant = 7; diff --git a/hal/phy.c b/hal/phy.c index 3f663fe..c4f7f35 100644 --- a/hal/phy.c +++ b/hal/phy.c @@ -478,7 +478,7 @@ void rtl88eu_dm_txpower_tracking_callback_thermalmeter(struct adapter *adapt) /* 2.4G, decrease power */ {0, 0, 2, 3, 4, 4, 5, 6, 7, 7, 8, 9, 10, 10, 11}, /* 2.4G, increase power */ - {0, 0, -1, -2, -3, -4, -4, -4, -4, -5, -7, -8, -9, -9, -10}, + {0, 0, -1, -2, -3, -4,-4, -4, -4, -5, -7, -8,-9, -9, -10}, }; u8 thermal_mapping[2][index_mapping_NUM_88E] = { /* 2.4G, decrease power */ diff --git a/hal/rf.c b/hal/rf.c index eea4c8a..c2fac34 100644 --- a/hal/rf.c +++ b/hal/rf.c @@ -131,7 +131,7 @@ void rtl88eu_phy_rf6052_set_cck_txpower(struct adapter *adapt, u8 *powerlevel) /* powerbase1 for HT MCS rates */ static void getpowerbase88e(struct adapter *adapt, u8 *pwr_level_ofdm, u8 *pwr_level_bw20, u8 *pwr_level_bw40, - u8 channel, u32 *ofdmbase, u32 *mcs_base) + u8 channel,u32 *ofdmbase, u32 *mcs_base) { struct hal_data_8188e *hal_data = GET_HAL_DATA(adapt); u32 powerbase0, powerbase1; diff --git a/hal/rf_cfg.c b/hal/rf_cfg.c index 5dc11ca..ddc2f55 100644 --- a/hal/rf_cfg.c +++ b/hal/rf_cfg.c @@ -164,7 +164,7 @@ do { \ #define B3WIREDATALENGTH 0x800 #define BRFSI_RFENV 0x10 -static void rtl_rfreg_delay(struct adapter *adapt, enum rf_radio_path rfpath, u32 addr, u32 mask, u32 data) +static void rtl_rfreg_delay(struct adapter *adapt, enum rf_radio_path rfpath,u32 addr, u32 mask, u32 data) { if (addr == 0xfe) { mdelay(50); @@ -190,7 +190,7 @@ static void rtl8188e_config_rf_reg(struct adapter *adapt, u32 content = 0x1000; /*RF Content: radio_a_txt*/ u32 maskforphyset = (u32)(content & 0xE000); - rtl_rfreg_delay(adapt, RF90_PATH_A, addr | maskforphyset, + rtl_rfreg_delay(adapt, RF90_PATH_A, addr| maskforphyset, RFREG_OFFSET_MASK, data); } diff --git a/hal/rtl8188e_cmd.c b/hal/rtl8188e_cmd.c index 7f30dea..023a3d8 100644 --- a/hal/rtl8188e_cmd.c +++ b/hal/rtl8188e_cmd.c @@ -150,9 +150,11 @@ u8 rtl8188e_set_raid_cmd(struct adapter *adapt, u32 mask) struct hal_data_8188e *haldata = GET_HAL_DATA(adapt); if (haldata->fw_ractrl) { + __le32 lmask; memset(buf, 0, 3); - put_unaligned_le32(mask, buf); + lmask = cpu_to_le32(mask); + memcpy(buf, &lmask, 3); FillH2CCmd_88E(adapt, H2C_DM_MACID_CFG, 3, buf); } else { @@ -252,7 +254,7 @@ void rtl8188e_set_FwMediaStatus_cmd(struct adapter *adapt, __le16 mstatus_rpt) { u8 opmode, macid; u16 mst_rpt = le16_to_cpu(mstatus_rpt); - opmode = (u8)mst_rpt; + opmode = (u8) mst_rpt; macid = (u8)(mst_rpt >> 8); DBG_88E("### %s: MStatus=%x MACID=%d\n", __func__, opmode, macid); diff --git a/hal/rtl8188e_dm.c b/hal/rtl8188e_dm.c index 0156621..dab4c33 100644 --- a/hal/rtl8188e_dm.c +++ b/hal/rtl8188e_dm.c @@ -155,8 +155,6 @@ void rtl8188e_HalDmWatchDog(struct adapter *Adapter) bool fw_ps_awake = true; u8 hw_init_completed = false; struct hal_data_8188e *hal_data = GET_HAL_DATA(Adapter); - struct mlme_priv *pmlmepriv = NULL; - u8 bLinked = false; hw_init_completed = Adapter->hw_init_completed; @@ -172,20 +170,22 @@ void rtl8188e_HalDmWatchDog(struct adapter *Adapter) fw_ps_awake = false; /* ODM */ - pmlmepriv = &Adapter->mlmepriv; + if (hw_init_completed) { + struct mlme_priv *pmlmepriv = &Adapter->mlmepriv; + u8 bLinked = false; - if ((check_fwstate(pmlmepriv, WIFI_AP_STATE)) || - (check_fwstate(pmlmepriv, WIFI_ADHOC_STATE | - WIFI_ADHOC_MASTER_STATE))) { - if (Adapter->stapriv.asoc_sta_count > 2) - bLinked = true; - } else {/* Station mode */ - if (check_fwstate(pmlmepriv, _FW_LINKED)) - bLinked = true; + if ((check_fwstate(pmlmepriv, WIFI_AP_STATE)) || + (check_fwstate(pmlmepriv, WIFI_ADHOC_STATE | WIFI_ADHOC_MASTER_STATE))) { + if (Adapter->stapriv.asoc_sta_count > 2) + bLinked = true; + } else {/* Station mode */ + if (check_fwstate(pmlmepriv, _FW_LINKED)) + bLinked = true; + } + + ODM_CmnInfoUpdate(&hal_data->odmpriv, ODM_CMNINFO_LINK, bLinked); + ODM_DMWatchdog(&hal_data->odmpriv); } - - ODM_CmnInfoUpdate(&hal_data->odmpriv, ODM_CMNINFO_LINK, bLinked); - ODM_DMWatchdog(&hal_data->odmpriv); skip_dm: /* Check GPIO to determine current RF on/off and Pbc status. */ /* Check Hardware Radio ON/OFF or not */ diff --git a/hal/rtl8188e_hal_init.c b/hal/rtl8188e_hal_init.c index 68db5c9..d6fe5e6 100644 --- a/hal/rtl8188e_hal_init.c +++ b/hal/rtl8188e_hal_init.c @@ -181,7 +181,7 @@ static void rtl8188e_SetHalODMVar(struct adapter *Adapter, enum hal_odm_variable switch (eVariable) { case HAL_ODM_STA_INFO: { - struct sta_info *psta = pValue1; + struct sta_info *psta = (struct sta_info *)pValue1; if (bSet) { DBG_88E("### Set STA_(%d) info\n", psta->mac_id); ODM_CmnInfoPtrArrayHook(podmpriv, ODM_CMNINFO_STA_STATUS, psta->mac_id, psta); diff --git a/hal/rtl8188e_xmit.c b/hal/rtl8188e_xmit.c index a6ba53b..7a4f754 100644 --- a/hal/rtl8188e_xmit.c +++ b/hal/rtl8188e_xmit.c @@ -25,7 +25,7 @@ void dump_txrpt_ccx_88e(void *buf) { - struct txrpt_ccx_88e *txrpt_ccx = buf; + struct txrpt_ccx_88e *txrpt_ccx = (struct txrpt_ccx_88e *)buf; DBG_88E("%s:\n" "tag1:%u, pkt_num:%u, txdma_underflow:%u, int_bt:%u, int_tri:%u, int_ccx:%u\n" diff --git a/hal/rtl8188eu_xmit.c b/hal/rtl8188eu_xmit.c index 594c1da..be9eede 100644 --- a/hal/rtl8188eu_xmit.c +++ b/hal/rtl8188eu_xmit.c @@ -399,7 +399,7 @@ static s32 rtw_dump_xframe(struct adapter *adapt, struct xmit_frame *pxmitframe) mem_addr += w_sz; - mem_addr = (u8 *)round_up((size_t)mem_addr, 4); + mem_addr = (u8 *) round_up((size_t)mem_addr, 4); } rtw_free_xmitframe(pxmitpriv, pxmitframe); diff --git a/hal/usb_halinit.c b/hal/usb_halinit.c index 14650e9..caf2ca3 100644 --- a/hal/usb_halinit.c +++ b/hal/usb_halinit.c @@ -1673,7 +1673,7 @@ static void SetHwReg8188EU(struct adapter *Adapter, u8 variable, u8 *val) pRegToSet = RegToSet_Normal; /* 0xb972a841; */ FactorToSet = *((u8 *)val); if (FactorToSet <= 3) { - FactorToSet = 1 << (FactorToSet + 2); + FactorToSet = (1<<(FactorToSet + 2)); if (FactorToSet > 0xf) FactorToSet = 0xf; @@ -2012,7 +2012,7 @@ static u8 SetHalDefVar8188EUsb(struct adapter *Adapter, enum hal_def_variable eV u8 bRSSIDump = *((u8 *)pValue); struct odm_dm_struct *dm_ocm = &(haldata->odmpriv); if (bRSSIDump) - dm_ocm->DebugComponents = ODM_COMP_DIG|ODM_COMP_FA_CNT; + dm_ocm->DebugComponents = ODM_COMP_DIG|ODM_COMP_FA_CNT ; else dm_ocm->DebugComponents = 0; } diff --git a/include/ieee80211_ext.h b/include/ieee80211_ext.h index 15e53d3..1052d18 100644 --- a/include/ieee80211_ext.h +++ b/include/ieee80211_ext.h @@ -103,24 +103,24 @@ struct wme_parameter_element { #define WPA_PUT_LE16(a, val) \ do { \ - (a)[1] = ((u16)(val)) >> 8; \ - (a)[0] = ((u16)(val)) & 0xff; \ + (a)[1] = ((u16) (val)) >> 8; \ + (a)[0] = ((u16) (val)) & 0xff; \ } while (0) #define WPA_PUT_BE32(a, val) \ do { \ - (a)[0] = (u8)((((u32) (val)) >> 24) & 0xff); \ - (a)[1] = (u8)((((u32) (val)) >> 16) & 0xff); \ - (a)[2] = (u8)((((u32) (val)) >> 8) & 0xff); \ - (a)[3] = (u8)(((u32) (val)) & 0xff); \ + (a)[0] = (u8) ((((u32) (val)) >> 24) & 0xff); \ + (a)[1] = (u8) ((((u32) (val)) >> 16) & 0xff); \ + (a)[2] = (u8) ((((u32) (val)) >> 8) & 0xff); \ + (a)[3] = (u8) (((u32) (val)) & 0xff); \ } while (0) #define WPA_PUT_LE32(a, val) \ do { \ - (a)[3] = (u8)((((u32) (val)) >> 24) & 0xff); \ - (a)[2] = (u8)((((u32) (val)) >> 16) & 0xff); \ - (a)[1] = (u8)((((u32) (val)) >> 8) & 0xff); \ - (a)[0] = (u8)(((u32) (val)) & 0xff); \ + (a)[3] = (u8) ((((u32) (val)) >> 24) & 0xff); \ + (a)[2] = (u8) ((((u32) (val)) >> 16) & 0xff); \ + (a)[1] = (u8) ((((u32) (val)) >> 8) & 0xff); \ + (a)[0] = (u8) (((u32) (val)) & 0xff); \ } while (0) #define RSN_SELECTOR_PUT(a, val) WPA_PUT_BE32((u8 *)(a), (val)) diff --git a/include/odm_debug.h b/include/odm_debug.h index 914f831..db7b44e 100644 --- a/include/odm_debug.h +++ b/include/odm_debug.h @@ -83,8 +83,9 @@ #define ODM_COMP_INIT BIT31 /*------------------------Export Marco Definition---------------------------*/ +#define DbgPrint pr_info #define RT_PRINTK(fmt, args...) \ - pr_info("%s(): " fmt, __func__, ## args); + DbgPrint("%s(): " fmt, __func__, ## args); #ifndef ASSERT #define ASSERT(expr) @@ -93,18 +94,40 @@ #define ODM_RT_TRACE(pDM_Odm, comp, level, fmt) \ if (((comp) & pDM_Odm->DebugComponents) && \ (level <= pDM_Odm->DebugLevel)) { \ - pr_info("[ODM-8188E] "); \ + DbgPrint("[ODM-8188E] "); \ + RT_PRINTK fmt; \ + } + +#define ODM_RT_TRACE_F(pDM_Odm, comp, level, fmt) \ + if (((comp) & pDM_Odm->DebugComponents) && \ + (level <= pDM_Odm->DebugLevel)) { \ RT_PRINTK fmt; \ } #define ODM_RT_ASSERT(pDM_Odm, expr, fmt) \ if (!(expr)) { \ - pr_info("Assertion failed! %s at ......\n", #expr); \ - pr_info(" ......%s,%s,line=%d\n", __FILE__, \ + DbgPrint("Assertion failed! %s at ......\n", #expr); \ + DbgPrint(" ......%s,%s,line=%d\n", __FILE__, \ __func__, __LINE__); \ RT_PRINTK fmt; \ ASSERT(false); \ } +#define ODM_dbg_enter() { DbgPrint("==> %s\n", __func__); } +#define ODM_dbg_exit() { DbgPrint("<== %s\n", __func__); } +#define ODM_dbg_trace(str) { DbgPrint("%s:%s\n", __func__, str); } + +#define ODM_PRINT_ADDR(pDM_Odm, comp, level, title_str, ptr) \ + if (((comp) & pDM_Odm->DebugComponents) && \ + (level <= pDM_Odm->DebugLevel)) { \ + int __i; \ + u8 *__ptr = (u8 *)ptr; \ + DbgPrint("[ODM] "); \ + DbgPrint(title_str); \ + DbgPrint(" "); \ + for (__i = 0; __i < 6; __i++) \ + DbgPrint("%02X%s", __ptr[__i], (__i == 5)?"":"-");\ + DbgPrint("\n"); \ + } void ODM_InitDebugSetting(struct odm_dm_struct *pDM_Odm); diff --git a/include/osdep_service.h b/include/osdep_service.h index 82f58f8..fed9c86 100644 --- a/include/osdep_service.h +++ b/include/osdep_service.h @@ -182,8 +182,8 @@ u64 rtw_modular64(u64 x, u64 y); /* Macros for handling unaligned memory accesses */ -#define RTW_GET_BE24(a) ((((u32)(a)[0]) << 16) | (((u32) (a)[1]) << 8) | \ - ((u32)(a)[2])) +#define RTW_GET_BE24(a) ((((u32) (a)[0]) << 16) | (((u32) (a)[1]) << 8) | \ + ((u32) (a)[2])) void rtw_buf_free(u8 **buf, u32 *buf_len); void rtw_buf_update(u8 **buf, u32 *buf_len, u8 *src, u32 src_len); diff --git a/include/rtw_debug.h b/include/rtw_debug.h index 673f190..070bf48 100644 --- a/include/rtw_debug.h +++ b/include/rtw_debug.h @@ -106,7 +106,7 @@ extern u32 GlobalDebugLevel; u8 *ptr = (u8 *)_hexdata; \ pr_info("%s", DRIVER_PREFIX); \ pr_info(_titlestring); \ - for (__i = 0; __i < (int)_hexdatalen; __i++) { \ + for (__i = 0; __i < (int)_hexdatalen; __i++ ) { \ pr_info("%02X%s", ptr[__i], \ (((__i + 1) % 4) == 0) ? \ " " : " "); \ diff --git a/include/rtw_led.h b/include/rtw_led.h index dec8dbc..c5194b6 100644 --- a/include/rtw_led.h +++ b/include/rtw_led.h @@ -92,7 +92,7 @@ struct LED_871x { void LedControl8188eu(struct adapter *padapter, enum LED_CTL_MODE LedAction); -struct led_priv { +struct led_priv{ /* add for led control */ struct LED_871x SwLed0; u8 bRegUseLed; diff --git a/include/rtw_mlme_ext.h b/include/rtw_mlme_ext.h index 8d72ccf..d699ca1 100644 --- a/include/rtw_mlme_ext.h +++ b/include/rtw_mlme_ext.h @@ -448,7 +448,7 @@ struct mlme_ext_priv { int init_mlme_ext_priv(struct adapter *adapter); int init_hw_mlme_ext(struct adapter *padapter); -void free_mlme_ext_priv(struct mlme_ext_priv *pmlmeext); +void free_mlme_ext_priv (struct mlme_ext_priv *pmlmeext); extern void init_mlme_ext_timer(struct adapter *padapter); extern void init_addba_retry_timer(struct adapter *adapt, struct sta_info *sta); extern struct xmit_frame *alloc_mgtxmitframe(struct xmit_priv *pxmitpriv); @@ -646,8 +646,8 @@ void mlmeext_sta_add_event_callback(struct adapter *padapter, void linked_status_chk(struct adapter *padapter); -void survey_timer_hdl(void *function_context); -void link_timer_hdl(void *funtion_context); +void survey_timer_hdl (void *function_context); +void link_timer_hdl (void *funtion_context); void addba_timer_hdl(void *function_context); #define set_survey_timer(mlmeext, ms) \ @@ -708,15 +708,15 @@ u8 tdls_hdl(struct adapter *padapter, unsigned char *pbuf); #ifdef _RTW_CMD_C_ static struct cmd_hdl wlancmds[] = { - GEN_MLME_EXT_HANDLER(sizeof(struct wlan_bssid_ex), join_cmd_hdl) - GEN_MLME_EXT_HANDLER(sizeof(struct disconnect_parm), disconnect_hdl) - GEN_MLME_EXT_HANDLER(sizeof(struct wlan_bssid_ex), createbss_hdl) - GEN_MLME_EXT_HANDLER(sizeof(struct setopmode_parm), setopmode_hdl) - GEN_MLME_EXT_HANDLER(sizeof(struct sitesurvey_parm), sitesurvey_cmd_hdl) - GEN_MLME_EXT_HANDLER(sizeof(struct setauth_parm), setauth_hdl) - GEN_MLME_EXT_HANDLER(sizeof(struct setkey_parm), setkey_hdl) - GEN_MLME_EXT_HANDLER(sizeof(struct set_stakey_parm), set_stakey_hdl) - GEN_MLME_EXT_HANDLER(sizeof(struct set_assocsta_parm), NULL) + GEN_MLME_EXT_HANDLER(sizeof (struct wlan_bssid_ex), join_cmd_hdl) + GEN_MLME_EXT_HANDLER(sizeof (struct disconnect_parm), disconnect_hdl) + GEN_MLME_EXT_HANDLER(sizeof (struct wlan_bssid_ex), createbss_hdl) + GEN_MLME_EXT_HANDLER(sizeof (struct setopmode_parm), setopmode_hdl) + GEN_MLME_EXT_HANDLER(sizeof (struct sitesurvey_parm), sitesurvey_cmd_hdl) + GEN_MLME_EXT_HANDLER(sizeof (struct setauth_parm), setauth_hdl) + GEN_MLME_EXT_HANDLER(sizeof (struct setkey_parm), setkey_hdl) + GEN_MLME_EXT_HANDLER(sizeof (struct set_stakey_parm), set_stakey_hdl) + GEN_MLME_EXT_HANDLER(sizeof (struct set_assocsta_parm), NULL) GEN_MLME_EXT_HANDLER(sizeof(struct addBaReq_parm), add_ba_hdl) GEN_MLME_EXT_HANDLER(sizeof(struct set_ch_parm), set_ch_hdl) GEN_MLME_EXT_HANDLER(sizeof(struct wlan_bssid_ex), tx_beacon_hdl) @@ -787,7 +787,7 @@ static struct fwevent wlanevents[] = { {0, NULL}, {0, NULL}, {0, &rtw_survey_event_callback}, /*8*/ - {sizeof(struct surveydone_event), &rtw_surveydone_event_callback},/*9*/ + {sizeof (struct surveydone_event), &rtw_surveydone_event_callback},/*9*/ {0, &rtw_joinbss_event_callback}, /*10*/ {sizeof(struct stassoc_event), &rtw_stassoc_event_callback}, {sizeof(struct stadel_event), &rtw_stadel_event_callback}, diff --git a/include/wifi.h b/include/wifi.h index 8dbdfaf..2e7307f 100644 --- a/include/wifi.h +++ b/include/wifi.h @@ -694,7 +694,7 @@ struct WMM_para_element { struct ADDBA_request { unsigned char dialog_token; - __le16 BA_para_set; + unsigned short BA_para_set; unsigned short BA_timeout_value; unsigned short BA_starting_seqctrl; } __packed; @@ -766,27 +766,27 @@ enum ht_cap_ampdu_factor { #define OP_MODE_20MHZ_HT_STA_ASSOCED 2 #define OP_MODE_MIXED 3 -#define HT_INFO_HT_PARAM_SECONDARY_CHNL_OFF_MASK ((u8)BIT(0) | BIT(1)) -#define HT_INFO_HT_PARAM_SECONDARY_CHNL_ABOVE ((u8)BIT(0)) -#define HT_INFO_HT_PARAM_SECONDARY_CHNL_BELOW ((u8)BIT(0) | BIT(1)) -#define HT_INFO_HT_PARAM_REC_TRANS_CHNL_WIDTH ((u8)BIT(2)) -#define HT_INFO_HT_PARAM_RIFS_MODE ((u8)BIT(3)) -#define HT_INFO_HT_PARAM_CTRL_ACCESS_ONLY ((u8)BIT(4)) -#define HT_INFO_HT_PARAM_SRV_INTERVAL_GRANULARITY ((u8)BIT(5)) +#define HT_INFO_HT_PARAM_SECONDARY_CHNL_OFF_MASK ((u8) BIT(0) | BIT(1)) +#define HT_INFO_HT_PARAM_SECONDARY_CHNL_ABOVE ((u8) BIT(0)) +#define HT_INFO_HT_PARAM_SECONDARY_CHNL_BELOW ((u8) BIT(0) | BIT(1)) +#define HT_INFO_HT_PARAM_REC_TRANS_CHNL_WIDTH ((u8) BIT(2)) +#define HT_INFO_HT_PARAM_RIFS_MODE ((u8) BIT(3)) +#define HT_INFO_HT_PARAM_CTRL_ACCESS_ONLY ((u8) BIT(4)) +#define HT_INFO_HT_PARAM_SRV_INTERVAL_GRANULARITY ((u8) BIT(5)) #define HT_INFO_OPERATION_MODE_OP_MODE_MASK \ - ((u16)(0x0001 | 0x0002)) + ((u16) (0x0001 | 0x0002)) #define HT_INFO_OPERATION_MODE_OP_MODE_OFFSET 0 -#define HT_INFO_OPERATION_MODE_NON_GF_DEVS_PRESENT ((u8)BIT(2)) -#define HT_INFO_OPERATION_MODE_TRANSMIT_BURST_LIMIT ((u8)BIT(3)) -#define HT_INFO_OPERATION_MODE_NON_HT_STA_PRESENT ((u8)BIT(4)) +#define HT_INFO_OPERATION_MODE_NON_GF_DEVS_PRESENT ((u8) BIT(2)) +#define HT_INFO_OPERATION_MODE_TRANSMIT_BURST_LIMIT ((u8) BIT(3)) +#define HT_INFO_OPERATION_MODE_NON_HT_STA_PRESENT ((u8) BIT(4)) -#define HT_INFO_STBC_PARAM_DUAL_BEACON ((u16)BIT(6)) -#define HT_INFO_STBC_PARAM_DUAL_STBC_PROTECT ((u16)BIT(7)) -#define HT_INFO_STBC_PARAM_SECONDARY_BC ((u16)BIT(8)) -#define HT_INFO_STBC_PARAM_LSIG_TXOP_PROTECT_ALLOWED ((u16)BIT(9)) -#define HT_INFO_STBC_PARAM_PCO_ACTIVE ((u16)BIT(10)) -#define HT_INFO_STBC_PARAM_PCO_PHASE ((u16)BIT(11)) +#define HT_INFO_STBC_PARAM_DUAL_BEACON ((u16) BIT(6)) +#define HT_INFO_STBC_PARAM_DUAL_STBC_PROTECT ((u16) BIT(7)) +#define HT_INFO_STBC_PARAM_SECONDARY_BC ((u16) BIT(8)) +#define HT_INFO_STBC_PARAM_LSIG_TXOP_PROTECT_ALLOWED ((u16) BIT(9)) +#define HT_INFO_STBC_PARAM_PCO_ACTIVE ((u16) BIT(10)) +#define HT_INFO_STBC_PARAM_PCO_PHASE ((u16) BIT(11)) /* ===============WPS Section=============== */ /* For WPSv1.0 */ diff --git a/os_dep/ioctl_linux.c b/os_dep/ioctl_linux.c index 24a8f5a..d598fec 100644 --- a/os_dep/ioctl_linux.c +++ b/os_dep/ioctl_linux.c @@ -361,7 +361,7 @@ static int wpa_set_encryption(struct net_device *dev, struct ieee_param *param, param->u.crypt.err = 0; param->u.crypt.alg[IEEE_CRYPT_ALG_NAME_LEN - 1] = '\0'; - if (param_len < (u32)((u8 *)param->u.crypt.key - (u8 *)param) + param->u.crypt.key_len) { + if (param_len < (u32) ((u8 *)param->u.crypt.key - (u8 *)param) + param->u.crypt.key_len) { ret = -EINVAL; goto exit; } @@ -512,12 +512,14 @@ static int rtw_set_wpa_ie(struct adapter *padapter, char *pie, unsigned short ie } if (ielen) { - buf = kmemdup(pie, ielen, GFP_KERNEL); + buf = kzalloc(ielen, GFP_KERNEL); if (buf == NULL) { ret = -ENOMEM; goto exit; } + memcpy(buf, pie, ielen); + /* dump */ { int i; @@ -1134,8 +1136,7 @@ static int rtw_wx_set_scan(struct net_device *dev, struct iw_request_info *a, struct iw_scan_req *req = (struct iw_scan_req *)extra; if (wrqu->data.flags & IW_SCAN_THIS_ESSID) { - int len = min_t(int, req->essid_len, - IW_ESSID_MAX_SIZE); + int len = min((int)req->essid_len, IW_ESSID_MAX_SIZE); memcpy(ssid[0].Ssid, req->essid, len); ssid[0].SsidLength = len; @@ -1416,7 +1417,7 @@ static int rtw_wx_set_rate(struct net_device *dev, struct iw_request_info *a, union iwreq_data *wrqu, char *extra) { - int i; + int i, ret = 0; u8 datarates[NumRates]; u32 target_rate = wrqu->bitrate.value; u32 fixed = wrqu->bitrate.fixed; @@ -1489,7 +1490,7 @@ set_rate: RT_TRACE(_module_rtl871x_ioctl_os_c, _drv_info_, ("datarate_inx =%d\n", datarates[i])); } - return 0; + return ret; } static int rtw_wx_get_rate(struct net_device *dev, @@ -2698,8 +2699,10 @@ static int rtw_set_wps_beacon(struct net_device *dev, struct ieee_param *param, ie_len = len-12-2;/* 12 = param header, 2:no packed */ - kfree(pmlmepriv->wps_beacon_ie); - pmlmepriv->wps_beacon_ie = NULL; + if (pmlmepriv->wps_beacon_ie) { + kfree(pmlmepriv->wps_beacon_ie); + pmlmepriv->wps_beacon_ie = NULL; + } if (ie_len > 0) { pmlmepriv->wps_beacon_ie = rtw_malloc(ie_len); @@ -2733,8 +2736,10 @@ static int rtw_set_wps_probe_resp(struct net_device *dev, struct ieee_param *par ie_len = len-12-2;/* 12 = param header, 2:no packed */ - kfree(pmlmepriv->wps_probe_resp_ie); - pmlmepriv->wps_probe_resp_ie = NULL; + if (pmlmepriv->wps_probe_resp_ie) { + kfree(pmlmepriv->wps_probe_resp_ie); + pmlmepriv->wps_probe_resp_ie = NULL; + } if (ie_len > 0) { pmlmepriv->wps_probe_resp_ie = rtw_malloc(ie_len); @@ -2763,8 +2768,10 @@ static int rtw_set_wps_assoc_resp(struct net_device *dev, struct ieee_param *par ie_len = len-12-2;/* 12 = param header, 2:no packed */ - kfree(pmlmepriv->wps_assoc_resp_ie); - pmlmepriv->wps_assoc_resp_ie = NULL; + if (pmlmepriv->wps_assoc_resp_ie) { + kfree(pmlmepriv->wps_assoc_resp_ie); + pmlmepriv->wps_assoc_resp_ie = NULL; + } if (ie_len > 0) { pmlmepriv->wps_assoc_resp_ie = rtw_malloc(ie_len); diff --git a/os_dep/os_intfs.c b/os_dep/os_intfs.c index 88a909c..08a80f7 100644 --- a/os_dep/os_intfs.c +++ b/os_dep/os_intfs.c @@ -512,6 +512,7 @@ void rtw_proc_remove_one(struct net_device *dev) static uint loadparam(struct adapter *padapter, struct net_device *pnetdev) { + uint status = _SUCCESS; struct registry_priv *registry_par = &padapter->registrypriv; @@ -526,7 +527,7 @@ static uint loadparam(struct adapter *padapter, struct net_device *pnetdev) registry_par->channel = (u8)rtw_channel; registry_par->wireless_mode = (u8)rtw_wireless_mode; - registry_par->vrtl_carrier_sense = (u8)rtw_vrtl_carrier_sense; + registry_par->vrtl_carrier_sense = (u8)rtw_vrtl_carrier_sense ; registry_par->vcs_type = (u8)rtw_vcs_type; registry_par->rts_thresh = (u16)rtw_rts_thresh; registry_par->frag_thresh = (u16)rtw_frag_thresh; @@ -581,7 +582,7 @@ static uint loadparam(struct adapter *padapter, struct net_device *pnetdev) snprintf(registry_par->ifname, 16, "%s", ifname); snprintf(registry_par->if2name, 16, "%s", if2name); registry_par->notch_filter = (u8)rtw_notch_filter; - return _SUCCESS; + return status; } static int rtw_net_set_mac_address(struct net_device *pnetdev, void *p) @@ -759,6 +760,7 @@ void rtw_stop_drv_threads(struct adapter *padapter) static u8 rtw_init_default_value(struct adapter *padapter) { + u8 ret = _SUCCESS; struct registry_priv *pregistrypriv = &padapter->registrypriv; struct xmit_priv *pxmitpriv = &padapter->xmitpriv; struct mlme_priv *pmlmepriv = &padapter->mlmepriv; @@ -801,11 +803,12 @@ static u8 rtw_init_default_value(struct adapter *padapter) padapter->bWritePortCancel = false; padapter->bRxRSSIDisplay = 0; padapter->bNotifyChannelChange = 0; - return _SUCCESS; + return ret; } u8 rtw_reset_drv_sw(struct adapter *padapter) { + u8 ret8 = _SUCCESS; struct mlme_priv *pmlmepriv = &padapter->mlmepriv; struct pwrctrl_priv *pwrctrlpriv = &padapter->pwrctrlpriv; @@ -830,7 +833,7 @@ u8 rtw_reset_drv_sw(struct adapter *padapter) rtw_set_signal_stat_timer(&padapter->recvpriv); - return _SUCCESS; + return ret8; } u8 rtw_init_drv_sw(struct adapter *padapter) diff --git a/os_dep/osdep_service.c b/os_dep/osdep_service.c index abcb3a8..8af4a8d 100644 --- a/os_dep/osdep_service.c +++ b/os_dep/osdep_service.c @@ -51,7 +51,7 @@ void *rtw_malloc2d(int h, int w, int size) { int j; - void **a = kzalloc(h*sizeof(void *) + h*w*size, GFP_KERNEL); + void **a = (void **)kzalloc(h*sizeof(void *) + h*w*size, GFP_KERNEL); if (a == NULL) { pr_info("%s: alloc memory fail!\n", __func__); return NULL; diff --git a/os_dep/rtw_android.c b/os_dep/rtw_android.c index 99ce077..d9d55d1 100644 --- a/os_dep/rtw_android.c +++ b/os_dep/rtw_android.c @@ -148,21 +148,36 @@ static int rtw_android_set_block(struct net_device *net, char *command, int rtw_android_priv_cmd(struct net_device *net, struct ifreq *ifr, int cmd) { int ret = 0; - char *command; + char *command = NULL; int cmd_num; int bytes_written = 0; struct android_wifi_priv_cmd priv_cmd; - if (!ifr->ifr_data) - return -EINVAL; - if (copy_from_user(&priv_cmd, ifr->ifr_data, sizeof(priv_cmd))) - return -EFAULT; - if (priv_cmd.total_len < 1) - return -EINVAL; - command = memdup_user(priv_cmd.buf, priv_cmd.total_len); - if (IS_ERR(command)) - return PTR_ERR(command); - command[priv_cmd.total_len - 1] = 0; + if (!ifr->ifr_data) { + ret = -EINVAL; + goto exit; + } + if (copy_from_user(&priv_cmd, ifr->ifr_data, + sizeof(struct android_wifi_priv_cmd))) { + ret = -EFAULT; + goto exit; + } + command = kmalloc(priv_cmd.total_len, GFP_KERNEL); + if (!command) { + DBG_88E("%s: failed to allocate memory\n", __func__); + ret = -ENOMEM; + goto exit; + } + if (!access_ok(VERIFY_READ, priv_cmd.buf, priv_cmd.total_len)) { + DBG_88E("%s: failed to access memory\n", __func__); + ret = -EFAULT; + goto exit; + } + if (copy_from_user(command, (char __user *)priv_cmd.buf, + priv_cmd.total_len)) { + ret = -EFAULT; + goto exit; + } DBG_88E("%s: Android private cmd \"%s\" on %s\n", __func__, command, ifr->ifr_name); cmd_num = rtw_android_cmdstr_to_num(command); @@ -176,7 +191,7 @@ int rtw_android_priv_cmd(struct net_device *net, struct ifreq *ifr, int cmd) DBG_88E("%s: Ignore private cmd \"%s\" - iface %s is down\n", __func__, command, ifr->ifr_name); ret = 0; - goto free; + goto exit; } switch (cmd_num) { case ANDROID_WIFI_CMD_STOP: @@ -264,7 +279,7 @@ response: } else { ret = bytes_written; } -free: +exit: kfree(command); return ret; } diff --git a/os_dep/usb_intf.c b/os_dep/usb_intf.c index 65a257f..407a318 100644 --- a/os_dep/usb_intf.c +++ b/os_dep/usb_intf.c @@ -556,6 +556,8 @@ static void rtw_dev_remove(struct usb_interface *pusb_intf) RT_TRACE(_module_hci_intfs_c_, _drv_err_, ("-dev_remove()\n")); DBG_88E("-r871xu_dev_remove, done\n"); + + return; } static struct usb_driver rtl8188e_usb_drv = { diff --git a/os_dep/usb_ops_linux.c b/os_dep/usb_ops_linux.c index d2efa9d..ba1e178 100644 --- a/os_dep/usb_ops_linux.c +++ b/os_dep/usb_ops_linux.c @@ -160,10 +160,10 @@ static int recvbuf2recvframe(struct adapter *adapt, struct sk_buff *pskb) switch (haldata->UsbRxAggMode) { case USB_RX_AGG_DMA: case USB_RX_AGG_MIX: - pkt_offset = (u16)round_up(pkt_offset, 128); + pkt_offset = (u16) round_up(pkt_offset, 128); break; case USB_RX_AGG_USB: - pkt_offset = (u16)round_up(pkt_offset, 4); + pkt_offset = (u16) round_up(pkt_offset, 4); break; case USB_RX_AGG_DISABLE: default: @@ -843,7 +843,7 @@ void usb_write_port_cancel(struct adapter *padapter) void rtl8188eu_recv_tasklet(void *priv) { struct sk_buff *pskb; - struct adapter *adapt = priv; + struct adapter *adapt = (struct adapter *)priv; struct recv_priv *precvpriv = &adapt->recvpriv; while (NULL != (pskb = skb_dequeue(&precvpriv->rx_skb_queue))) { @@ -862,7 +862,7 @@ void rtl8188eu_recv_tasklet(void *priv) void rtl8188eu_xmit_tasklet(void *priv) { int ret = false; - struct adapter *adapt = priv; + struct adapter *adapt = (struct adapter *)priv; struct xmit_priv *pxmitpriv = &adapt->xmitpriv; if (check_fwstate(&adapt->mlmepriv, _FW_UNDER_SURVEY)) diff --git a/os_dep/xmit_linux.c b/os_dep/xmit_linux.c index d5e41a5..0ce47b0 100644 --- a/os_dep/xmit_linux.c +++ b/os_dep/xmit_linux.c @@ -46,7 +46,7 @@ void _rtw_open_pktfile(struct sk_buff *pktptr, struct pkt_file *pfile) } -uint _rtw_pktfile_read(struct pkt_file *pfile, u8 *rmem, uint rlen) +uint _rtw_pktfile_read (struct pkt_file *pfile, u8 *rmem, uint rlen) { uint len = 0;