Commit 0e934ce2 authored by Michael Straube's avatar Michael Straube Committed by Greg Kroah-Hartman

staging: rtl8712: clean up comparsions to NULL

Clean up comparsions to NULL Reported by checkpatch.
if (x == NULL) -> if (!x)
if (x != NULL) -> if (x)
Signed-off-by: default avatarMichael Straube <straube.linux@gmail.com>
Link: https://lore.kernel.org/r/20200919085032.32453-1-straube.linux@gmail.comSigned-off-by: default avatarGreg Kroah-Hartman <gregkh@linuxfoundation.org>
parent dbbc8fdf
...@@ -161,7 +161,7 @@ void r8712_free_cmd_obj(struct cmd_obj *pcmd) ...@@ -161,7 +161,7 @@ void r8712_free_cmd_obj(struct cmd_obj *pcmd)
if ((pcmd->cmdcode != _JoinBss_CMD_) && if ((pcmd->cmdcode != _JoinBss_CMD_) &&
(pcmd->cmdcode != _CreateBss_CMD_)) (pcmd->cmdcode != _CreateBss_CMD_))
kfree(pcmd->parmbuf); kfree(pcmd->parmbuf);
if (pcmd->rsp != NULL) { if (pcmd->rsp) {
if (pcmd->rspsz != 0) if (pcmd->rspsz != 0)
kfree(pcmd->rsp); kfree(pcmd->rsp);
} }
...@@ -191,7 +191,7 @@ u8 r8712_sitesurvey_cmd(struct _adapter *padapter, ...@@ -191,7 +191,7 @@ u8 r8712_sitesurvey_cmd(struct _adapter *padapter,
psurveyPara->passive_mode = cpu_to_le32(pmlmepriv->passive_mode); psurveyPara->passive_mode = cpu_to_le32(pmlmepriv->passive_mode);
psurveyPara->ss_ssidlen = 0; psurveyPara->ss_ssidlen = 0;
memset(psurveyPara->ss_ssid, 0, IW_ESSID_MAX_SIZE + 1); memset(psurveyPara->ss_ssid, 0, IW_ESSID_MAX_SIZE + 1);
if ((pssid != NULL) && (pssid->SsidLength)) { if (pssid && pssid->SsidLength) {
memcpy(psurveyPara->ss_ssid, pssid->Ssid, pssid->SsidLength); memcpy(psurveyPara->ss_ssid, pssid->Ssid, pssid->SsidLength);
psurveyPara->ss_ssidlen = cpu_to_le32(pssid->SsidLength); psurveyPara->ss_ssidlen = cpu_to_le32(pssid->SsidLength);
} }
......
...@@ -50,7 +50,7 @@ static uint _init_intf_hdl(struct _adapter *padapter, ...@@ -50,7 +50,7 @@ static uint _init_intf_hdl(struct _adapter *padapter,
init_intf_priv = &r8712_usb_init_intf_priv; init_intf_priv = &r8712_usb_init_intf_priv;
pintf_priv = pintf_hdl->pintfpriv = kmalloc(sizeof(struct intf_priv), pintf_priv = pintf_hdl->pintfpriv = kmalloc(sizeof(struct intf_priv),
GFP_ATOMIC); GFP_ATOMIC);
if (pintf_priv == NULL) if (!pintf_priv)
goto _init_intf_hdl_fail; goto _init_intf_hdl_fail;
pintf_hdl->adapter = (u8 *)padapter; pintf_hdl->adapter = (u8 *)padapter;
set_intf_option(&pintf_hdl->intf_option); set_intf_option(&pintf_hdl->intf_option);
......
...@@ -481,11 +481,11 @@ static int r871x_set_wpa_ie(struct _adapter *padapter, char *pie, ...@@ -481,11 +481,11 @@ static int r871x_set_wpa_ie(struct _adapter *padapter, char *pie,
int group_cipher = 0, pairwise_cipher = 0; int group_cipher = 0, pairwise_cipher = 0;
int ret = 0; int ret = 0;
if ((ielen > MAX_WPA_IE_LEN) || (pie == NULL)) if (ielen > MAX_WPA_IE_LEN || !pie)
return -EINVAL; return -EINVAL;
if (ielen) { if (ielen) {
buf = kmemdup(pie, ielen, GFP_ATOMIC); buf = kmemdup(pie, ielen, GFP_ATOMIC);
if (buf == NULL) if (!buf)
return -ENOMEM; return -ENOMEM;
if (ielen < RSN_HEADER_LEN) { if (ielen < RSN_HEADER_LEN) {
ret = -EINVAL; ret = -EINVAL;
...@@ -777,7 +777,7 @@ static int r871x_wx_set_pmkid(struct net_device *dev, ...@@ -777,7 +777,7 @@ static int r871x_wx_set_pmkid(struct net_device *dev,
* If cmd is IW_PMKSA_REMOVE, it means the wpa_supplicant wants to * If cmd is IW_PMKSA_REMOVE, it means the wpa_supplicant wants to
* remove a PMKID/BSSID from driver. * remove a PMKID/BSSID from driver.
*/ */
if (pPMK == NULL) if (!pPMK)
return -EINVAL; return -EINVAL;
memcpy(strIssueBssid, pPMK->bssid.sa_data, ETH_ALEN); memcpy(strIssueBssid, pPMK->bssid.sa_data, ETH_ALEN);
switch (pPMK->cmd) { switch (pPMK->cmd) {
...@@ -1099,7 +1099,7 @@ static int r871x_wx_set_mlme(struct net_device *dev, ...@@ -1099,7 +1099,7 @@ static int r871x_wx_set_mlme(struct net_device *dev,
struct _adapter *padapter = netdev_priv(dev); struct _adapter *padapter = netdev_priv(dev);
struct iw_mlme *mlme = (struct iw_mlme *) extra; struct iw_mlme *mlme = (struct iw_mlme *) extra;
if (mlme == NULL) if (!mlme)
return -1; return -1;
switch (mlme->cmd) { switch (mlme->cmd) {
case IW_MLME_DEAUTH: case IW_MLME_DEAUTH:
...@@ -1950,7 +1950,7 @@ static int r871x_get_ap_info(struct net_device *dev, ...@@ -1950,7 +1950,7 @@ static int r871x_get_ap_info(struct net_device *dev,
u8 bssid[ETH_ALEN]; u8 bssid[ETH_ALEN];
char data[33]; char data[33];
if (padapter->driver_stopped || (pdata == NULL)) if (padapter->driver_stopped || !pdata)
return -EINVAL; return -EINVAL;
while (check_fwstate(pmlmepriv, _FW_UNDER_SURVEY | while (check_fwstate(pmlmepriv, _FW_UNDER_SURVEY |
_FW_UNDER_LINKING)) { _FW_UNDER_LINKING)) {
...@@ -2014,7 +2014,7 @@ static int r871x_set_pid(struct net_device *dev, ...@@ -2014,7 +2014,7 @@ static int r871x_set_pid(struct net_device *dev,
struct _adapter *padapter = netdev_priv(dev); struct _adapter *padapter = netdev_priv(dev);
struct iw_point *pdata = &wrqu->data; struct iw_point *pdata = &wrqu->data;
if ((padapter->driver_stopped) || (pdata == NULL)) if (padapter->driver_stopped || !pdata)
return -EINVAL; return -EINVAL;
if (copy_from_user(&padapter->pid, pdata->pointer, sizeof(int))) if (copy_from_user(&padapter->pid, pdata->pointer, sizeof(int)))
return -EINVAL; return -EINVAL;
...@@ -2030,7 +2030,7 @@ static int r871x_set_chplan(struct net_device *dev, ...@@ -2030,7 +2030,7 @@ static int r871x_set_chplan(struct net_device *dev,
struct iw_point *pdata = &wrqu->data; struct iw_point *pdata = &wrqu->data;
int ch_plan = -1; int ch_plan = -1;
if ((padapter->driver_stopped) || (pdata == NULL)) { if (padapter->driver_stopped || !pdata) {
ret = -EINVAL; ret = -EINVAL;
goto exit; goto exit;
} }
...@@ -2050,7 +2050,7 @@ static int r871x_wps_start(struct net_device *dev, ...@@ -2050,7 +2050,7 @@ static int r871x_wps_start(struct net_device *dev,
struct iw_point *pdata = &wrqu->data; struct iw_point *pdata = &wrqu->data;
u32 u32wps_start = 0; u32 u32wps_start = 0;
if ((padapter->driver_stopped) || (pdata == NULL)) if (padapter->driver_stopped || !pdata)
return -EINVAL; return -EINVAL;
if (copy_from_user((void *)&u32wps_start, pdata->pointer, 4)) if (copy_from_user((void *)&u32wps_start, pdata->pointer, 4))
return -EFAULT; return -EFAULT;
......
...@@ -754,7 +754,7 @@ void r8712_joinbss_event_callback(struct _adapter *adapter, u8 *pbuf) ...@@ -754,7 +754,7 @@ void r8712_joinbss_event_callback(struct _adapter *adapter, u8 *pbuf)
ptarget_wlan->fixed = true; ptarget_wlan->fixed = true;
} }
if (ptarget_wlan == NULL) { if (!ptarget_wlan) {
if (check_fwstate(pmlmepriv, if (check_fwstate(pmlmepriv,
_FW_UNDER_LINKING)) _FW_UNDER_LINKING))
pmlmepriv->fw_state ^= pmlmepriv->fw_state ^=
...@@ -768,7 +768,7 @@ void r8712_joinbss_event_callback(struct _adapter *adapter, u8 *pbuf) ...@@ -768,7 +768,7 @@ void r8712_joinbss_event_callback(struct _adapter *adapter, u8 *pbuf)
ptarget_sta = ptarget_sta =
r8712_get_stainfo(pstapriv, r8712_get_stainfo(pstapriv,
pnetwork->network.MacAddress); pnetwork->network.MacAddress);
if (ptarget_sta == NULL) if (!ptarget_sta)
ptarget_sta = ptarget_sta =
r8712_alloc_stainfo(pstapriv, r8712_alloc_stainfo(pstapriv,
pnetwork->network.MacAddress); pnetwork->network.MacAddress);
...@@ -879,7 +879,7 @@ void r8712_stassoc_event_callback(struct _adapter *adapter, u8 *pbuf) ...@@ -879,7 +879,7 @@ void r8712_stassoc_event_callback(struct _adapter *adapter, u8 *pbuf)
if (!r8712_access_ctrl(&adapter->acl_list, pstassoc->macaddr)) if (!r8712_access_ctrl(&adapter->acl_list, pstassoc->macaddr))
return; return;
psta = r8712_get_stainfo(&adapter->stapriv, pstassoc->macaddr); psta = r8712_get_stainfo(&adapter->stapriv, pstassoc->macaddr);
if (psta != NULL) { if (psta) {
/*the sta have been in sta_info_queue => do nothing /*the sta have been in sta_info_queue => do nothing
*(between drv has received this event before and *(between drv has received this event before and
* fw have not yet to set key to CAM_ENTRY) * fw have not yet to set key to CAM_ENTRY)
...@@ -888,7 +888,7 @@ void r8712_stassoc_event_callback(struct _adapter *adapter, u8 *pbuf) ...@@ -888,7 +888,7 @@ void r8712_stassoc_event_callback(struct _adapter *adapter, u8 *pbuf)
} }
psta = r8712_alloc_stainfo(&adapter->stapriv, pstassoc->macaddr); psta = r8712_alloc_stainfo(&adapter->stapriv, pstassoc->macaddr);
if (psta == NULL) if (!psta)
return; return;
/* to do : init sta_info variable */ /* to do : init sta_info variable */
psta->qos_option = 0; psta->qos_option = 0;
...@@ -1080,8 +1080,7 @@ int r8712_select_and_join_from_scan(struct mlme_priv *pmlmepriv) ...@@ -1080,8 +1080,7 @@ int r8712_select_and_join_from_scan(struct mlme_priv *pmlmepriv)
pmlmepriv->pscanned = phead->next; pmlmepriv->pscanned = phead->next;
while (1) { while (1) {
if (end_of_queue_search(phead, pmlmepriv->pscanned)) { if (end_of_queue_search(phead, pmlmepriv->pscanned)) {
if ((pmlmepriv->assoc_by_rssi) && if (pmlmepriv->assoc_by_rssi && pnetwork_max_rssi) {
(pnetwork_max_rssi != NULL)) {
pnetwork = pnetwork_max_rssi; pnetwork = pnetwork_max_rssi;
goto ask_for_joinbss; goto ask_for_joinbss;
} }
......
...@@ -186,7 +186,7 @@ static int mp_start_test(struct _adapter *padapter) ...@@ -186,7 +186,7 @@ static int mp_start_test(struct _adapter *padapter)
if (psta) if (psta)
r8712_free_stainfo(padapter, psta); r8712_free_stainfo(padapter, psta);
psta = r8712_alloc_stainfo(&padapter->stapriv, bssid.MacAddress); psta = r8712_alloc_stainfo(&padapter->stapriv, bssid.MacAddress);
if (psta == NULL) { if (!psta) {
res = -ENOMEM; res = -ENOMEM;
goto end_of_mp_start_test; goto end_of_mp_start_test;
} }
......
...@@ -58,7 +58,7 @@ void _r8712_init_recv_priv(struct recv_priv *precvpriv, ...@@ -58,7 +58,7 @@ void _r8712_init_recv_priv(struct recv_priv *precvpriv,
precvpriv->pallocated_frame_buf = kzalloc(NR_RECVFRAME * precvpriv->pallocated_frame_buf = kzalloc(NR_RECVFRAME *
sizeof(union recv_frame) + RXFRAME_ALIGN_SZ, sizeof(union recv_frame) + RXFRAME_ALIGN_SZ,
GFP_ATOMIC); GFP_ATOMIC);
if (precvpriv->pallocated_frame_buf == NULL) if (!precvpriv->pallocated_frame_buf)
return; return;
kmemleak_not_leak(precvpriv->pallocated_frame_buf); kmemleak_not_leak(precvpriv->pallocated_frame_buf);
precvpriv->precv_frame_buf = precvpriv->pallocated_frame_buf + precvpriv->precv_frame_buf = precvpriv->pallocated_frame_buf +
...@@ -97,7 +97,7 @@ union recv_frame *r8712_alloc_recvframe(struct __queue *pfree_recv_queue) ...@@ -97,7 +97,7 @@ union recv_frame *r8712_alloc_recvframe(struct __queue *pfree_recv_queue)
if (precvframe) { if (precvframe) {
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--;
...@@ -145,7 +145,7 @@ sint r8712_recvframe_chkmic(struct _adapter *adapter, ...@@ -145,7 +145,7 @@ sint r8712_recvframe_chkmic(struct _adapter *adapter,
stainfo = r8712_get_stainfo(&adapter->stapriv, &prxattrib->ta[0]); stainfo = r8712_get_stainfo(&adapter->stapriv, &prxattrib->ta[0]);
if (prxattrib->encrypt == _TKIP_) { if (prxattrib->encrypt == _TKIP_) {
/* calculate mic code */ /* calculate mic code */
if (stainfo != NULL) { if (stainfo) {
if (is_multicast_ether_addr(prxattrib->ra)) { if (is_multicast_ether_addr(prxattrib->ra)) {
iv = precvframe->u.hdr.rx_data + iv = precvframe->u.hdr.rx_data +
prxattrib->hdrlen; prxattrib->hdrlen;
...@@ -242,7 +242,7 @@ union recv_frame *r8712_portctrl(struct _adapter *adapter, ...@@ -242,7 +242,7 @@ union recv_frame *r8712_portctrl(struct _adapter *adapter,
ptr = ptr + pfhdr->attrib.hdrlen + LLC_HEADER_SIZE; ptr = ptr + pfhdr->attrib.hdrlen + LLC_HEADER_SIZE;
ether_type = get_unaligned_be16(ptr); ether_type = get_unaligned_be16(ptr);
if ((psta != NULL) && (psta->ieee8021x_blocked)) { if (psta && psta->ieee8021x_blocked) {
/* blocked /* blocked
* only accept EAPOL frame * only accept EAPOL frame
*/ */
...@@ -349,7 +349,7 @@ static sint sta2sta_data_frame(struct _adapter *adapter, ...@@ -349,7 +349,7 @@ static sint sta2sta_data_frame(struct _adapter *adapter,
*psta = r8712_get_bcmc_stainfo(adapter); *psta = r8712_get_bcmc_stainfo(adapter);
else else
*psta = r8712_get_stainfo(pstapriv, sta_addr); /* get ap_info */ *psta = r8712_get_stainfo(pstapriv, sta_addr); /* get ap_info */
if (*psta == NULL) { if (!*psta) {
if (check_fwstate(pmlmepriv, WIFI_MP_STATE)) if (check_fwstate(pmlmepriv, WIFI_MP_STATE))
adapter->mppriv.rx_pktloss++; adapter->mppriv.rx_pktloss++;
return _FAIL; return _FAIL;
...@@ -399,7 +399,7 @@ static sint ap2sta_data_frame(struct _adapter *adapter, ...@@ -399,7 +399,7 @@ static sint ap2sta_data_frame(struct _adapter *adapter,
*psta = r8712_get_bcmc_stainfo(adapter); *psta = r8712_get_bcmc_stainfo(adapter);
else else
*psta = r8712_get_stainfo(pstapriv, pattrib->bssid); *psta = r8712_get_stainfo(pstapriv, pattrib->bssid);
if (*psta == NULL) if (!*psta)
return _FAIL; return _FAIL;
} else if (check_fwstate(pmlmepriv, WIFI_MP_STATE) && } else if (check_fwstate(pmlmepriv, WIFI_MP_STATE) &&
check_fwstate(pmlmepriv, _FW_LINKED)) { check_fwstate(pmlmepriv, _FW_LINKED)) {
...@@ -410,7 +410,7 @@ static sint ap2sta_data_frame(struct _adapter *adapter, ...@@ -410,7 +410,7 @@ static sint ap2sta_data_frame(struct _adapter *adapter,
memcpy(pattrib->ta, pattrib->src, ETH_ALEN); memcpy(pattrib->ta, pattrib->src, ETH_ALEN);
memcpy(pattrib->bssid, mybssid, ETH_ALEN); memcpy(pattrib->bssid, mybssid, ETH_ALEN);
*psta = r8712_get_stainfo(pstapriv, pattrib->bssid); *psta = r8712_get_stainfo(pstapriv, pattrib->bssid);
if (*psta == NULL) if (!*psta)
return _FAIL; return _FAIL;
} else { } else {
return _FAIL; return _FAIL;
...@@ -435,7 +435,7 @@ static sint sta2ap_data_frame(struct _adapter *adapter, ...@@ -435,7 +435,7 @@ static sint sta2ap_data_frame(struct _adapter *adapter,
if (memcmp(pattrib->bssid, mybssid, ETH_ALEN)) if (memcmp(pattrib->bssid, mybssid, ETH_ALEN))
return _FAIL; return _FAIL;
*psta = r8712_get_stainfo(pstapriv, pattrib->src); *psta = r8712_get_stainfo(pstapriv, pattrib->src);
if (*psta == NULL) if (!*psta)
return _FAIL; return _FAIL;
} }
return _SUCCESS; return _SUCCESS;
...@@ -469,7 +469,7 @@ static sint validate_recv_data_frame(struct _adapter *adapter, ...@@ -469,7 +469,7 @@ static sint validate_recv_data_frame(struct _adapter *adapter,
pda = get_da(ptr); pda = get_da(ptr);
psa = get_sa(ptr); psa = get_sa(ptr);
pbssid = get_hdr_bssid(ptr); pbssid = get_hdr_bssid(ptr);
if (pbssid == NULL) if (!pbssid)
return _FAIL; return _FAIL;
memcpy(pattrib->dst, pda, ETH_ALEN); memcpy(pattrib->dst, pda, ETH_ALEN);
memcpy(pattrib->src, psa, ETH_ALEN); memcpy(pattrib->src, psa, ETH_ALEN);
...@@ -499,7 +499,7 @@ static sint validate_recv_data_frame(struct _adapter *adapter, ...@@ -499,7 +499,7 @@ static sint validate_recv_data_frame(struct _adapter *adapter,
} }
if (res == _FAIL) if (res == _FAIL)
return _FAIL; return _FAIL;
if (psta == NULL) if (!psta)
return _FAIL; return _FAIL;
precv_frame->u.hdr.psta = psta; precv_frame->u.hdr.psta = psta;
pattrib->amsdu = 0; pattrib->amsdu = 0;
......
...@@ -584,7 +584,7 @@ u32 r8712_tkip_encrypt(struct _adapter *padapter, u8 *pxmitframe) ...@@ -584,7 +584,7 @@ u32 r8712_tkip_encrypt(struct _adapter *padapter, u8 *pxmitframe)
else else
stainfo = r8712_get_stainfo(&padapter->stapriv, stainfo = r8712_get_stainfo(&padapter->stapriv,
&pattrib->ra[0]); &pattrib->ra[0]);
if (stainfo != NULL) { if (stainfo) {
prwskey = &stainfo->x_UncstKey.skey[0]; prwskey = &stainfo->x_UncstKey.skey[0];
for (curfragnum = 0; curfragnum < pattrib->nr_frags; for (curfragnum = 0; curfragnum < pattrib->nr_frags;
curfragnum++) { curfragnum++) {
...@@ -658,7 +658,7 @@ void r8712_tkip_decrypt(struct _adapter *padapter, u8 *precvframe) ...@@ -658,7 +658,7 @@ void r8712_tkip_decrypt(struct _adapter *padapter, u8 *precvframe)
if (prxattrib->encrypt == _TKIP_) { if (prxattrib->encrypt == _TKIP_) {
stainfo = r8712_get_stainfo(&padapter->stapriv, stainfo = r8712_get_stainfo(&padapter->stapriv,
&prxattrib->ta[0]); &prxattrib->ta[0]);
if (stainfo != NULL) { if (stainfo) {
iv = pframe + prxattrib->hdrlen; iv = pframe + prxattrib->hdrlen;
payload = pframe + prxattrib->iv_len + payload = pframe + prxattrib->iv_len +
prxattrib->hdrlen; prxattrib->hdrlen;
...@@ -1155,7 +1155,7 @@ u32 r8712_aes_encrypt(struct _adapter *padapter, u8 *pxmitframe) ...@@ -1155,7 +1155,7 @@ u32 r8712_aes_encrypt(struct _adapter *padapter, u8 *pxmitframe)
else else
stainfo = r8712_get_stainfo(&padapter->stapriv, stainfo = r8712_get_stainfo(&padapter->stapriv,
&pattrib->ra[0]); &pattrib->ra[0]);
if (stainfo != NULL) { if (stainfo) {
prwskey = &stainfo->x_UncstKey.skey[0]; prwskey = &stainfo->x_UncstKey.skey[0];
for (curfragnum = 0; curfragnum < pattrib->nr_frags; for (curfragnum = 0; curfragnum < pattrib->nr_frags;
curfragnum++) { curfragnum++) {
...@@ -1357,7 +1357,7 @@ void r8712_aes_decrypt(struct _adapter *padapter, u8 *precvframe) ...@@ -1357,7 +1357,7 @@ void r8712_aes_decrypt(struct _adapter *padapter, u8 *precvframe)
if (prxattrib->encrypt == _AES_) { if (prxattrib->encrypt == _AES_) {
stainfo = r8712_get_stainfo(&padapter->stapriv, stainfo = r8712_get_stainfo(&padapter->stapriv,
&prxattrib->ta[0]); &prxattrib->ta[0]);
if (stainfo != NULL) { if (stainfo) {
if (is_multicast_ether_addr(prxattrib->ra)) { if (is_multicast_ether_addr(prxattrib->ra)) {
iv = pframe + prxattrib->hdrlen; iv = pframe + prxattrib->hdrlen;
idx = iv[3]; idx = iv[3];
......
...@@ -149,7 +149,7 @@ void r8712_free_stainfo(struct _adapter *padapter, struct sta_info *psta) ...@@ -149,7 +149,7 @@ void r8712_free_stainfo(struct _adapter *padapter, struct sta_info *psta)
struct xmit_priv *pxmitpriv = &padapter->xmitpriv; struct xmit_priv *pxmitpriv = &padapter->xmitpriv;
struct sta_priv *pstapriv = &padapter->stapriv; struct sta_priv *pstapriv = &padapter->stapriv;
if (psta == NULL) if (!psta)
return; return;
pfree_sta_queue = &pstapriv->free_sta_queue; pfree_sta_queue = &pstapriv->free_sta_queue;
pstaxmitpriv = &psta->sta_xmitpriv; pstaxmitpriv = &psta->sta_xmitpriv;
...@@ -222,7 +222,7 @@ struct sta_info *r8712_get_stainfo(struct sta_priv *pstapriv, u8 *hwaddr) ...@@ -222,7 +222,7 @@ struct sta_info *r8712_get_stainfo(struct sta_priv *pstapriv, u8 *hwaddr)
struct sta_info *psta = NULL; struct sta_info *psta = NULL;
u32 index; u32 index;
if (hwaddr == NULL) if (!hwaddr)
return NULL; return NULL;
index = wifi_mac_hash(hwaddr); index = wifi_mac_hash(hwaddr);
spin_lock_irqsave(&pstapriv->sta_hash_lock, irqL); spin_lock_irqsave(&pstapriv->sta_hash_lock, irqL);
......
...@@ -156,7 +156,7 @@ void _free_xmit_priv(struct xmit_priv *pxmitpriv) ...@@ -156,7 +156,7 @@ void _free_xmit_priv(struct xmit_priv *pxmitpriv)
pxmitpriv->pxmit_frame_buf; pxmitpriv->pxmit_frame_buf;
struct xmit_buf *pxmitbuf = (struct xmit_buf *)pxmitpriv->pxmitbuf; struct xmit_buf *pxmitbuf = (struct xmit_buf *)pxmitpriv->pxmitbuf;
if (pxmitpriv->pxmit_frame_buf == NULL) if (!pxmitpriv->pxmit_frame_buf)
return; return;
for (i = 0; i < NR_XMITFRAME; i++) { for (i = 0; i < NR_XMITFRAME; i++) {
r8712_xmit_complete(padapter, pxmitframe); r8712_xmit_complete(padapter, pxmitframe);
...@@ -269,7 +269,7 @@ int r8712_update_attrib(struct _adapter *padapter, _pkt *pkt, ...@@ -269,7 +269,7 @@ int r8712_update_attrib(struct _adapter *padapter, _pkt *pkt,
pattrib->mac_id = 5; pattrib->mac_id = 5;
} else { } else {
psta = r8712_get_stainfo(pstapriv, pattrib->ra); psta = r8712_get_stainfo(pstapriv, pattrib->ra);
if (psta == NULL) /* drop the pkt */ if (!psta) /* drop the pkt */
return -ENOMEM; return -ENOMEM;
if (check_fwstate(pmlmepriv, WIFI_STATION_STATE)) if (check_fwstate(pmlmepriv, WIFI_STATION_STATE))
pattrib->mac_id = 5; pattrib->mac_id = 5;
...@@ -362,7 +362,7 @@ static int xmitframe_addmic(struct _adapter *padapter, ...@@ -362,7 +362,7 @@ static int xmitframe_addmic(struct _adapter *padapter,
&pattrib->ra[0]); &pattrib->ra[0]);
if (pattrib->encrypt == _TKIP_) { if (pattrib->encrypt == _TKIP_) {
/*encode mic code*/ /*encode mic code*/
if (stainfo != NULL) { if (stainfo) {
u8 null_key[16] = {0x0, 0x0, 0x0, 0x0, 0x0, 0x0, 0x0, u8 null_key[16] = {0x0, 0x0, 0x0, 0x0, 0x0, 0x0, 0x0,
0x0, 0x0, 0x0, 0x0, 0x0, 0x0, 0x0, 0x0, 0x0, 0x0, 0x0, 0x0, 0x0, 0x0,
0x0, 0x0}; 0x0, 0x0};
...@@ -592,10 +592,10 @@ sint r8712_xmitframe_coalesce(struct _adapter *padapter, _pkt *pkt, ...@@ -592,10 +592,10 @@ sint r8712_xmitframe_coalesce(struct _adapter *padapter, _pkt *pkt,
u8 *pbuf_start; u8 *pbuf_start;
bool bmcst = is_multicast_ether_addr(pattrib->ra); bool bmcst = is_multicast_ether_addr(pattrib->ra);
if (pattrib->psta == NULL) if (!pattrib->psta)
return _FAIL; return _FAIL;
psta = pattrib->psta; psta = pattrib->psta;
if (pxmitframe->buf_addr == NULL) if (!pxmitframe->buf_addr)
return _FAIL; return _FAIL;
pbuf_start = pxmitframe->buf_addr; pbuf_start = pxmitframe->buf_addr;
ptxdesc = pbuf_start; ptxdesc = pbuf_start;
...@@ -623,7 +623,7 @@ sint r8712_xmitframe_coalesce(struct _adapter *padapter, _pkt *pkt, ...@@ -623,7 +623,7 @@ sint r8712_xmitframe_coalesce(struct _adapter *padapter, _pkt *pkt,
mpdu_len -= pattrib->hdrlen; mpdu_len -= pattrib->hdrlen;
/* adding icv, if necessary...*/ /* adding icv, if necessary...*/
if (pattrib->iv_len) { if (pattrib->iv_len) {
if (psta != NULL) { if (psta) {
switch (pattrib->encrypt) { switch (pattrib->encrypt) {
case _WEP40_: case _WEP40_:
case _WEP104_: case _WEP104_:
...@@ -711,7 +711,7 @@ void r8712_update_protection(struct _adapter *padapter, u8 *ie, uint ie_len) ...@@ -711,7 +711,7 @@ void r8712_update_protection(struct _adapter *padapter, u8 *ie, uint ie_len)
case AUTO_VCS: case AUTO_VCS:
default: default:
perp = r8712_get_ie(ie, _ERPINFO_IE_, &erp_len, ie_len); perp = r8712_get_ie(ie, _ERPINFO_IE_, &erp_len, ie_len);
if (perp == NULL) { if (!perp) {
pxmitpriv->vcs = NONE_VCS; pxmitpriv->vcs = NONE_VCS;
} else { } else {
protection = (*(perp + 2)) & BIT(1); protection = (*(perp + 2)) & BIT(1);
...@@ -750,7 +750,7 @@ void r8712_free_xmitbuf(struct xmit_priv *pxmitpriv, struct xmit_buf *pxmitbuf) ...@@ -750,7 +750,7 @@ void r8712_free_xmitbuf(struct xmit_priv *pxmitpriv, struct xmit_buf *pxmitbuf)
unsigned long irqL; unsigned long irqL;
struct __queue *pfree_xmitbuf_queue = &pxmitpriv->free_xmitbuf_queue; struct __queue *pfree_xmitbuf_queue = &pxmitpriv->free_xmitbuf_queue;
if (pxmitbuf == NULL) if (!pxmitbuf)
return; return;
spin_lock_irqsave(&pfree_xmitbuf_queue->lock, irqL); spin_lock_irqsave(&pfree_xmitbuf_queue->lock, irqL);
list_del_init(&pxmitbuf->list); list_del_init(&pxmitbuf->list);
...@@ -803,7 +803,7 @@ void r8712_free_xmitframe(struct xmit_priv *pxmitpriv, ...@@ -803,7 +803,7 @@ void r8712_free_xmitframe(struct xmit_priv *pxmitpriv,
struct __queue *pfree_xmit_queue = &pxmitpriv->free_xmit_queue; struct __queue *pfree_xmit_queue = &pxmitpriv->free_xmit_queue;
struct _adapter *padapter = pxmitpriv->adapter; struct _adapter *padapter = pxmitpriv->adapter;
if (pxmitframe == NULL) if (!pxmitframe)
return; return;
spin_lock_irqsave(&pfree_xmit_queue->lock, irqL); spin_lock_irqsave(&pfree_xmit_queue->lock, irqL);
list_del_init(&pxmitframe->list); list_del_init(&pxmitframe->list);
...@@ -819,7 +819,7 @@ void r8712_free_xmitframe(struct xmit_priv *pxmitpriv, ...@@ -819,7 +819,7 @@ void r8712_free_xmitframe(struct xmit_priv *pxmitpriv,
void r8712_free_xmitframe_ex(struct xmit_priv *pxmitpriv, void r8712_free_xmitframe_ex(struct xmit_priv *pxmitpriv,
struct xmit_frame *pxmitframe) struct xmit_frame *pxmitframe)
{ {
if (pxmitframe == NULL) if (!pxmitframe)
return; return;
if (pxmitframe->frame_tag == DATA_FRAMETAG) if (pxmitframe->frame_tag == DATA_FRAMETAG)
r8712_free_xmitframe(pxmitpriv, pxmitframe); r8712_free_xmitframe(pxmitpriv, pxmitframe);
...@@ -910,7 +910,7 @@ int r8712_xmit_classifier(struct _adapter *padapter, ...@@ -910,7 +910,7 @@ int r8712_xmit_classifier(struct _adapter *padapter,
psta = r8712_get_stainfo(pstapriv, pattrib->ra); psta = r8712_get_stainfo(pstapriv, pattrib->ra);
} }
} }
if (psta == NULL) if (!psta)
return -EINVAL; return -EINVAL;
ptxservq = get_sta_pending(padapter, &pstapending, ptxservq = get_sta_pending(padapter, &pstapending,
psta, pattrib->priority); psta, pattrib->priority);
...@@ -1022,7 +1022,7 @@ int r8712_pre_xmit(struct _adapter *padapter, struct xmit_frame *pxmitframe) ...@@ -1022,7 +1022,7 @@ int r8712_pre_xmit(struct _adapter *padapter, struct xmit_frame *pxmitframe)
return ret; return ret;
} }
pxmitbuf = r8712_alloc_xmitbuf(pxmitpriv); pxmitbuf = r8712_alloc_xmitbuf(pxmitpriv);
if (pxmitbuf == NULL) { /*enqueue packet*/ if (!pxmitbuf) { /*enqueue packet*/
ret = false; ret = false;
r8712_xmit_enqueue(padapter, pxmitframe); r8712_xmit_enqueue(padapter, pxmitframe);
spin_unlock_irqrestore(&pxmitpriv->lock, irqL); spin_unlock_irqrestore(&pxmitpriv->lock, irqL);
......
...@@ -577,7 +577,7 @@ static int r871xu_drv_init(struct usb_interface *pusb_intf, ...@@ -577,7 +577,7 @@ static int r871xu_drv_init(struct usb_interface *pusb_intf,
error: error:
usb_put_dev(udev); usb_put_dev(udev);
usb_set_intfdata(pusb_intf, NULL); usb_set_intfdata(pusb_intf, NULL);
if (padapter && padapter->dvobj_deinit != NULL) if (padapter && padapter->dvobj_deinit)
padapter->dvobj_deinit(padapter); padapter->dvobj_deinit(padapter);
if (pnetdev) if (pnetdev)
free_netdev(pnetdev); free_netdev(pnetdev);
......
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