Commit ce3b32a2 authored by Hariprasad Kelam's avatar Hariprasad Kelam Committed by Greg Kroah-Hartman

staging: rtl8723bs: core: rtw_recv: fix warning Comparison to NULL

fix below warning reported by checkpatch

CHECK: Comparison to NULL could be written
"!precvpriv->pallocated_frame_buf"
CHECK: Comparison to NULL could be written "padapter"
Signed-off-by: default avatarHariprasad Kelam <hariprasad.kelam@gmail.com>
-----
changes in v2:
		Corected few erorrs like (!*psta == NULL) pointed in
		review
Signed-off-by: default avatarGreg Kroah-Hartman <gregkh@linuxfoundation.org>
parent 99bf7761
...@@ -50,7 +50,7 @@ sint _rtw_init_recv_priv(struct recv_priv *precvpriv, struct adapter *padapter) ...@@ -50,7 +50,7 @@ sint _rtw_init_recv_priv(struct recv_priv *precvpriv, struct adapter *padapter)
precvpriv->pallocated_frame_buf = vzalloc(NR_RECVFRAME * sizeof(union recv_frame) + RXFRAME_ALIGN_SZ); precvpriv->pallocated_frame_buf = vzalloc(NR_RECVFRAME * sizeof(union recv_frame) + RXFRAME_ALIGN_SZ);
if (precvpriv->pallocated_frame_buf == NULL) { if (!precvpriv->pallocated_frame_buf) {
res = _FAIL; res = _FAIL;
goto exit; goto exit;
} }
...@@ -122,7 +122,7 @@ union recv_frame *_rtw_alloc_recvframe(struct __queue *pfree_recv_queue) ...@@ -122,7 +122,7 @@ union recv_frame *_rtw_alloc_recvframe(struct __queue *pfree_recv_queue)
list_del_init(&precvframe->u.hdr.list); list_del_init(&precvframe->u.hdr.list);
padapter = precvframe->u.hdr.adapter; padapter = precvframe->u.hdr.adapter;
if (padapter != NULL) { if (padapter) {
precvpriv = &padapter->recvpriv; precvpriv = &padapter->recvpriv;
if (pfree_recv_queue == &precvpriv->free_recv_queue) if (pfree_recv_queue == &precvpriv->free_recv_queue)
precvpriv->free_recvframe_cnt--; precvpriv->free_recvframe_cnt--;
...@@ -160,7 +160,7 @@ int rtw_free_recvframe(union recv_frame *precvframe, struct __queue *pfree_recv_ ...@@ -160,7 +160,7 @@ int rtw_free_recvframe(union recv_frame *precvframe, struct __queue *pfree_recv_
list_add_tail(&(precvframe->u.hdr.list), get_list_head(pfree_recv_queue)); list_add_tail(&(precvframe->u.hdr.list), get_list_head(pfree_recv_queue));
if (padapter != NULL) { if (padapter) {
if (pfree_recv_queue == &precvpriv->free_recv_queue) if (pfree_recv_queue == &precvpriv->free_recv_queue)
precvpriv->free_recvframe_cnt++; precvpriv->free_recvframe_cnt++;
} }
...@@ -183,7 +183,7 @@ sint _rtw_enqueue_recvframe(union recv_frame *precvframe, struct __queue *queue) ...@@ -183,7 +183,7 @@ sint _rtw_enqueue_recvframe(union recv_frame *precvframe, struct __queue *queue)
list_add_tail(&(precvframe->u.hdr.list), get_list_head(queue)); list_add_tail(&(precvframe->u.hdr.list), get_list_head(queue));
if (padapter != NULL) if (padapter)
if (queue == &precvpriv->free_recv_queue) if (queue == &precvpriv->free_recv_queue)
precvpriv->free_recvframe_cnt++; precvpriv->free_recvframe_cnt++;
...@@ -334,7 +334,7 @@ sint recvframe_chkmic(struct adapter *adapter, union recv_frame *precvframe) ...@@ -334,7 +334,7 @@ sint recvframe_chkmic(struct adapter *adapter, union recv_frame *precvframe)
prxattrib->ra[0], prxattrib->ra[1], prxattrib->ra[2], prxattrib->ra[3], prxattrib->ra[4], prxattrib->ra[5])); prxattrib->ra[0], prxattrib->ra[1], prxattrib->ra[2], prxattrib->ra[3], prxattrib->ra[4], prxattrib->ra[5]));
/* calculate mic code */ /* calculate mic code */
if (stainfo != NULL) { if (stainfo) {
if (IS_MCAST(prxattrib->ra)) { if (IS_MCAST(prxattrib->ra)) {
/* mickey =&psecuritypriv->dot118021XGrprxmickey.skey[0]; */ /* mickey =&psecuritypriv->dot118021XGrprxmickey.skey[0]; */
/* iv = precvframe->u.hdr.rx_data+prxattrib->hdrlen; */ /* iv = precvframe->u.hdr.rx_data+prxattrib->hdrlen; */
...@@ -570,7 +570,7 @@ union recv_frame *portctrl(struct adapter *adapter, union recv_frame *precv_fram ...@@ -570,7 +570,7 @@ union recv_frame *portctrl(struct adapter *adapter, union recv_frame *precv_fram
RT_TRACE(_module_rtl871x_recv_c_, _drv_info_, ("########portctrl:adapter->securitypriv.dot11AuthAlgrthm =%d\n", adapter->securitypriv.dot11AuthAlgrthm)); RT_TRACE(_module_rtl871x_recv_c_, _drv_info_, ("########portctrl:adapter->securitypriv.dot11AuthAlgrthm =%d\n", adapter->securitypriv.dot11AuthAlgrthm));
if (auth_alg == 2) { if (auth_alg == 2) {
if ((psta != NULL) && (psta->ieee8021x_blocked)) { if ((psta) && (psta->ieee8021x_blocked)) {
__be16 be_tmp; __be16 be_tmp;
/* blocked */ /* blocked */
...@@ -859,7 +859,7 @@ sint sta2sta_data_frame( ...@@ -859,7 +859,7 @@ sint sta2sta_data_frame(
else else
*psta = rtw_get_stainfo(pstapriv, sta_addr); /* get ap_info */ *psta = rtw_get_stainfo(pstapriv, sta_addr); /* get ap_info */
if (*psta == NULL) { if (!*psta) {
RT_TRACE(_module_rtl871x_recv_c_, _drv_err_, ("can't get psta under sta2sta_data_frame ; drop pkt\n")); RT_TRACE(_module_rtl871x_recv_c_, _drv_err_, ("can't get psta under sta2sta_data_frame ; drop pkt\n"));
ret = _FAIL; ret = _FAIL;
goto exit; goto exit;
...@@ -942,7 +942,7 @@ sint ap2sta_data_frame( ...@@ -942,7 +942,7 @@ sint ap2sta_data_frame(
else else
*psta = rtw_get_stainfo(pstapriv, pattrib->bssid); /* get ap_info */ *psta = rtw_get_stainfo(pstapriv, pattrib->bssid); /* get ap_info */
if (*psta == NULL) { if (!*psta) {
RT_TRACE(_module_rtl871x_recv_c_, _drv_err_, ("ap2sta: can't get psta under STATION_MODE ; drop pkt\n")); RT_TRACE(_module_rtl871x_recv_c_, _drv_err_, ("ap2sta: can't get psta under STATION_MODE ; drop pkt\n"));
#ifdef DBG_RX_DROP_FRAME #ifdef DBG_RX_DROP_FRAME
DBG_871X("DBG_RX_DROP_FRAME %s can't get psta under STATION_MODE ; drop pkt\n", __func__); DBG_871X("DBG_RX_DROP_FRAME %s can't get psta under STATION_MODE ; drop pkt\n", __func__);
...@@ -974,7 +974,7 @@ sint ap2sta_data_frame( ...@@ -974,7 +974,7 @@ sint ap2sta_data_frame(
*psta = rtw_get_stainfo(pstapriv, pattrib->bssid); /* get sta_info */ *psta = rtw_get_stainfo(pstapriv, pattrib->bssid); /* get sta_info */
if (*psta == NULL) { if (!*psta) {
RT_TRACE(_module_rtl871x_recv_c_, _drv_err_, ("can't get psta under MP_MODE ; drop pkt\n")); RT_TRACE(_module_rtl871x_recv_c_, _drv_err_, ("can't get psta under MP_MODE ; drop pkt\n"));
#ifdef DBG_RX_DROP_FRAME #ifdef DBG_RX_DROP_FRAME
DBG_871X("DBG_RX_DROP_FRAME %s can't get psta under WIFI_MP_STATE ; drop pkt\n", __func__); DBG_871X("DBG_RX_DROP_FRAME %s can't get psta under WIFI_MP_STATE ; drop pkt\n", __func__);
...@@ -991,7 +991,7 @@ sint ap2sta_data_frame( ...@@ -991,7 +991,7 @@ sint ap2sta_data_frame(
} else { } else {
if (!memcmp(myhwaddr, pattrib->dst, ETH_ALEN) && (!bmcast)) { if (!memcmp(myhwaddr, pattrib->dst, ETH_ALEN) && (!bmcast)) {
*psta = rtw_get_stainfo(pstapriv, pattrib->bssid); /* get sta_info */ *psta = rtw_get_stainfo(pstapriv, pattrib->bssid); /* get sta_info */
if (*psta == NULL) { if (!*psta) {
/* for AP multicast issue , modify by yiwei */ /* for AP multicast issue , modify by yiwei */
static unsigned long send_issue_deauth_time; static unsigned long send_issue_deauth_time;
...@@ -1042,7 +1042,7 @@ sint sta2ap_data_frame( ...@@ -1042,7 +1042,7 @@ sint sta2ap_data_frame(
} }
*psta = rtw_get_stainfo(pstapriv, pattrib->src); *psta = rtw_get_stainfo(pstapriv, pattrib->src);
if (*psta == NULL) { if (!*psta) {
RT_TRACE(_module_rtl871x_recv_c_, _drv_err_, ("can't get psta under AP_MODE; drop pkt\n")); RT_TRACE(_module_rtl871x_recv_c_, _drv_err_, ("can't get psta under AP_MODE; drop pkt\n"));
DBG_871X("issue_deauth to sta =" MAC_FMT " for the reason(7)\n", MAC_ARG(pattrib->src)); DBG_871X("issue_deauth to sta =" MAC_FMT " for the reason(7)\n", MAC_ARG(pattrib->src));
...@@ -1099,7 +1099,7 @@ sint validate_recv_ctrl_frame(struct adapter *padapter, union recv_frame *precv_ ...@@ -1099,7 +1099,7 @@ sint validate_recv_ctrl_frame(struct adapter *padapter, union recv_frame *precv_
return _FAIL; return _FAIL;
psta = rtw_get_stainfo(pstapriv, GetAddr2Ptr(pframe)); psta = rtw_get_stainfo(pstapriv, GetAddr2Ptr(pframe));
if (psta == NULL) if (!psta)
return _FAIL; return _FAIL;
/* for rx pkt statistics */ /* for rx pkt statistics */
...@@ -1226,7 +1226,7 @@ sint validate_recv_mgnt_frame(struct adapter *padapter, union recv_frame *precv_ ...@@ -1226,7 +1226,7 @@ sint validate_recv_mgnt_frame(struct adapter *padapter, union recv_frame *precv_
RT_TRACE(_module_rtl871x_recv_c_, _drv_info_, ("+validate_recv_mgnt_frame\n")); RT_TRACE(_module_rtl871x_recv_c_, _drv_info_, ("+validate_recv_mgnt_frame\n"));
precv_frame = recvframe_chk_defrag(padapter, precv_frame); precv_frame = recvframe_chk_defrag(padapter, precv_frame);
if (precv_frame == NULL) { if (!precv_frame) {
RT_TRACE(_module_rtl871x_recv_c_, _drv_notice_, ("%s: fragment packet\n", __func__)); RT_TRACE(_module_rtl871x_recv_c_, _drv_notice_, ("%s: fragment packet\n", __func__));
return _SUCCESS; return _SUCCESS;
} }
...@@ -1274,7 +1274,7 @@ sint validate_recv_data_frame(struct adapter *adapter, union recv_frame *precv_f ...@@ -1274,7 +1274,7 @@ sint validate_recv_data_frame(struct adapter *adapter, union recv_frame *precv_f
psa = get_sa(ptr); psa = get_sa(ptr);
pbssid = get_hdr_bssid(ptr); pbssid = get_hdr_bssid(ptr);
if (pbssid == NULL) { if (!pbssid) {
#ifdef DBG_RX_DROP_FRAME #ifdef DBG_RX_DROP_FRAME
DBG_871X("DBG_RX_DROP_FRAME %s pbssid == NULL\n", __func__); DBG_871X("DBG_RX_DROP_FRAME %s pbssid == NULL\n", __func__);
#endif #endif
...@@ -1329,7 +1329,7 @@ sint validate_recv_data_frame(struct adapter *adapter, union recv_frame *precv_f ...@@ -1329,7 +1329,7 @@ sint validate_recv_data_frame(struct adapter *adapter, union recv_frame *precv_f
} }
if (psta == NULL) { if (!psta) {
RT_TRACE(_module_rtl871x_recv_c_, _drv_err_, (" after to_fr_ds_chk; psta == NULL\n")); RT_TRACE(_module_rtl871x_recv_c_, _drv_err_, (" after to_fr_ds_chk; psta == NULL\n"));
#ifdef DBG_RX_DROP_FRAME #ifdef DBG_RX_DROP_FRAME
DBG_871X("DBG_RX_DROP_FRAME %s psta == NULL\n", __func__); DBG_871X("DBG_RX_DROP_FRAME %s psta == NULL\n", __func__);
...@@ -1426,7 +1426,7 @@ static sint validate_80211w_mgmt(struct adapter *adapter, union recv_frame *prec ...@@ -1426,7 +1426,7 @@ static sint validate_80211w_mgmt(struct adapter *adapter, union recv_frame *prec
/* actual management data frame body */ /* actual management data frame body */
data_len = pattrib->pkt_len - pattrib->hdrlen - pattrib->iv_len - pattrib->icv_len; data_len = pattrib->pkt_len - pattrib->hdrlen - pattrib->iv_len - pattrib->icv_len;
mgmt_DATA = rtw_zmalloc(data_len); mgmt_DATA = rtw_zmalloc(data_len);
if (mgmt_DATA == NULL) { if (!mgmt_DATA) {
DBG_871X("%s mgmt allocate fail !!!!!!!!!\n", __func__); DBG_871X("%s mgmt allocate fail !!!!!!!!!\n", __func__);
goto validate_80211w_fail; goto validate_80211w_fail;
} }
...@@ -1811,7 +1811,7 @@ union recv_frame *recvframe_chk_defrag(struct adapter *padapter, union recv_fram ...@@ -1811,7 +1811,7 @@ union recv_frame *recvframe_chk_defrag(struct adapter *padapter, union recv_fram
psta_addr = pfhdr->attrib.ta; psta_addr = pfhdr->attrib.ta;
psta = rtw_get_stainfo(pstapriv, psta_addr); psta = rtw_get_stainfo(pstapriv, psta_addr);
if (psta == NULL) { if (!psta) {
u8 type = GetFrameType(pfhdr->rx_data); u8 type = GetFrameType(pfhdr->rx_data);
if (type != WIFI_DATA_TYPE) { if (type != WIFI_DATA_TYPE) {
psta = rtw_get_bcmc_stainfo(padapter); psta = rtw_get_bcmc_stainfo(padapter);
...@@ -1827,7 +1827,7 @@ union recv_frame *recvframe_chk_defrag(struct adapter *padapter, union recv_fram ...@@ -1827,7 +1827,7 @@ union recv_frame *recvframe_chk_defrag(struct adapter *padapter, union recv_fram
if (ismfrag == 1) { if (ismfrag == 1) {
/* 0~(n-1) fragment frame */ /* 0~(n-1) fragment frame */
/* enqueue to defraf_g */ /* enqueue to defraf_g */
if (pdefrag_q != NULL) { if (pdefrag_q) {
if (fragnum == 0) if (fragnum == 0)
/* the first fragment */ /* the first fragment */
if (!list_empty(&pdefrag_q->queue)) if (!list_empty(&pdefrag_q->queue))
...@@ -1858,7 +1858,7 @@ union recv_frame *recvframe_chk_defrag(struct adapter *padapter, union recv_fram ...@@ -1858,7 +1858,7 @@ union recv_frame *recvframe_chk_defrag(struct adapter *padapter, union recv_fram
if ((ismfrag == 0) && (fragnum != 0)) { if ((ismfrag == 0) && (fragnum != 0)) {
/* the last fragment frame */ /* the last fragment frame */
/* enqueue the last fragment */ /* enqueue the last fragment */
if (pdefrag_q != NULL) { if (pdefrag_q) {
/* spin_lock(&pdefrag_q->lock); */ /* spin_lock(&pdefrag_q->lock); */
phead = get_list_head(pdefrag_q); phead = get_list_head(pdefrag_q);
list_add_tail(&pfhdr->list, phead); list_add_tail(&pfhdr->list, phead);
...@@ -1879,7 +1879,7 @@ union recv_frame *recvframe_chk_defrag(struct adapter *padapter, union recv_fram ...@@ -1879,7 +1879,7 @@ union recv_frame *recvframe_chk_defrag(struct adapter *padapter, union recv_fram
} }
if ((prtnframe != NULL) && (prtnframe->u.hdr.attrib.privacy)) { if ((prtnframe) && (prtnframe->u.hdr.attrib.privacy)) {
/* after defrag we must check tkip mic code */ /* after defrag we must check tkip mic code */
if (recvframe_chkmic(padapter, prtnframe) == _FAIL) { if (recvframe_chkmic(padapter, prtnframe) == _FAIL) {
RT_TRACE(_module_rtl871x_recv_c_, _drv_err_, ("recvframe_chkmic(padapter, prtnframe) == _FAIL\n")); RT_TRACE(_module_rtl871x_recv_c_, _drv_err_, ("recvframe_chkmic(padapter, prtnframe) == _FAIL\n"));
...@@ -1922,7 +1922,7 @@ static int amsdu_to_msdu(struct adapter *padapter, union recv_frame *prframe) ...@@ -1922,7 +1922,7 @@ static int amsdu_to_msdu(struct adapter *padapter, union recv_frame *prframe)
} }
sub_pkt = rtw_os_alloc_msdu_pkt(prframe, nSubframe_Length, pdata); sub_pkt = rtw_os_alloc_msdu_pkt(prframe, nSubframe_Length, pdata);
if (sub_pkt == NULL) { if (!sub_pkt) {
DBG_871X("%s(): allocate sub packet fail !!!\n", __func__); DBG_871X("%s(): allocate sub packet fail !!!\n", __func__);
break; break;
} }
...@@ -2451,7 +2451,7 @@ static int recv_func_posthandle(struct adapter *padapter, union recv_frame *prfr ...@@ -2451,7 +2451,7 @@ static int recv_func_posthandle(struct adapter *padapter, union recv_frame *prfr
DBG_COUNTER(padapter->rx_logs.core_rx_post); DBG_COUNTER(padapter->rx_logs.core_rx_post);
prframe = decryptor(padapter, prframe); prframe = decryptor(padapter, prframe);
if (prframe == NULL) { if (!prframe) {
RT_TRACE(_module_rtl871x_recv_c_, _drv_err_, ("decryptor: drop pkt\n")); RT_TRACE(_module_rtl871x_recv_c_, _drv_err_, ("decryptor: drop pkt\n"));
#ifdef DBG_RX_DROP_FRAME #ifdef DBG_RX_DROP_FRAME
DBG_871X("DBG_RX_DROP_FRAME %s decryptor: drop pkt\n", __func__); DBG_871X("DBG_RX_DROP_FRAME %s decryptor: drop pkt\n", __func__);
...@@ -2462,7 +2462,7 @@ static int recv_func_posthandle(struct adapter *padapter, union recv_frame *prfr ...@@ -2462,7 +2462,7 @@ static int recv_func_posthandle(struct adapter *padapter, union recv_frame *prfr
} }
prframe = recvframe_chk_defrag(padapter, prframe); prframe = recvframe_chk_defrag(padapter, prframe);
if (prframe == NULL) { if (!prframe) {
RT_TRACE(_module_rtl871x_recv_c_, _drv_err_, ("recvframe_chk_defrag: drop pkt\n")); RT_TRACE(_module_rtl871x_recv_c_, _drv_err_, ("recvframe_chk_defrag: drop pkt\n"));
#ifdef DBG_RX_DROP_FRAME #ifdef DBG_RX_DROP_FRAME
DBG_871X("DBG_RX_DROP_FRAME %s recvframe_chk_defrag: drop pkt\n", __func__); DBG_871X("DBG_RX_DROP_FRAME %s recvframe_chk_defrag: drop pkt\n", __func__);
...@@ -2472,7 +2472,7 @@ static int recv_func_posthandle(struct adapter *padapter, union recv_frame *prfr ...@@ -2472,7 +2472,7 @@ static int recv_func_posthandle(struct adapter *padapter, union recv_frame *prfr
} }
prframe = portctrl(padapter, prframe); prframe = portctrl(padapter, prframe);
if (prframe == NULL) { if (!prframe) {
RT_TRACE(_module_rtl871x_recv_c_, _drv_err_, ("portctrl: drop pkt\n")); RT_TRACE(_module_rtl871x_recv_c_, _drv_err_, ("portctrl: drop pkt\n"));
#ifdef DBG_RX_DROP_FRAME #ifdef DBG_RX_DROP_FRAME
DBG_871X("DBG_RX_DROP_FRAME %s portctrl: drop pkt\n", __func__); DBG_871X("DBG_RX_DROP_FRAME %s portctrl: drop pkt\n", __func__);
......
Markdown is supported
0%
or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment