Fix checkpatch warnings of core/rtw_cmd.c in detail, unnecessary braces, space before tab and wrongly formatted comments. Issues found by checkpatch --- drivers/staging/rtl8723bs/core/rtw_cmd.c | 105 +++++++++++------------ 1 file changed, 50 insertions(+), 55 deletions(-) diff --git a/drivers/staging/rtl8723bs/core/rtw_cmd.c b/drivers/staging/rtl8723bs/core/rtw_cmd.c index 3fe79169a811..9ed1e83769b8 100644 --- a/drivers/staging/rtl8723bs/core/rtw_cmd.c +++ b/drivers/staging/rtl8723bs/core/rtw_cmd.c @@ -158,11 +158,9 @@ static struct cmd_hdl wlancmds[] = { GEN_MLME_EXT_HANDLER(sizeof(struct RunInThread_param), run_in_thread_hdl) /*63*/ }; -/* -Caller and the rtw_cmd_thread can protect cmd_q by spin_lock. -No irqsave is necessary. -*/ - +/* Caller and the rtw_cmd_thread can protect cmd_q by spin_lock. + * No irqsave is necessary. + */ int rtw_init_cmd_priv(struct cmd_priv *pcmdpriv) { int res = 0; @@ -229,6 +227,7 @@ void _rtw_free_evt_priv(struct evt_priv *pevtpriv) while (!rtw_cbuf_empty(pevtpriv->c2h_queue)) { void *c2h = rtw_cbuf_pop(pevtpriv->c2h_queue); + if (c2h && c2h != (void *)pevtpriv) kfree(c2h); } @@ -248,15 +247,14 @@ void _rtw_free_cmd_priv(struct cmd_priv *pcmdpriv) } } -/* -Calling Context: - -rtw_enqueue_cmd can only be called between kernel thread, -since only spin_lock is used. - -ISR/Call-Back functions can't call this sub-function. - -*/ +/* Calling Context: + * + * rtw_enqueue_cmd can only be called between kernel thread, + * since only spin_lock is used. + * + * ISR/Call-Back functions can't call this sub-function. + * + */ int _rtw_enqueue_cmd(struct __queue *queue, struct cmd_obj *obj) { @@ -321,9 +319,9 @@ int rtw_cmd_filter(struct cmd_priv *pcmdpriv, struct cmd_obj *cmd_obj) || atomic_read(&(pcmdpriv->cmdthd_running)) == false /* com_thread not running */ ) { /* DBG_871X("%s:%s: drop cmdcode:%u, hw_init_completed:%u, cmdthd_running:%u\n", caller_func, __func__, */ - /* cmd_obj->cmdcode, */ - /* pcmdpriv->padapter->hw_init_completed, */ - /* pcmdpriv->cmdthd_running */ + /* cmd_obj->cmdcode, */ + /* pcmdpriv->padapter->hw_init_completed, */ + /* pcmdpriv->cmdthd_running */ /* */ return _FAIL; @@ -554,18 +552,17 @@ int rtw_cmd_thread(void *context) thread_exit(); } -/* -rtw_sitesurvey_cmd(~) - ### NOTE:#### (!!!!) - MUST TAKE CARE THAT BEFORE CALLING THIS FUNC, YOU SHOULD HAVE LOCKED pmlmepriv->lock -*/ +/* rtw_sitesurvey_cmd(~) + * ### NOTE:#### (!!!!) + * MUST TAKE CARE THAT BEFORE CALLING THIS FUNC, YOU SHOULD HAVE LOCKED pmlmepriv->lock + */ u8 rtw_sitesurvey_cmd(struct adapter *padapter, struct ndis_802_11_ssid *ssid, int ssid_num, struct rtw_ieee80211_channel *ch, int ch_num) { u8 res = _FAIL; struct cmd_obj *ph2c; struct sitesurvey_parm *psurveyPara; - struct cmd_priv *pcmdpriv = &padapter->cmdpriv; + struct cmd_priv *pcmdpriv = &padapter->cmdpriv; struct mlme_priv *pmlmepriv = &padapter->mlmepriv; if (check_fwstate(pmlmepriv, _FW_LINKED) == true) @@ -593,6 +590,7 @@ u8 rtw_sitesurvey_cmd(struct adapter *padapter, struct ndis_802_11_ssid *ssid, /* prepare ssid list */ if (ssid) { int i; + for (i = 0; i < ssid_num && i < RTW_SSID_SCAN_AMOUNT; i++) { if (ssid[i].SsidLength) { memcpy(&psurveyPara->ssid[i], &ssid[i], sizeof(struct ndis_802_11_ssid)); @@ -607,6 +605,7 @@ u8 rtw_sitesurvey_cmd(struct adapter *padapter, struct ndis_802_11_ssid *ssid, /* prepare channel list */ if (ch) { int i; + for (i = 0; i < ch_num && i < RTW_CHANNEL_SCAN_AMOUNT; i++) { if (ch[i].hw_value && !(ch[i].flags & RTW_IEEE80211_CHAN_DISABLED)) { memcpy(&psurveyPara->ch[i], &ch[i], sizeof(struct rtw_ieee80211_channel)); @@ -671,16 +670,15 @@ void rtw_getbbrfreg_cmdrsp_callback(struct adapter *padapter, struct cmd_obj *p u8 rtw_createbss_cmd(struct adapter *padapter) { struct cmd_obj *pcmd; - struct cmd_priv *pcmdpriv = &padapter->cmdpriv; - struct mlme_priv *pmlmepriv = &padapter->mlmepriv; + struct cmd_priv *pcmdpriv = &padapter->cmdpriv; + struct mlme_priv *pmlmepriv = &padapter->mlmepriv; struct wlan_bssid_ex *pdev_network = &padapter->registrypriv.dev_network; u8 res = _SUCCESS; - if (pmlmepriv->assoc_ssid.SsidLength == 0) { + if (pmlmepriv->assoc_ssid.SsidLength == 0) RT_TRACE(_module_rtl871x_cmd_c_, _drv_info_, (" createbss for Any SSid:%s\n", pmlmepriv->assoc_ssid.Ssid)); - } else { + else RT_TRACE(_module_rtl871x_cmd_c_, _drv_info_, (" createbss for SSid:%s\n", pmlmepriv->assoc_ssid.Ssid)); - } pcmd = rtw_zmalloc(sizeof(struct cmd_obj)); if (pcmd == NULL) { @@ -755,23 +753,22 @@ u8 rtw_joinbss_cmd(struct adapter *padapter, struct wlan_network *pnetwork) uint t_len = 0; struct wlan_bssid_ex *psecnetwork; struct cmd_obj *pcmd; - struct cmd_priv *pcmdpriv = &padapter->cmdpriv; - struct mlme_priv *pmlmepriv = &padapter->mlmepriv; - struct qos_priv *pqospriv = &pmlmepriv->qospriv; + struct cmd_priv *pcmdpriv = &padapter->cmdpriv; + struct mlme_priv *pmlmepriv = &padapter->mlmepriv; + struct qos_priv *pqospriv = &pmlmepriv->qospriv; struct security_priv *psecuritypriv = &padapter->securitypriv; struct registry_priv *pregistrypriv = &padapter->registrypriv; - struct ht_priv *phtpriv = &pmlmepriv->htpriv; + struct ht_priv *phtpriv = &pmlmepriv->htpriv; enum NDIS_802_11_NETWORK_INFRASTRUCTURE ndis_network_mode = pnetwork->network.InfrastructureMode; struct mlme_ext_priv *pmlmeext = &padapter->mlmeextpriv; struct mlme_ext_info *pmlmeinfo = &(pmlmeext->mlmext_info); u32 tmp_len; u8 *ptmp = NULL; - if (pmlmepriv->assoc_ssid.SsidLength == 0) { + if (pmlmepriv->assoc_ssid.SsidLength == 0) RT_TRACE(_module_rtl871x_cmd_c_, _drv_info_, ("+Join cmd: Any SSid\n")); - } else { + else RT_TRACE(_module_rtl871x_cmd_c_, _drv_notice_, ("+Join cmd: SSid =[%s]\n", pmlmepriv->assoc_ssid.Ssid)); - } pcmd = rtw_zmalloc(sizeof(struct cmd_obj)); if (pcmd == NULL) { @@ -810,11 +807,10 @@ u8 rtw_joinbss_cmd(struct adapter *padapter, struct wlan_network *pnetwork) psecuritypriv->authenticator_ie[0] = (unsigned char)psecnetwork->IELength; - if ((psecnetwork->IELength-12) < (256-1)) { + if ((psecnetwork->IELength-12) < (256-1)) memcpy(&psecuritypriv->authenticator_ie[1], &psecnetwork->IEs[12], psecnetwork->IELength-12); - } else { + else memcpy(&psecuritypriv->authenticator_ie[1], &psecnetwork->IEs[12], (256-1)); - } psecnetwork->IELength = 0; /* Added by Albert 2009/02/18 */ @@ -844,9 +840,9 @@ u8 rtw_joinbss_cmd(struct adapter *padapter, struct wlan_network *pnetwork) phtpriv->ht_option = false; ptmp = rtw_get_ie(&pnetwork->network.IEs[12], WLAN_EID_HT_CAPABILITY, &tmp_len, pnetwork->network.IELength-12); if (pregistrypriv->ht_enable && ptmp && tmp_len > 0) { - /* Added by Albert 2010/06/23 */ - /* For the WEP mode, we will use the bg mode to do the connection to avoid some IOT issue. */ - /* Especially for Realtek 8192u SoftAP. */ + /* Added by Albert 2010/06/23 */ + /* For the WEP mode, we will use the bg mode to do the connection to avoid some IOT issue. */ + /* Especially for Realtek 8192u SoftAP. */ if ((padapter->securitypriv.dot11PrivacyAlgrthm != _WEP40_) && (padapter->securitypriv.dot11PrivacyAlgrthm != _WEP104_) && (padapter->securitypriv.dot11PrivacyAlgrthm != _TKIP_)) { @@ -955,11 +951,11 @@ u8 rtw_setstakey_cmd(struct adapter *padapter, struct sta_info *sta, u8 unicast_ { struct cmd_obj *ph2c; struct set_stakey_parm *psetstakey_para; - struct cmd_priv *pcmdpriv = &padapter->cmdpriv; + struct cmd_priv *pcmdpriv = &padapter->cmdpriv; struct set_stakey_rsp *psetstakey_rsp = NULL; - struct mlme_priv *pmlmepriv = &padapter->mlmepriv; - struct security_priv *psecuritypriv = &padapter->securitypriv; + struct mlme_priv *pmlmepriv = &padapter->mlmepriv; + struct security_priv *psecuritypriv = &padapter->securitypriv; u8 res = _SUCCESS; psetstakey_para = rtw_zmalloc(sizeof(struct set_stakey_parm)); @@ -970,17 +966,15 @@ u8 rtw_setstakey_cmd(struct adapter *padapter, struct sta_info *sta, u8 unicast_ memcpy(psetstakey_para->addr, sta->hwaddr, ETH_ALEN); - if (check_fwstate(pmlmepriv, WIFI_STATION_STATE)) { + if (check_fwstate(pmlmepriv, WIFI_STATION_STATE)) psetstakey_para->algorithm = (unsigned char) psecuritypriv->dot11PrivacyAlgrthm; - } else { + else GET_ENCRY_ALGO(psecuritypriv, sta, psetstakey_para->algorithm, false); - } - if (unicast_key == true) { + if (unicast_key == true) memcpy(&psetstakey_para->key, &sta->dot118021x_UncstKey, 16); - } else { + else memcpy(&psetstakey_para->key, &psecuritypriv->dot118021XGrpKey[psecuritypriv->dot118021XGrpKeyid].skey, 16); - } /* jeff: set this because at least sw key is ready */ padapter->securitypriv.busetkipkey = true; @@ -1017,7 +1011,7 @@ u8 rtw_clearstakey_cmd(struct adapter *padapter, struct sta_info *sta, u8 enqueu { struct cmd_obj *ph2c; struct set_stakey_parm *psetstakey_para; - struct cmd_priv *pcmdpriv = &padapter->cmdpriv; + struct cmd_priv *pcmdpriv = &padapter->cmdpriv; struct set_stakey_rsp *psetstakey_rsp = NULL; s16 cam_id = 0; u8 res = _SUCCESS; @@ -1068,7 +1062,7 @@ u8 rtw_clearstakey_cmd(struct adapter *padapter, struct sta_info *sta, u8 enqueu u8 rtw_addbareq_cmd(struct adapter *padapter, u8 tid, u8 *addr) { - struct cmd_priv *pcmdpriv = &padapter->cmdpriv; + struct cmd_priv *pcmdpriv = &padapter->cmdpriv; struct cmd_obj *ph2c; struct addBaReq_parm *paddbareq_parm; @@ -1296,7 +1290,7 @@ u8 traffic_status_watchdog(struct adapter *padapter, u8 from_timer) u8 bBusyTraffic = false, bTxBusyTraffic = false, bRxBusyTraffic = false; u8 bHigherBusyTraffic = false, bHigherBusyRxTraffic = false, bHigherBusyTxTraffic = false; - struct mlme_priv *pmlmepriv = &(padapter->mlmepriv); + struct mlme_priv *pmlmepriv = &(padapter->mlmepriv); collect_traffic_statistics(padapter); @@ -1397,6 +1391,7 @@ u8 traffic_status_watchdog(struct adapter *padapter, u8 from_timer) static void dynamic_chk_wk_hdl(struct adapter *padapter) { struct mlme_priv *pmlmepriv; + pmlmepriv = &(padapter->mlmepriv); if (check_fwstate(pmlmepriv, WIFI_AP_STATE) == true) @@ -1495,7 +1490,7 @@ u8 rtw_lps_ctrl_wk_cmd(struct adapter *padapter, u8 lps_ctrl_type, u8 enqueue) u8 res = _SUCCESS; /* if (!pwrctrlpriv->bLeisurePs) */ - /* return res; */ + /* return res; */ if (enqueue) { ph2c = rtw_zmalloc(sizeof(struct cmd_obj)); @@ -2035,7 +2030,7 @@ void rtw_createbss_cmd_callback(struct adapter *padapter, struct cmd_obj *pcmd) if (pcmd->parmbuf == NULL) goto exit; - if ((pcmd->res != H2C_SUCCESS)) { + if (pcmd->res != H2C_SUCCESS) { RT_TRACE(_module_rtl871x_cmd_c_, _drv_err_, ("\n ********Error: rtw_createbss_cmd_callback Fail ************\n\n.")); _set_timer(&pmlmepriv->assoc_timer, 1); } -- 2.24.3 (Apple Git-128) _______________________________________________ devel mailing list devel@xxxxxxxxxxxxxxxxxxxxxx http://driverdev.linuxdriverproject.org/mailman/listinfo/driverdev-devel