Skip to contentSkip to conversation

staging: rtl8712: Comparison to NULL.

PATCH Superseded Bhagyashri Dighole 2 participants 3 messages Mar 12, 2019 Staging

v2 of 4 Superseded Latest is v4 →

lore
Share & tools
lore
#0 lore raw

PATCH v2 1/1 staging: rtl8712: Comparison to NULL.

Replace NULL comparison with '!' operator which is indicated by checkpatch.pl.

---
Changes in v2:
-- Drop some invalid changes.

 drivers/staging/rtl8712/rtl8712_recv.c        | 10 +++++-----
 drivers/staging/rtl8712/rtl871x_cmd.c         |  4 ++--
 drivers/staging/rtl8712/rtl871x_io.c          |  2 +-
 drivers/staging/rtl8712/rtl871x_ioctl_linux.c | 16 ++++++++--------
 drivers/staging/rtl8712/rtl871x_mlme.c        | 16 ++++++++--------
 drivers/staging/rtl8712/rtl871x_mp_ioctl.c    |  2 +-
 drivers/staging/rtl8712/rtl871x_recv.c        | 20 ++++++++++----------
 drivers/staging/rtl8712/rtl871x_recv.h        | 10 +++++-----
 drivers/staging/rtl8712/rtl871x_security.c    |  8 ++++----
 drivers/staging/rtl8712/rtl871x_sta_mgt.c     |  4 ++--
 drivers/staging/rtl8712/rtl871x_xmit.c        | 24 ++++++++++++------------
 drivers/staging/rtl8712/usb_intf.c            |  2 +-
 12 files changed, 59 insertions(+), 59 deletions(-)
drivers/staging/rtl8712/rtl8712_recv.c +5 -5
index 9e09431..9aa950e 100644
@@ -135,7 +135,7 @@ int r8712_free_recvframe(union recv_frame *precvframe,
 	spin_lock_irqsave(&pfree_recv_queue->lock, irqL);
 	list_del_init(&(precvframe->u.hdr.list));
 	list_add_tail(&(precvframe->u.hdr.list), &pfree_recv_queue->queue);
-	if (padapter != NULL) {
+	if (padapter) {
 		if (pfree_recv_queue == &precvpriv->free_recv_queue)
 			precvpriv->free_recvframe_cnt++;
 	}
@@ -273,7 +273,7 @@ union recv_frame *r8712_recvframe_chk_defrag(struct _adapter *padapter,
 		/* 0~(n-1) fragment frame
 		 * enqueue to defraf_g
 		 */
-		if (pdefrag_q != NULL) {
+		if (pdefrag_q) {
 			if (fragnum == 0) {
 				/*the first fragment*/
 				if (!list_empty(&pdefrag_q->queue)) {
@@ -299,7 +299,7 @@ union recv_frame *r8712_recvframe_chk_defrag(struct _adapter *padapter,
 		/* the last fragment frame
 		 * enqueue the last fragment
 		 */
-		if (pdefrag_q != NULL) {
+		if (pdefrag_q) {
 			phead = &pdefrag_q->queue;
 			list_add_tail(&pfhdr->list, phead);
 			/*call recvframe_defrag to defrag*/
@@ -313,7 +313,7 @@ union recv_frame *r8712_recvframe_chk_defrag(struct _adapter *padapter,
 			prtnframe = NULL;
 		}
 	}
-	if ((prtnframe != NULL) && (prtnframe->u.hdr.attrib.privacy)) {
+	if (prtnframe && prtnframe->u.hdr.attrib.privacy) {
 		/* after defrag we must check tkip mic code */
 		if (r8712_recvframe_chkmic(padapter, prtnframe) == _FAIL) {
 			r8712_free_recvframe(prtnframe, pfree_recv_queue);
@@ -889,7 +889,7 @@ static void process_link_qual(struct _adapter *padapter,
 	struct rx_pkt_attrib *pattrib;
 	struct smooth_rssi_data *sqd = &padapter->recvpriv.signal_qual_data;
 
-	if (prframe == NULL || padapter == NULL)
+	if (!prframe || !padapter)
 		return;
 	pattrib = &prframe->u.hdr.attrib;
 	if (pattrib->signal_qual != 0) {
drivers/staging/rtl8712/rtl871x_cmd.c +2 -2
index 05a78ac..eaae9c0 100644
@@ -194,7 +194,7 @@ void r8712_free_cmd_obj(struct cmd_obj *pcmd)
 	if ((pcmd->cmdcode != _JoinBss_CMD_) &&
 	    (pcmd->cmdcode != _CreateBss_CMD_))
 		kfree(pcmd->parmbuf);
-	if (pcmd->rsp != NULL) {
+	if (pcmd->rsp) {
 		if (pcmd->rspsz != 0)
 			kfree(pcmd->rsp);
 	}
@@ -229,7 +229,7 @@ u8 r8712_sitesurvey_cmd(struct _adapter *padapter,
 	psurveyPara->passive_mode = cpu_to_le32(pmlmepriv->passive_mode);
 	psurveyPara->ss_ssidlen = 0;
 	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);
 		psurveyPara->ss_ssidlen = cpu_to_le32(pssid->SsidLength);
 	}
drivers/staging/rtl8712/rtl871x_io.c +1 -1
index 17dafef..e34302a 100644
@@ -50,7 +50,7 @@ static uint _init_intf_hdl(struct _adapter *padapter,
 	init_intf_priv = &r8712_usb_init_intf_priv;
 	pintf_priv = pintf_hdl->pintfpriv = kmalloc(sizeof(struct intf_priv),
 						    GFP_ATOMIC);
-	if (pintf_priv == NULL)
+	if (!pintf_priv)
 		goto _init_intf_hdl_fail;
 	pintf_hdl->adapter = (u8 *)padapter;
 	set_intf_option(&pintf_hdl->intf_option);
drivers/staging/rtl8712/rtl871x_ioctl_linux.c +8 -8
index ad9b2f7..e55db92 100644
@@ -467,11 +467,11 @@ static int r871x_set_wpa_ie(struct _adapter *padapter, char *pie,
 	int group_cipher = 0, pairwise_cipher = 0;
 	int ret = 0;
 
-	if ((ielen > MAX_WPA_IE_LEN) || (pie == NULL))
+	if (ielen > MAX_WPA_IE_LEN || !pie)
 		return -EINVAL;
 	if (ielen) {
 		buf = kmemdup(pie, ielen, GFP_ATOMIC);
-		if (buf == NULL)
+		if (!buf)
 			return -ENOMEM;
 		if (ielen < RSN_HEADER_LEN) {
 			ret  = -EINVAL;
@@ -763,7 +763,7 @@ static int r871x_wx_set_pmkid(struct net_device *dev,
  *	If cmd is IW_PMKSA_REMOVE, it means the wpa_supplicant wants to
  *	remove a PMKID/BSSID from driver.
  */
-	if (pPMK == NULL)
+	if (!pPMK)
 		return -EINVAL;
 	memcpy(strIssueBssid, pPMK->bssid.sa_data, ETH_ALEN);
 	switch (pPMK->cmd) {
@@ -1085,7 +1085,7 @@ static int r871x_wx_set_mlme(struct net_device *dev,
 	struct _adapter *padapter = netdev_priv(dev);
 	struct iw_mlme *mlme = (struct iw_mlme *) extra;
 
-	if (mlme == NULL)
+	if (!mlme)
 		return -1;
 	switch (mlme->cmd) {
 	case IW_MLME_DEAUTH:
@@ -1938,7 +1938,7 @@ static int r871x_get_ap_info(struct net_device *dev,
 	u8 bssid[ETH_ALEN];
 	char data[33];
 
-	if (padapter->driver_stopped || (pdata == NULL))
+	if (padapter->driver_stopped || !pdata)
 		return -EINVAL;
 	while (check_fwstate(pmlmepriv, _FW_UNDER_SURVEY |
 			     _FW_UNDER_LINKING)) {
@@ -2002,7 +2002,7 @@ static int r871x_set_pid(struct net_device *dev,
 	struct _adapter *padapter = netdev_priv(dev);
 	struct iw_point *pdata = &wrqu->data;
 
-	if ((padapter->driver_stopped) || (pdata == NULL))
+	if (padapter->driver_stopped || !pdata)
 		return -EINVAL;
 	if (copy_from_user(&padapter->pid, pdata->pointer, sizeof(int)))
 		return -EINVAL;
@@ -2018,7 +2018,7 @@ static int r871x_set_chplan(struct net_device *dev,
 	struct iw_point *pdata = &wrqu->data;
 	int ch_plan = -1;
 
-	if ((padapter->driver_stopped) || (pdata == NULL)) {
+	if (padapter->driver_stopped || !pdata) {
 		ret = -EINVAL;
 		goto exit;
 	}
@@ -2038,7 +2038,7 @@ static int r871x_wps_start(struct net_device *dev,
 	struct iw_point *pdata = &wrqu->data;
 	u32   u32wps_start = 0;
 
-	if ((padapter->driver_stopped) || (pdata == NULL))
+	if (padapter->driver_stopped || !pdata)
 		return -EINVAL;
 	if (copy_from_user((void *)&u32wps_start, pdata->pointer, 4))
 		return -EFAULT;
drivers/staging/rtl8712/rtl871x_mlme.c +8 -8
index c666e03..d48f3d1 100644
@@ -95,7 +95,7 @@ static void _free_network(struct mlme_priv *pmlmepriv,
 	unsigned long irqL;
 	struct  __queue *free_queue = &(pmlmepriv->free_bss_pool);
 
-	if (pnetwork == NULL)
+	if (!pnetwork)
 		return;
 	if (pnetwork->fixed)
 		return;
@@ -115,7 +115,7 @@ static void free_network_nolock(struct mlme_priv *pmlmepriv,
 {
 	struct  __queue *free_queue = &pmlmepriv->free_bss_pool;
 
-	if (pnetwork == NULL)
+	if (!pnetwork)
 		return;
 	if (pnetwork->fixed)
 		return;
@@ -780,7 +780,7 @@ void r8712_joinbss_event_callback(struct _adapter *adapter, u8 *pbuf)
 					ptarget_wlan->fixed = true;
 			}
 
-			if (ptarget_wlan == NULL) {
+			if (!ptarget_wlan) {
 				if (check_fwstate(pmlmepriv,
 					_FW_UNDER_LINKING))
 					pmlmepriv->fw_state ^=
@@ -794,7 +794,7 @@ void r8712_joinbss_event_callback(struct _adapter *adapter, u8 *pbuf)
 					ptarget_sta =
 						 r8712_get_stainfo(pstapriv,
 						 pnetwork->network.MacAddress);
-					if (ptarget_sta == NULL)
+					if (!ptarget_sta)
 						ptarget_sta =
 						 r8712_alloc_stainfo(pstapriv,
 						 pnetwork->network.MacAddress);
@@ -905,7 +905,7 @@ void r8712_stassoc_event_callback(struct _adapter *adapter, u8 *pbuf)
 	if (!r8712_access_ctrl(&adapter->acl_list, pstassoc->macaddr))
 		return;
 	psta = r8712_get_stainfo(&adapter->stapriv, pstassoc->macaddr);
-	if (psta != NULL) {
+	if (psta) {
 		/*the sta have been in sta_info_queue => do nothing
 		 *(between drv has received this event before and
 		 * fw have not yet to set key to CAM_ENTRY)
@@ -914,7 +914,7 @@ void r8712_stassoc_event_callback(struct _adapter *adapter, u8 *pbuf)
 	}
 
 	psta = r8712_alloc_stainfo(&adapter->stapriv, pstassoc->macaddr);
-	if (psta == NULL)
+	if (!psta)
 		return;
 	/* to do : init sta_info variable */
 	psta->qos_option = 0;
@@ -1112,7 +1112,7 @@ int r8712_select_and_join_from_scan(struct mlme_priv *pmlmepriv)
 	while (1) {
 		if (end_of_queue_search(phead, pmlmepriv->pscanned)) {
 			if ((pmlmepriv->assoc_by_rssi) &&
-			    (pnetwork_max_rssi != NULL)) {
+			    (pnetwork_max_rssi)) {
 				pnetwork = pnetwork_max_rssi;
 				goto ask_for_joinbss;
 			}
@@ -1120,7 +1120,7 @@ int r8712_select_and_join_from_scan(struct mlme_priv *pmlmepriv)
 		}
 		pnetwork = container_of(pmlmepriv->pscanned,
 					struct wlan_network, list);
-		if (pnetwork == NULL)
+		if (!pnetwork)
 			return _FAIL;
 		pmlmepriv->pscanned = pmlmepriv->pscanned->next;
 		if (pmlmepriv->assoc_by_bssid) {
drivers/staging/rtl8712/rtl871x_mp_ioctl.c +1 -1
index 588346d..bbef96f9f 100644
@@ -186,7 +186,7 @@ static int mp_start_test(struct _adapter *padapter)
 	if (psta)
 		r8712_free_stainfo(padapter, psta);
 	psta = r8712_alloc_stainfo(&padapter->stapriv, bssid.MacAddress);
-	if (psta == NULL) {
+	if (!psta) {
 		res = _FAIL;
 		goto end_of_mp_start_test;
 	}
drivers/staging/rtl8712/rtl871x_recv.c +10 -10
index 28f7369..aa4e406 100644
@@ -63,7 +63,7 @@ sint _r8712_init_recv_priv(struct recv_priv *precvpriv,
 	precvpriv->pallocated_frame_buf = kzalloc(NR_RECVFRAME *
 				sizeof(union recv_frame) + RXFRAME_ALIGN_SZ,
 				GFP_ATOMIC);
-	if (precvpriv->pallocated_frame_buf == NULL)
+	if (!precvpriv->pallocated_frame_buf)
 		return _FAIL;
 	kmemleak_not_leak(precvpriv->pallocated_frame_buf);
 	precvpriv->precv_frame_buf = precvpriv->pallocated_frame_buf +
@@ -102,7 +102,7 @@ union recv_frame *r8712_alloc_recvframe(struct __queue *pfree_recv_queue)
 	if (precvframe) {
 		list_del_init(&precvframe->u.hdr.list);
 		padapter = precvframe->u.hdr.adapter;
-		if (padapter != NULL) {
+		if (padapter) {
 			precvpriv = &padapter->recvpriv;
 			if (pfree_recv_queue == &precvpriv->free_recv_queue)
 				precvpriv->free_recvframe_cnt--;
@@ -150,7 +150,7 @@ sint r8712_recvframe_chkmic(struct _adapter *adapter,
 	stainfo = r8712_get_stainfo(&adapter->stapriv, &prxattrib->ta[0]);
 	if (prxattrib->encrypt == _TKIP_) {
 		/* calculate mic code */
-		if (stainfo != NULL) {
+		if (stainfo) {
 			if (IS_MCAST(prxattrib->ra)) {
 				iv = precvframe->u.hdr.rx_data +
 				     prxattrib->hdrlen;
@@ -248,7 +248,7 @@ union recv_frame *r8712_portctrl(struct _adapter *adapter,
 		memcpy(&ether_type, ptr, 2);
 		be16_to_cpus(&ether_type);
 
-		if ((psta != NULL) && (psta->ieee8021x_blocked)) {
+		if (psta && psta->ieee8021x_blocked) {
 			/* blocked
 			 * only accept EAPOL frame
 			 */
@@ -355,7 +355,7 @@ static sint sta2sta_data_frame(struct _adapter *adapter,
 		*psta = r8712_get_bcmc_stainfo(adapter);
 	else
 		*psta = r8712_get_stainfo(pstapriv, sta_addr); /* get ap_info */
-	if (*psta == NULL) {
+	if (!*psta) {
 		if (check_fwstate(pmlmepriv, WIFI_MP_STATE))
 			adapter->mppriv.rx_pktloss++;
 		return _FAIL;
@@ -405,7 +405,7 @@ static sint ap2sta_data_frame(struct _adapter *adapter,
 			*psta = r8712_get_bcmc_stainfo(adapter);
 		else
 			*psta = r8712_get_stainfo(pstapriv, pattrib->bssid);
-		if (*psta == NULL)
+		if (!*psta)
 			return _FAIL;
 	} else if (check_fwstate(pmlmepriv, WIFI_MP_STATE) &&
 		   check_fwstate(pmlmepriv, _FW_LINKED)) {
@@ -416,7 +416,7 @@ static sint ap2sta_data_frame(struct _adapter *adapter,
 		memcpy(pattrib->ta, pattrib->src, ETH_ALEN);
 		memcpy(pattrib->bssid,  mybssid, ETH_ALEN);
 		*psta = r8712_get_stainfo(pstapriv, pattrib->bssid);
-		if (*psta == NULL)
+		if (!*psta)
 			return _FAIL;
 	} else {
 		return _FAIL;
@@ -441,7 +441,7 @@ static sint sta2ap_data_frame(struct _adapter *adapter,
 		if (memcmp(pattrib->bssid, mybssid, ETH_ALEN))
 			return _FAIL;
 		*psta = r8712_get_stainfo(pstapriv, pattrib->src);
-		if (*psta == NULL)
+		if (!*psta)
 			return _FAIL;
 	}
 	return _SUCCESS;
@@ -475,7 +475,7 @@ static sint validate_recv_data_frame(struct _adapter *adapter,
 	pda = get_da(ptr);
 	psa = get_sa(ptr);
 	pbssid = get_hdr_bssid(ptr);
-	if (pbssid == NULL)
+	if (!pbssid)
 		return _FAIL;
 	memcpy(pattrib->dst, pda, ETH_ALEN);
 	memcpy(pattrib->src, psa, ETH_ALEN);
@@ -505,7 +505,7 @@ static sint validate_recv_data_frame(struct _adapter *adapter,
 	}
 	if (res == _FAIL)
 		return _FAIL;
-	if (psta == NULL)
+	if (!psta)
 		return _FAIL;
 	precv_frame->u.hdr.psta = psta;
 	pattrib->amsdu = 0;
drivers/staging/rtl8712/rtl871x_recv.h +5 -5
index f87b2ff..1a56cd4 100644
@@ -138,7 +138,7 @@ int recv_func(struct _adapter *padapter, void *pcontext);
 static inline u8 *get_rxmem(union recv_frame *precvframe)
 {
 	/* always return rx_head... */
-	if (precvframe == NULL)
+	if (!precvframe)
 		return NULL;
 	return precvframe->u.hdr.rx_head;
 }
@@ -146,7 +146,7 @@ static inline u8 *get_rxmem(union recv_frame *precvframe)
 static inline u8 *get_recvframe_data(union recv_frame *precvframe)
 {
 	/* always return rx_data */
-	if (precvframe == NULL)
+	if (!precvframe)
 		return NULL;
 	return precvframe->u.hdr.rx_data;
 }
@@ -156,7 +156,7 @@ static inline u8 *recvframe_pull(union recv_frame *precvframe, sint sz)
 	/* used for extract sz bytes from rx_data, update rx_data and return
 	 * the updated rx_data to the caller
 	 */
-	if (precvframe == NULL)
+	if (!precvframe)
 		return NULL;
 	precvframe->u.hdr.rx_data += sz;
 	if (precvframe->u.hdr.rx_data > precvframe->u.hdr.rx_tail) {
@@ -173,7 +173,7 @@ static inline u8 *recvframe_put(union recv_frame *precvframe, sint sz)
 	 * return the updated rx_tail to the caller
 	 * after putting, rx_tail must be still larger than rx_end.
 	 */
-	if (precvframe == NULL)
+	if (!precvframe)
 		return NULL;
 	precvframe->u.hdr.rx_tail += sz;
 	if (precvframe->u.hdr.rx_tail > precvframe->u.hdr.rx_end) {
@@ -191,7 +191,7 @@ static inline u8 *recvframe_pull_tail(union recv_frame *precvframe, sint sz)
 	 * updated rx_end to the caller
 	 * after pulling, rx_end must be still larger than rx_data.
 	 */
-	if (precvframe == NULL)
+	if (!precvframe)
 		return NULL;
 	precvframe->u.hdr.rx_tail -= sz;
 	if (precvframe->u.hdr.rx_tail < precvframe->u.hdr.rx_data) {
drivers/staging/rtl8712/rtl871x_security.c +4 -4
index f826450..148e24e 100644
@@ -160,7 +160,7 @@ void r8712_wep_encrypt(struct _adapter *padapter, u8 *pxmitframe)
 	struct	security_priv *psecuritypriv = &padapter->securitypriv;
 	struct	xmit_priv *pxmitpriv = &padapter->xmitpriv;
 
-	if (((struct xmit_frame *)pxmitframe)->buf_addr == NULL)
+	if (((struct xmit_frame *)pxmitframe)->buf_addr==NULL)
 		return;
 	pframe = ((struct xmit_frame *)pxmitframe)->buf_addr + TXDESC_OFFSET;
 	/*start to encrypt each fragment*/
@@ -584,7 +584,7 @@ u32 r8712_tkip_encrypt(struct _adapter *padapter, u8 *pxmitframe)
 		else
 			stainfo = r8712_get_stainfo(&padapter->stapriv,
 				  &pattrib->ra[0]);
-		if (stainfo != NULL) {
+		if (stainfo) {
 			prwskey = &stainfo->x_UncstKey.skey[0];
 			for (curfragnum = 0; curfragnum < pattrib->nr_frags;
 			     curfragnum++) {
@@ -658,7 +658,7 @@ u32 r8712_tkip_decrypt(struct _adapter *padapter, u8 *precvframe)
 	if (prxattrib->encrypt == _TKIP_) {
 		stainfo = r8712_get_stainfo(&padapter->stapriv,
 					    &prxattrib->ta[0]);
-		if (stainfo != NULL) {
+		if (stainfo) {
 			iv = pframe + prxattrib->hdrlen;
 			payload = pframe + prxattrib->iv_len +
 				  prxattrib->hdrlen;
@@ -1367,7 +1367,7 @@ u32 r8712_aes_decrypt(struct _adapter *padapter, u8 *precvframe)
 	if (prxattrib->encrypt == _AES_) {
 		stainfo = r8712_get_stainfo(&padapter->stapriv,
 					    &prxattrib->ta[0]);
-		if (stainfo != NULL) {
+		if (stainfo) {
 			if (IS_MCAST(prxattrib->ra)) {
 				iv = pframe + prxattrib->hdrlen;
 				idx = iv[3];
drivers/staging/rtl8712/rtl871x_sta_mgt.c +2 -2
index 7c30b9e..f1439a7 100644
@@ -150,7 +150,7 @@ void r8712_free_stainfo(struct _adapter *padapter, struct sta_info *psta)
 	struct	xmit_priv *pxmitpriv = &padapter->xmitpriv;
 	struct	sta_priv *pstapriv = &padapter->stapriv;
 
-	if (psta == NULL)
+	if (!psta)
 		return;
 	pfree_sta_queue = &pstapriv->free_sta_queue;
 	pstaxmitpriv = &psta->sta_xmitpriv;
@@ -223,7 +223,7 @@ struct sta_info *r8712_get_stainfo(struct sta_priv *pstapriv, u8 *hwaddr)
 	struct sta_info *psta = NULL;
 	u32	index;
 
-	if (hwaddr == NULL)
+	if (!hwaddr)
 		return NULL;
 	index = wifi_mac_hash(hwaddr);
 	spin_lock_irqsave(&pstapriv->sta_hash_lock, irqL);
drivers/staging/rtl8712/rtl871x_xmit.c +12 -12
index 7c88574..94c2a48 100644
@@ -156,7 +156,7 @@ void _free_xmit_priv(struct xmit_priv *pxmitpriv)
 					pxmitpriv->pxmit_frame_buf;
 	struct xmit_buf *pxmitbuf = (struct xmit_buf *)pxmitpriv->pxmitbuf;
 
-	if (pxmitpriv->pxmit_frame_buf == NULL)
+	if (!pxmitpriv->pxmit_frame_buf)
 		return;
 	for (i = 0; i < NR_XMITFRAME; i++) {
 		r8712_xmit_complete(padapter, pxmitframe);
@@ -269,7 +269,7 @@ sint r8712_update_attrib(struct _adapter *padapter, _pkt *pkt,
 			pattrib->mac_id = 5;
 		} else {
 			psta = r8712_get_stainfo(pstapriv, pattrib->ra);
-			if (psta == NULL)  /* drop the pkt */
+			if (!psta)  /* drop the pkt */
 				return _FAIL;
 			if (check_fwstate(pmlmepriv, WIFI_STATION_STATE))
 				pattrib->mac_id = 5;
@@ -362,7 +362,7 @@ static sint xmitframe_addmic(struct _adapter *padapter,
 					    &pattrib->ra[0]);
 	if (pattrib->encrypt == _TKIP_) {
 		/*encode mic code*/
-		if (stainfo != NULL) {
+		if (stainfo) {
 			u8 null_key[16] = {0x0, 0x0, 0x0, 0x0, 0x0, 0x0, 0x0,
 					   0x0, 0x0, 0x0, 0x0, 0x0, 0x0, 0x0,
 					   0x0, 0x0};
@@ -596,10 +596,10 @@ sint r8712_xmitframe_coalesce(struct _adapter *padapter, _pkt *pkt,
 	u8 *pbuf_start;
 	sint bmcst = IS_MCAST(pattrib->ra);
 
-	if (pattrib->psta == NULL)
+	if (!pattrib->psta)
 		return _FAIL;
 	psta = pattrib->psta;
-	if (pxmitframe->buf_addr == NULL)
+	if (!pxmitframe->buf_addr)
 		return _FAIL;
 	pbuf_start = pxmitframe->buf_addr;
 	ptxdesc = pbuf_start;
@@ -627,7 +627,7 @@ sint r8712_xmitframe_coalesce(struct _adapter *padapter, _pkt *pkt,
 		mpdu_len -= pattrib->hdrlen;
 		/* adding icv, if necessary...*/
 		if (pattrib->iv_len) {
-			if (psta != NULL) {
+			if (psta) {
 				switch (pattrib->encrypt) {
 				case _WEP40_:
 				case _WEP104_:
@@ -718,7 +718,7 @@ void r8712_update_protection(struct _adapter *padapter, u8 *ie, uint ie_len)
 	case AUTO_VCS:
 	default:
 		perp = r8712_get_ie(ie, _ERPINFO_IE_, &erp_len, ie_len);
-		if (perp == NULL) {
+		if (!perp) {
 			pxmitpriv->vcs = NONE_VCS;
 		} else {
 			protection = (*(perp + 2)) & BIT(1);
@@ -757,7 +757,7 @@ int r8712_free_xmitbuf(struct xmit_priv *pxmitpriv, struct xmit_buf *pxmitbuf)
 	unsigned long irqL;
 	struct  __queue *pfree_xmitbuf_queue = &pxmitpriv->free_xmitbuf_queue;
 
-	if (pxmitbuf == NULL)
+	if (!pxmitbuf)
 		return _FAIL;
 	spin_lock_irqsave(&pfree_xmitbuf_queue->lock, irqL);
 	list_del_init(&pxmitbuf->list);
@@ -811,7 +811,7 @@ void r8712_free_xmitframe(struct xmit_priv *pxmitpriv,
 	struct  __queue *pfree_xmit_queue = &pxmitpriv->free_xmit_queue;
 	struct _adapter *padapter = pxmitpriv->adapter;
 
-	if (pxmitframe == NULL)
+	if (!pxmitframe)
 		return;
 	spin_lock_irqsave(&pfree_xmit_queue->lock, irqL);
 	list_del_init(&pxmitframe->list);
@@ -827,7 +827,7 @@ void r8712_free_xmitframe(struct xmit_priv *pxmitpriv,
 void r8712_free_xmitframe_ex(struct xmit_priv *pxmitpriv,
 		      struct xmit_frame *pxmitframe)
 {
-	if (pxmitframe == NULL)
+	if (!pxmitframe)
 		return;
 	if (pxmitframe->frame_tag == DATA_FRAMETAG)
 		r8712_free_xmitframe(pxmitpriv, pxmitframe);
@@ -918,7 +918,7 @@ sint r8712_xmit_classifier(struct _adapter *padapter,
 				psta = r8712_get_stainfo(pstapriv, pattrib->ra);
 		}
 	}
-	if (psta == NULL)
+	if (!psta)
 		return _FAIL;
 	ptxservq = get_sta_pending(padapter, &pstapending,
 		   psta, pattrib->priority);
@@ -1030,7 +1030,7 @@ int r8712_pre_xmit(struct _adapter *padapter, struct xmit_frame *pxmitframe)
 		return ret;
 	}
 	pxmitbuf = r8712_alloc_xmitbuf(pxmitpriv);
-	if (pxmitbuf == NULL) { /*enqueue packet*/
+	if (!pxmitbuf) { /*enqueue packet*/
 		ret = false;
 		r8712_xmit_enqueue(padapter, pxmitframe);
 		spin_unlock_irqrestore(&pxmitpriv->lock, irqL);
drivers/staging/rtl8712/usb_intf.c +1 -1
index 7478bbd..91382c2 100644
@@ -577,7 +577,7 @@ static int r871xu_drv_init(struct usb_interface *pusb_intf,
 error:
 	usb_put_dev(udev);
 	usb_set_intfdata(pusb_intf, NULL);
-	if (padapter && padapter->dvobj_deinit != NULL)
+	if (padapter && padapter->dvobj_deinit)
 		padapter->dvobj_deinit(padapter);
 	if (pnetdev)
 		free_netdev(pnetdev);
Signature · 1 line
2.7.4
#1 lore raw
Quoted 7 lines · Bhagyashri Dighole

Replace NULL comparison with '!' operator which is indicated by checkpatch.pl.

---
Changes in v2:
-- Drop some invalid changes.

Sorry, but I don't think Greg will be happy with three v2's. It would be better to send a v3 that is correct in every way.

julia

Quoted 595 lines
 drivers/staging/rtl8712/rtl8712_recv.c        | 10 +++++-----
 drivers/staging/rtl8712/rtl871x_cmd.c         |  4 ++--
 drivers/staging/rtl8712/rtl871x_io.c          |  2 +-
 drivers/staging/rtl8712/rtl871x_ioctl_linux.c | 16 ++++++++--------
 drivers/staging/rtl8712/rtl871x_mlme.c        | 16 ++++++++--------
 drivers/staging/rtl8712/rtl871x_mp_ioctl.c    |  2 +-
 drivers/staging/rtl8712/rtl871x_recv.c        | 20 ++++++++++----------
 drivers/staging/rtl8712/rtl871x_recv.h        | 10 +++++-----
 drivers/staging/rtl8712/rtl871x_security.c    |  8 ++++----
 drivers/staging/rtl8712/rtl871x_sta_mgt.c     |  4 ++--
 drivers/staging/rtl8712/rtl871x_xmit.c        | 24 ++++++++++++------------
 drivers/staging/rtl8712/usb_intf.c            |  2 +-
 12 files changed, 59 insertions(+), 59 deletions(-)
drivers/staging/rtl8712/rtl8712_recv.c +5 -5
index 9e09431..9aa950e 100644
@@ -135,7 +135,7 @@ int r8712_free_recvframe(union recv_frame *precvframe,
 	spin_lock_irqsave(&pfree_recv_queue->lock, irqL);
 	list_del_init(&(precvframe->u.hdr.list));
 	list_add_tail(&(precvframe->u.hdr.list), &pfree_recv_queue->queue);
-	if (padapter != NULL) {
+	if (padapter) {
 		if (pfree_recv_queue == &precvpriv->free_recv_queue)
 			precvpriv->free_recvframe_cnt++;
 	}
@@ -273,7 +273,7 @@ union recv_frame *r8712_recvframe_chk_defrag(struct _adapter *padapter,
 		/* 0~(n-1) fragment frame
 		 * enqueue to defraf_g
 		 */
-		if (pdefrag_q != NULL) {
+		if (pdefrag_q) {
 			if (fragnum == 0) {
 				/*the first fragment*/
 				if (!list_empty(&pdefrag_q->queue)) {
@@ -299,7 +299,7 @@ union recv_frame *r8712_recvframe_chk_defrag(struct _adapter *padapter,
 		/* the last fragment frame
 		 * enqueue the last fragment
 		 */
-		if (pdefrag_q != NULL) {
+		if (pdefrag_q) {
 			phead = &pdefrag_q->queue;
 			list_add_tail(&pfhdr->list, phead);
 			/*call recvframe_defrag to defrag*/
@@ -313,7 +313,7 @@ union recv_frame *r8712_recvframe_chk_defrag(struct _adapter *padapter,
 			prtnframe = NULL;
 		}
 	}
-	if ((prtnframe != NULL) && (prtnframe->u.hdr.attrib.privacy)) {
+	if (prtnframe && prtnframe->u.hdr.attrib.privacy) {
 		/* after defrag we must check tkip mic code */
 		if (r8712_recvframe_chkmic(padapter, prtnframe) == _FAIL) {
 			r8712_free_recvframe(prtnframe, pfree_recv_queue);
@@ -889,7 +889,7 @@ static void process_link_qual(struct _adapter *padapter,
 	struct rx_pkt_attrib *pattrib;
 	struct smooth_rssi_data *sqd = &padapter->recvpriv.signal_qual_data;
 
-	if (prframe == NULL || padapter == NULL)
+	if (!prframe || !padapter)
 		return;
 	pattrib = &prframe->u.hdr.attrib;
 	if (pattrib->signal_qual != 0) {
drivers/staging/rtl8712/rtl871x_cmd.c +2 -2
index 05a78ac..eaae9c0 100644
@@ -194,7 +194,7 @@ void r8712_free_cmd_obj(struct cmd_obj *pcmd)
 	if ((pcmd->cmdcode != _JoinBss_CMD_) &&
 	    (pcmd->cmdcode != _CreateBss_CMD_))
 		kfree(pcmd->parmbuf);
-	if (pcmd->rsp != NULL) {
+	if (pcmd->rsp) {
 		if (pcmd->rspsz != 0)
 			kfree(pcmd->rsp);
 	}
@@ -229,7 +229,7 @@ u8 r8712_sitesurvey_cmd(struct _adapter *padapter,
 	psurveyPara->passive_mode = cpu_to_le32(pmlmepriv->passive_mode);
 	psurveyPara->ss_ssidlen = 0;
 	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);
 		psurveyPara->ss_ssidlen = cpu_to_le32(pssid->SsidLength);
 	}
drivers/staging/rtl8712/rtl871x_io.c +1 -1
index 17dafef..e34302a 100644
@@ -50,7 +50,7 @@ static uint _init_intf_hdl(struct _adapter *padapter,
 	init_intf_priv = &r8712_usb_init_intf_priv;
 	pintf_priv = pintf_hdl->pintfpriv = kmalloc(sizeof(struct intf_priv),
 						    GFP_ATOMIC);
-	if (pintf_priv == NULL)
+	if (!pintf_priv)
 		goto _init_intf_hdl_fail;
 	pintf_hdl->adapter = (u8 *)padapter;
 	set_intf_option(&pintf_hdl->intf_option);
drivers/staging/rtl8712/rtl871x_ioctl_linux.c +8 -8
index ad9b2f7..e55db92 100644
@@ -467,11 +467,11 @@ static int r871x_set_wpa_ie(struct _adapter *padapter, char *pie,
 	int group_cipher = 0, pairwise_cipher = 0;
 	int ret = 0;
 
-	if ((ielen > MAX_WPA_IE_LEN) || (pie == NULL))
+	if (ielen > MAX_WPA_IE_LEN || !pie)
 		return -EINVAL;
 	if (ielen) {
 		buf = kmemdup(pie, ielen, GFP_ATOMIC);
-		if (buf == NULL)
+		if (!buf)
 			return -ENOMEM;
 		if (ielen < RSN_HEADER_LEN) {
 			ret  = -EINVAL;
@@ -763,7 +763,7 @@ static int r871x_wx_set_pmkid(struct net_device *dev,
  *	If cmd is IW_PMKSA_REMOVE, it means the wpa_supplicant wants to
  *	remove a PMKID/BSSID from driver.
  */
-	if (pPMK == NULL)
+	if (!pPMK)
 		return -EINVAL;
 	memcpy(strIssueBssid, pPMK->bssid.sa_data, ETH_ALEN);
 	switch (pPMK->cmd) {
@@ -1085,7 +1085,7 @@ static int r871x_wx_set_mlme(struct net_device *dev,
 	struct _adapter *padapter = netdev_priv(dev);
 	struct iw_mlme *mlme = (struct iw_mlme *) extra;
 
-	if (mlme == NULL)
+	if (!mlme)
 		return -1;
 	switch (mlme->cmd) {
 	case IW_MLME_DEAUTH:
@@ -1938,7 +1938,7 @@ static int r871x_get_ap_info(struct net_device *dev,
 	u8 bssid[ETH_ALEN];
 	char data[33];
 
-	if (padapter->driver_stopped || (pdata == NULL))
+	if (padapter->driver_stopped || !pdata)
 		return -EINVAL;
 	while (check_fwstate(pmlmepriv, _FW_UNDER_SURVEY |
 			     _FW_UNDER_LINKING)) {
@@ -2002,7 +2002,7 @@ static int r871x_set_pid(struct net_device *dev,
 	struct _adapter *padapter = netdev_priv(dev);
 	struct iw_point *pdata = &wrqu->data;
 
-	if ((padapter->driver_stopped) || (pdata == NULL))
+	if (padapter->driver_stopped || !pdata)
 		return -EINVAL;
 	if (copy_from_user(&padapter->pid, pdata->pointer, sizeof(int)))
 		return -EINVAL;
@@ -2018,7 +2018,7 @@ static int r871x_set_chplan(struct net_device *dev,
 	struct iw_point *pdata = &wrqu->data;
 	int ch_plan = -1;
 
-	if ((padapter->driver_stopped) || (pdata == NULL)) {
+	if (padapter->driver_stopped || !pdata) {
 		ret = -EINVAL;
 		goto exit;
 	}
@@ -2038,7 +2038,7 @@ static int r871x_wps_start(struct net_device *dev,
 	struct iw_point *pdata = &wrqu->data;
 	u32   u32wps_start = 0;
 
-	if ((padapter->driver_stopped) || (pdata == NULL))
+	if (padapter->driver_stopped || !pdata)
 		return -EINVAL;
 	if (copy_from_user((void *)&u32wps_start, pdata->pointer, 4))
 		return -EFAULT;
drivers/staging/rtl8712/rtl871x_mlme.c +8 -8
index c666e03..d48f3d1 100644
@@ -95,7 +95,7 @@ static void _free_network(struct mlme_priv *pmlmepriv,
 	unsigned long irqL;
 	struct  __queue *free_queue = &(pmlmepriv->free_bss_pool);
 
-	if (pnetwork == NULL)
+	if (!pnetwork)
 		return;
 	if (pnetwork->fixed)
 		return;
@@ -115,7 +115,7 @@ static void free_network_nolock(struct mlme_priv *pmlmepriv,
 {
 	struct  __queue *free_queue = &pmlmepriv->free_bss_pool;
 
-	if (pnetwork == NULL)
+	if (!pnetwork)
 		return;
 	if (pnetwork->fixed)
 		return;
@@ -780,7 +780,7 @@ void r8712_joinbss_event_callback(struct _adapter *adapter, u8 *pbuf)
 					ptarget_wlan->fixed = true;
 			}
 
-			if (ptarget_wlan == NULL) {
+			if (!ptarget_wlan) {
 				if (check_fwstate(pmlmepriv,
 					_FW_UNDER_LINKING))
 					pmlmepriv->fw_state ^=
@@ -794,7 +794,7 @@ void r8712_joinbss_event_callback(struct _adapter *adapter, u8 *pbuf)
 					ptarget_sta =
 						 r8712_get_stainfo(pstapriv,
 						 pnetwork->network.MacAddress);
-					if (ptarget_sta == NULL)
+					if (!ptarget_sta)
 						ptarget_sta =
 						 r8712_alloc_stainfo(pstapriv,
 						 pnetwork->network.MacAddress);
@@ -905,7 +905,7 @@ void r8712_stassoc_event_callback(struct _adapter *adapter, u8 *pbuf)
 	if (!r8712_access_ctrl(&adapter->acl_list, pstassoc->macaddr))
 		return;
 	psta = r8712_get_stainfo(&adapter->stapriv, pstassoc->macaddr);
-	if (psta != NULL) {
+	if (psta) {
 		/*the sta have been in sta_info_queue => do nothing
 		 *(between drv has received this event before and
 		 * fw have not yet to set key to CAM_ENTRY)
@@ -914,7 +914,7 @@ void r8712_stassoc_event_callback(struct _adapter *adapter, u8 *pbuf)
 	}
 
 	psta = r8712_alloc_stainfo(&adapter->stapriv, pstassoc->macaddr);
-	if (psta == NULL)
+	if (!psta)
 		return;
 	/* to do : init sta_info variable */
 	psta->qos_option = 0;
@@ -1112,7 +1112,7 @@ int r8712_select_and_join_from_scan(struct mlme_priv *pmlmepriv)
 	while (1) {
 		if (end_of_queue_search(phead, pmlmepriv->pscanned)) {
 			if ((pmlmepriv->assoc_by_rssi) &&
-			    (pnetwork_max_rssi != NULL)) {
+			    (pnetwork_max_rssi)) {
 				pnetwork = pnetwork_max_rssi;
 				goto ask_for_joinbss;
 			}
@@ -1120,7 +1120,7 @@ int r8712_select_and_join_from_scan(struct mlme_priv *pmlmepriv)
 		}
 		pnetwork = container_of(pmlmepriv->pscanned,
 					struct wlan_network, list);
-		if (pnetwork == NULL)
+		if (!pnetwork)
 			return _FAIL;
 		pmlmepriv->pscanned = pmlmepriv->pscanned->next;
 		if (pmlmepriv->assoc_by_bssid) {
drivers/staging/rtl8712/rtl871x_mp_ioctl.c +1 -1
index 588346d..bbef96f9f 100644
@@ -186,7 +186,7 @@ static int mp_start_test(struct _adapter *padapter)
 	if (psta)
 		r8712_free_stainfo(padapter, psta);
 	psta = r8712_alloc_stainfo(&padapter->stapriv, bssid.MacAddress);
-	if (psta == NULL) {
+	if (!psta) {
 		res = _FAIL;
 		goto end_of_mp_start_test;
 	}
drivers/staging/rtl8712/rtl871x_recv.c +10 -10
index 28f7369..aa4e406 100644
@@ -63,7 +63,7 @@ sint _r8712_init_recv_priv(struct recv_priv *precvpriv,
 	precvpriv->pallocated_frame_buf = kzalloc(NR_RECVFRAME *
 				sizeof(union recv_frame) + RXFRAME_ALIGN_SZ,
 				GFP_ATOMIC);
-	if (precvpriv->pallocated_frame_buf == NULL)
+	if (!precvpriv->pallocated_frame_buf)
 		return _FAIL;
 	kmemleak_not_leak(precvpriv->pallocated_frame_buf);
 	precvpriv->precv_frame_buf = precvpriv->pallocated_frame_buf +
@@ -102,7 +102,7 @@ union recv_frame *r8712_alloc_recvframe(struct __queue *pfree_recv_queue)
 	if (precvframe) {
 		list_del_init(&precvframe->u.hdr.list);
 		padapter = precvframe->u.hdr.adapter;
-		if (padapter != NULL) {
+		if (padapter) {
 			precvpriv = &padapter->recvpriv;
 			if (pfree_recv_queue == &precvpriv->free_recv_queue)
 				precvpriv->free_recvframe_cnt--;
@@ -150,7 +150,7 @@ sint r8712_recvframe_chkmic(struct _adapter *adapter,
 	stainfo = r8712_get_stainfo(&adapter->stapriv, &prxattrib->ta[0]);
 	if (prxattrib->encrypt == _TKIP_) {
 		/* calculate mic code */
-		if (stainfo != NULL) {
+		if (stainfo) {
 			if (IS_MCAST(prxattrib->ra)) {
 				iv = precvframe->u.hdr.rx_data +
 				     prxattrib->hdrlen;
@@ -248,7 +248,7 @@ union recv_frame *r8712_portctrl(struct _adapter *adapter,
 		memcpy(&ether_type, ptr, 2);
 		be16_to_cpus(&ether_type);
 
-		if ((psta != NULL) && (psta->ieee8021x_blocked)) {
+		if (psta && psta->ieee8021x_blocked) {
 			/* blocked
 			 * only accept EAPOL frame
 			 */
@@ -355,7 +355,7 @@ static sint sta2sta_data_frame(struct _adapter *adapter,
 		*psta = r8712_get_bcmc_stainfo(adapter);
 	else
 		*psta = r8712_get_stainfo(pstapriv, sta_addr); /* get ap_info */
-	if (*psta == NULL) {
+	if (!*psta) {
 		if (check_fwstate(pmlmepriv, WIFI_MP_STATE))
 			adapter->mppriv.rx_pktloss++;
 		return _FAIL;
@@ -405,7 +405,7 @@ static sint ap2sta_data_frame(struct _adapter *adapter,
 			*psta = r8712_get_bcmc_stainfo(adapter);
 		else
 			*psta = r8712_get_stainfo(pstapriv, pattrib->bssid);
-		if (*psta == NULL)
+		if (!*psta)
 			return _FAIL;
 	} else if (check_fwstate(pmlmepriv, WIFI_MP_STATE) &&
 		   check_fwstate(pmlmepriv, _FW_LINKED)) {
@@ -416,7 +416,7 @@ static sint ap2sta_data_frame(struct _adapter *adapter,
 		memcpy(pattrib->ta, pattrib->src, ETH_ALEN);
 		memcpy(pattrib->bssid,  mybssid, ETH_ALEN);
 		*psta = r8712_get_stainfo(pstapriv, pattrib->bssid);
-		if (*psta == NULL)
+		if (!*psta)
 			return _FAIL;
 	} else {
 		return _FAIL;
@@ -441,7 +441,7 @@ static sint sta2ap_data_frame(struct _adapter *adapter,
 		if (memcmp(pattrib->bssid, mybssid, ETH_ALEN))
 			return _FAIL;
 		*psta = r8712_get_stainfo(pstapriv, pattrib->src);
-		if (*psta == NULL)
+		if (!*psta)
 			return _FAIL;
 	}
 	return _SUCCESS;
@@ -475,7 +475,7 @@ static sint validate_recv_data_frame(struct _adapter *adapter,
 	pda = get_da(ptr);
 	psa = get_sa(ptr);
 	pbssid = get_hdr_bssid(ptr);
-	if (pbssid == NULL)
+	if (!pbssid)
 		return _FAIL;
 	memcpy(pattrib->dst, pda, ETH_ALEN);
 	memcpy(pattrib->src, psa, ETH_ALEN);
@@ -505,7 +505,7 @@ static sint validate_recv_data_frame(struct _adapter *adapter,
 	}
 	if (res == _FAIL)
 		return _FAIL;
-	if (psta == NULL)
+	if (!psta)
 		return _FAIL;
 	precv_frame->u.hdr.psta = psta;
 	pattrib->amsdu = 0;
drivers/staging/rtl8712/rtl871x_recv.h +5 -5
index f87b2ff..1a56cd4 100644
@@ -138,7 +138,7 @@ int recv_func(struct _adapter *padapter, void *pcontext);
 static inline u8 *get_rxmem(union recv_frame *precvframe)
 {
 	/* always return rx_head... */
-	if (precvframe == NULL)
+	if (!precvframe)
 		return NULL;
 	return precvframe->u.hdr.rx_head;
 }
@@ -146,7 +146,7 @@ static inline u8 *get_rxmem(union recv_frame *precvframe)
 static inline u8 *get_recvframe_data(union recv_frame *precvframe)
 {
 	/* always return rx_data */
-	if (precvframe == NULL)
+	if (!precvframe)
 		return NULL;
 	return precvframe->u.hdr.rx_data;
 }
@@ -156,7 +156,7 @@ static inline u8 *recvframe_pull(union recv_frame *precvframe, sint sz)
 	/* used for extract sz bytes from rx_data, update rx_data and return
 	 * the updated rx_data to the caller
 	 */
-	if (precvframe == NULL)
+	if (!precvframe)
 		return NULL;
 	precvframe->u.hdr.rx_data += sz;
 	if (precvframe->u.hdr.rx_data > precvframe->u.hdr.rx_tail) {
@@ -173,7 +173,7 @@ static inline u8 *recvframe_put(union recv_frame *precvframe, sint sz)
 	 * return the updated rx_tail to the caller
 	 * after putting, rx_tail must be still larger than rx_end.
 	 */
-	if (precvframe == NULL)
+	if (!precvframe)
 		return NULL;
 	precvframe->u.hdr.rx_tail += sz;
 	if (precvframe->u.hdr.rx_tail > precvframe->u.hdr.rx_end) {
@@ -191,7 +191,7 @@ static inline u8 *recvframe_pull_tail(union recv_frame *precvframe, sint sz)
 	 * updated rx_end to the caller
 	 * after pulling, rx_end must be still larger than rx_data.
 	 */
-	if (precvframe == NULL)
+	if (!precvframe)
 		return NULL;
 	precvframe->u.hdr.rx_tail -= sz;
 	if (precvframe->u.hdr.rx_tail < precvframe->u.hdr.rx_data) {
drivers/staging/rtl8712/rtl871x_security.c +4 -4
index f826450..148e24e 100644
@@ -160,7 +160,7 @@ void r8712_wep_encrypt(struct _adapter *padapter, u8 *pxmitframe)
 	struct	security_priv *psecuritypriv = &padapter->securitypriv;
 	struct	xmit_priv *pxmitpriv = &padapter->xmitpriv;
 
-	if (((struct xmit_frame *)pxmitframe)->buf_addr == NULL)
+	if (((struct xmit_frame *)pxmitframe)->buf_addr==NULL)
 		return;
 	pframe = ((struct xmit_frame *)pxmitframe)->buf_addr + TXDESC_OFFSET;
 	/*start to encrypt each fragment*/
@@ -584,7 +584,7 @@ u32 r8712_tkip_encrypt(struct _adapter *padapter, u8 *pxmitframe)
 		else
 			stainfo = r8712_get_stainfo(&padapter->stapriv,
 				  &pattrib->ra[0]);
-		if (stainfo != NULL) {
+		if (stainfo) {
 			prwskey = &stainfo->x_UncstKey.skey[0];
 			for (curfragnum = 0; curfragnum < pattrib->nr_frags;
 			     curfragnum++) {
@@ -658,7 +658,7 @@ u32 r8712_tkip_decrypt(struct _adapter *padapter, u8 *precvframe)
 	if (prxattrib->encrypt == _TKIP_) {
 		stainfo = r8712_get_stainfo(&padapter->stapriv,
 					    &prxattrib->ta[0]);
-		if (stainfo != NULL) {
+		if (stainfo) {
 			iv = pframe + prxattrib->hdrlen;
 			payload = pframe + prxattrib->iv_len +
 				  prxattrib->hdrlen;
@@ -1367,7 +1367,7 @@ u32 r8712_aes_decrypt(struct _adapter *padapter, u8 *precvframe)
 	if (prxattrib->encrypt == _AES_) {
 		stainfo = r8712_get_stainfo(&padapter->stapriv,
 					    &prxattrib->ta[0]);
-		if (stainfo != NULL) {
+		if (stainfo) {
 			if (IS_MCAST(prxattrib->ra)) {
 				iv = pframe + prxattrib->hdrlen;
 				idx = iv[3];
drivers/staging/rtl8712/rtl871x_sta_mgt.c +2 -2
index 7c30b9e..f1439a7 100644
@@ -150,7 +150,7 @@ void r8712_free_stainfo(struct _adapter *padapter, struct sta_info *psta)
 	struct	xmit_priv *pxmitpriv = &padapter->xmitpriv;
 	struct	sta_priv *pstapriv = &padapter->stapriv;
 
-	if (psta == NULL)
+	if (!psta)
 		return;
 	pfree_sta_queue = &pstapriv->free_sta_queue;
 	pstaxmitpriv = &psta->sta_xmitpriv;
@@ -223,7 +223,7 @@ struct sta_info *r8712_get_stainfo(struct sta_priv *pstapriv, u8 *hwaddr)
 	struct sta_info *psta = NULL;
 	u32	index;
 
-	if (hwaddr == NULL)
+	if (!hwaddr)
 		return NULL;
 	index = wifi_mac_hash(hwaddr);
 	spin_lock_irqsave(&pstapriv->sta_hash_lock, irqL);
drivers/staging/rtl8712/rtl871x_xmit.c +12 -12
index 7c88574..94c2a48 100644
@@ -156,7 +156,7 @@ void _free_xmit_priv(struct xmit_priv *pxmitpriv)
 					pxmitpriv->pxmit_frame_buf;
 	struct xmit_buf *pxmitbuf = (struct xmit_buf *)pxmitpriv->pxmitbuf;
 
-	if (pxmitpriv->pxmit_frame_buf == NULL)
+	if (!pxmitpriv->pxmit_frame_buf)
 		return;
 	for (i = 0; i < NR_XMITFRAME; i++) {
 		r8712_xmit_complete(padapter, pxmitframe);
@@ -269,7 +269,7 @@ sint r8712_update_attrib(struct _adapter *padapter, _pkt *pkt,
 			pattrib->mac_id = 5;
 		} else {
 			psta = r8712_get_stainfo(pstapriv, pattrib->ra);
-			if (psta == NULL)  /* drop the pkt */
+			if (!psta)  /* drop the pkt */
 				return _FAIL;
 			if (check_fwstate(pmlmepriv, WIFI_STATION_STATE))
 				pattrib->mac_id = 5;
@@ -362,7 +362,7 @@ static sint xmitframe_addmic(struct _adapter *padapter,
 					    &pattrib->ra[0]);
 	if (pattrib->encrypt == _TKIP_) {
 		/*encode mic code*/
-		if (stainfo != NULL) {
+		if (stainfo) {
 			u8 null_key[16] = {0x0, 0x0, 0x0, 0x0, 0x0, 0x0, 0x0,
 					   0x0, 0x0, 0x0, 0x0, 0x0, 0x0, 0x0,
 					   0x0, 0x0};
@@ -596,10 +596,10 @@ sint r8712_xmitframe_coalesce(struct _adapter *padapter, _pkt *pkt,
 	u8 *pbuf_start;
 	sint bmcst = IS_MCAST(pattrib->ra);
 
-	if (pattrib->psta == NULL)
+	if (!pattrib->psta)
 		return _FAIL;
 	psta = pattrib->psta;
-	if (pxmitframe->buf_addr == NULL)
+	if (!pxmitframe->buf_addr)
 		return _FAIL;
 	pbuf_start = pxmitframe->buf_addr;
 	ptxdesc = pbuf_start;
@@ -627,7 +627,7 @@ sint r8712_xmitframe_coalesce(struct _adapter *padapter, _pkt *pkt,
 		mpdu_len -= pattrib->hdrlen;
 		/* adding icv, if necessary...*/
 		if (pattrib->iv_len) {
-			if (psta != NULL) {
+			if (psta) {
 				switch (pattrib->encrypt) {
 				case _WEP40_:
 				case _WEP104_:
@@ -718,7 +718,7 @@ void r8712_update_protection(struct _adapter *padapter, u8 *ie, uint ie_len)
 	case AUTO_VCS:
 	default:
 		perp = r8712_get_ie(ie, _ERPINFO_IE_, &erp_len, ie_len);
-		if (perp == NULL) {
+		if (!perp) {
 			pxmitpriv->vcs = NONE_VCS;
 		} else {
 			protection = (*(perp + 2)) & BIT(1);
@@ -757,7 +757,7 @@ int r8712_free_xmitbuf(struct xmit_priv *pxmitpriv, struct xmit_buf *pxmitbuf)
 	unsigned long irqL;
 	struct  __queue *pfree_xmitbuf_queue = &pxmitpriv->free_xmitbuf_queue;
 
-	if (pxmitbuf == NULL)
+	if (!pxmitbuf)
 		return _FAIL;
 	spin_lock_irqsave(&pfree_xmitbuf_queue->lock, irqL);
 	list_del_init(&pxmitbuf->list);
@@ -811,7 +811,7 @@ void r8712_free_xmitframe(struct xmit_priv *pxmitpriv,
 	struct  __queue *pfree_xmit_queue = &pxmitpriv->free_xmit_queue;
 	struct _adapter *padapter = pxmitpriv->adapter;
 
-	if (pxmitframe == NULL)
+	if (!pxmitframe)
 		return;
 	spin_lock_irqsave(&pfree_xmit_queue->lock, irqL);
 	list_del_init(&pxmitframe->list);
@@ -827,7 +827,7 @@ void r8712_free_xmitframe(struct xmit_priv *pxmitpriv,
 void r8712_free_xmitframe_ex(struct xmit_priv *pxmitpriv,
 		      struct xmit_frame *pxmitframe)
 {
-	if (pxmitframe == NULL)
+	if (!pxmitframe)
 		return;
 	if (pxmitframe->frame_tag == DATA_FRAMETAG)
 		r8712_free_xmitframe(pxmitpriv, pxmitframe);
@@ -918,7 +918,7 @@ sint r8712_xmit_classifier(struct _adapter *padapter,
 				psta = r8712_get_stainfo(pstapriv, pattrib->ra);
 		}
 	}
-	if (psta == NULL)
+	if (!psta)
 		return _FAIL;
 	ptxservq = get_sta_pending(padapter, &pstapending,
 		   psta, pattrib->priority);
@@ -1030,7 +1030,7 @@ int r8712_pre_xmit(struct _adapter *padapter, struct xmit_frame *pxmitframe)
 		return ret;
 	}
 	pxmitbuf = r8712_alloc_xmitbuf(pxmitpriv);
-	if (pxmitbuf == NULL) { /*enqueue packet*/
+	if (!pxmitbuf) { /*enqueue packet*/
 		ret = false;
 		r8712_xmit_enqueue(padapter, pxmitframe);
 		spin_unlock_irqrestore(&pxmitpriv->lock, irqL);
drivers/staging/rtl8712/usb_intf.c +1 -2
index 7478bbd..91382c2 100644
@@ -577,7 +577,7 @@ static int r871xu_drv_init(struct usb_interface *pusb_intf,
 error:
 	usb_put_dev(udev);
 	usb_set_intfdata(pusb_intf, NULL);
-	if (padapter && padapter->dvobj_deinit != NULL)
+	if (padapter && padapter->dvobj_deinit)
 		padapter->dvobj_deinit(padapter);
 	if (pnetdev)
 		free_netdev(pnetdev);
--

2.7.4

--
You received this message because you are subscribed to the Google Groups "outreachy-kernel" group.
To unsubscribe from this group and stop receiving emails from it, send an email to [email protected]. To post to this group, send email to [email protected].
To view this discussion on the web visit https://groups.google.com/d/msgid/outreachy-kernel/1552408996-9962-1-git-send-email-digholebhagyashri%40gmail.com.
For more options, visit https://groups.google.com/d/optout.

#2 lore raw
Quoted 7 lines · Julia Lawall
Quoted 3 lines · Bhagyashri Dighole

Replace NULL comparison with '!' operator which is indicated by checkpatch.pl.

Quoted 8 lines
Quoted 4 lines

---
Changes in v2:
-- Drop some invalid changes.

Sorry, but I don't think Greg will be happy with three v2's. It would be better to send a v3 that is correct in every way.

Okay.

Quoted 689 lines

julia

Quoted 12 lines
 drivers/staging/rtl8712/rtl8712_recv.c        | 10 +++++-----
 drivers/staging/rtl8712/rtl871x_cmd.c         |  4 ++--
 drivers/staging/rtl8712/rtl871x_io.c          |  2 +-
 drivers/staging/rtl8712/rtl871x_ioctl_linux.c | 16 ++++++++--------
 drivers/staging/rtl8712/rtl871x_mlme.c        | 16 ++++++++--------
 drivers/staging/rtl8712/rtl871x_mp_ioctl.c    |  2 +-
 drivers/staging/rtl8712/rtl871x_recv.c        | 20 ++++++++++----------
 drivers/staging/rtl8712/rtl871x_recv.h        | 10 +++++-----
 drivers/staging/rtl8712/rtl871x_security.c    |  8 ++++----
 drivers/staging/rtl8712/rtl871x_sta_mgt.c     |  4 ++--
 drivers/staging/rtl8712/rtl871x_xmit.c        | 24

++++++++++++------------

Review

Quoted 4 lines
 drivers/staging/rtl8712/usb_intf.c            |  2 +-
 12 files changed, 59 insertions(+), 59 deletions(-)
(quoted diff) +0 -0

b/drivers/staging/rtl8712/rtl8712_recv.c

drivers/staging/rtl8712/rtl8712_recv.c int r8712_free_recvframe(union recv_frame

Quoted 4 lines

index 9e09431..9aa950e 100644

drivers/staging/rtl8712/rtl8712_recv.c +0 -0
@@ -135,7 +135,7 @@ int r8712_free_recvframe(union recv_frame

*precvframe,

drivers/staging/rtl8712/rtl8712_recv.c union recv_frame *r8712_recvframe_chk_defrag(struct

Quoted 9 lines
drivers/staging/rtl8712/rtl8712_recv.c +1 -1
      spin_lock_irqsave(&pfree_recv_queue->lock, irqL);
      list_del_init(&(precvframe->u.hdr.list));
      list_add_tail(&(precvframe->u.hdr.list), &pfree_recv_queue->queue);
-     if (padapter != NULL) {
+     if (padapter) {
              if (pfree_recv_queue == &precvpriv->free_recv_queue)
                      precvpriv->free_recvframe_cnt++;
      }
@@ -273,7 +273,7 @@ union recv_frame *r8712_recvframe_chk_defrag(struct

_adapter *padapter,

drivers/staging/rtl8712/rtl8712_recv.c union recv_frame *r8712_recvframe_chk_defrag(struct

Quoted 9 lines
drivers/staging/rtl8712/rtl8712_recv.c +1 -1
              /* 0~(n-1) fragment frame
               * enqueue to defraf_g
               */
-             if (pdefrag_q != NULL) {
+             if (pdefrag_q) {
                      if (fragnum == 0) {
                              /*the first fragment*/
                              if (!list_empty(&pdefrag_q->queue)) {
@@ -299,7 +299,7 @@ union recv_frame *r8712_recvframe_chk_defrag(struct

_adapter *padapter,

drivers/staging/rtl8712/rtl8712_recv.c union recv_frame *r8712_recvframe_chk_defrag(struct

Quoted 9 lines
drivers/staging/rtl8712/rtl8712_recv.c +1 -1
              /* the last fragment frame
               * enqueue the last fragment
               */
-             if (pdefrag_q != NULL) {
+             if (pdefrag_q) {
                      phead = &pdefrag_q->queue;
                      list_add_tail(&pfhdr->list, phead);
                      /*call recvframe_defrag to defrag*/
@@ -313,7 +313,7 @@ union recv_frame *r8712_recvframe_chk_defrag(struct

_adapter *padapter,

drivers/staging/rtl8712/rtl8712_recv.c static void process_link_qual(struct _adapter

Quoted 9 lines
drivers/staging/rtl8712/rtl8712_recv.c +1 -1
                      prtnframe = NULL;
              }
      }
-     if ((prtnframe != NULL) && (prtnframe->u.hdr.attrib.privacy)) {
+     if (prtnframe && prtnframe->u.hdr.attrib.privacy) {
              /* after defrag we must check tkip mic code */
              if (r8712_recvframe_chkmic(padapter, prtnframe) == _FAIL) {
                      r8712_free_recvframe(prtnframe, pfree_recv_queue);
@@ -889,7 +889,7 @@ static void process_link_qual(struct _adapter

*padapter,

drivers/staging/rtl8712/rtl8712_recv.c static void process_link_qual(struct _adapter · line 890

Quoted 2 lines
drivers/staging/rtl8712/rtl8712_recv.c +0 -0
      struct rx_pkt_attrib *pattrib;
      struct smooth_rssi_data *sqd =

&padapter->recvpriv.signal_qual_data;

Review

Quoted 7 lines
drivers/staging/rtl8712/rtl8712_recv.c +1 -1
-     if (prframe == NULL || padapter == NULL)
+     if (!prframe || !padapter)
              return;
      pattrib = &prframe->u.hdr.attrib;
      if (pattrib->signal_qual != 0) {
(quoted diff) +0 -0

b/drivers/staging/rtl8712/rtl871x_cmd.c

Quoted 13 lines

index 05a78ac..eaae9c0 100644

drivers/staging/rtl8712/rtl871x_cmd.c +1 -1
@@ -194,7 +194,7 @@ void r8712_free_cmd_obj(struct cmd_obj *pcmd)
      if ((pcmd->cmdcode != _JoinBss_CMD_) &&
          (pcmd->cmdcode != _CreateBss_CMD_))
              kfree(pcmd->parmbuf);
-     if (pcmd->rsp != NULL) {
+     if (pcmd->rsp) {
              if (pcmd->rspsz != 0)
                      kfree(pcmd->rsp);
      }

drivers/staging/rtl8712/rtl871x_cmd.c u8 r8712_sitesurvey_cmd(struct _adapter *padapter, · line 233

Quoted 6 lines
drivers/staging/rtl8712/rtl871x_cmd.c +1 -1
@@ -229,7 +229,7 @@ u8 r8712_sitesurvey_cmd(struct _adapter *padapter,
      psurveyPara->passive_mode = cpu_to_le32(pmlmepriv->passive_mode);
      psurveyPara->ss_ssidlen = 0;
      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);

Review

Quoted 3 lines
drivers/staging/rtl8712/rtl871x_cmd.c +0 -0
              psurveyPara->ss_ssidlen = cpu_to_le32(pssid->SsidLength);
      }
(quoted diff) +0 -0

b/drivers/staging/rtl8712/rtl871x_io.c

drivers/staging/rtl8712/rtl871x_io.c static uint _init_intf_hdl(struct _adapter *padapter, · line 51

Quoted 6 lines

index 17dafef..e34302a 100644

drivers/staging/rtl8712/rtl871x_io.c +0 -0
@@ -50,7 +50,7 @@ static uint _init_intf_hdl(struct _adapter *padapter,
      init_intf_priv = &r8712_usb_init_intf_priv;
      pintf_priv = pintf_hdl->pintfpriv = kmalloc(sizeof(struct

intf_priv),

Review

Quoted 7 lines
drivers/staging/rtl8712/rtl871x_io.c +1 -1
                                                  GFP_ATOMIC);
-     if (pintf_priv == NULL)
+     if (!pintf_priv)
              goto _init_intf_hdl_fail;
      pintf_hdl->adapter = (u8 *)padapter;
      set_intf_option(&pintf_hdl->intf_option);
(quoted diff) +0 -0

b/drivers/staging/rtl8712/rtl871x_ioctl_linux.c

drivers/staging/rtl8712/rtl871x_ioctl_linux.c static int r871x_set_wpa_ie(struct _adapter

Quoted 4 lines

index ad9b2f7..e55db92 100644

drivers/staging/rtl8712/rtl871x_ioctl_linux.c +0 -0
@@ -467,11 +467,11 @@ static int r871x_set_wpa_ie(struct _adapter

*padapter, char *pie,

drivers/staging/rtl8712/rtl871x_ioctl_linux.c static int r871x_wx_set_mlme(struct net_device

Quoted 23 lines
drivers/staging/rtl8712/rtl871x_ioctl_linux.c +3 -3
      int group_cipher = 0, pairwise_cipher = 0;
      int ret = 0;
 
-     if ((ielen > MAX_WPA_IE_LEN) || (pie == NULL))
+     if (ielen > MAX_WPA_IE_LEN || !pie)
              return -EINVAL;
      if (ielen) {
              buf = kmemdup(pie, ielen, GFP_ATOMIC);
-             if (buf == NULL)
+             if (!buf)
                      return -ENOMEM;
              if (ielen < RSN_HEADER_LEN) {
                      ret  = -EINVAL;
@@ -763,7 +763,7 @@ static int r871x_wx_set_pmkid(struct net_device *dev,
  *   If cmd is IW_PMKSA_REMOVE, it means the wpa_supplicant wants to
  *   remove a PMKID/BSSID from driver.
  */
-     if (pPMK == NULL)
+     if (!pPMK)
              return -EINVAL;
      memcpy(strIssueBssid, pPMK->bssid.sa_data, ETH_ALEN);
      switch (pPMK->cmd) {
@@ -1085,7 +1085,7 @@ static int r871x_wx_set_mlme(struct net_device

*dev,

drivers/staging/rtl8712/rtl871x_ioctl_linux.c static int r871x_get_ap_info(struct net_device

Quoted 9 lines
drivers/staging/rtl8712/rtl871x_ioctl_linux.c +1 -1
      struct _adapter *padapter = netdev_priv(dev);
      struct iw_mlme *mlme = (struct iw_mlme *) extra;
 
-     if (mlme == NULL)
+     if (!mlme)
              return -1;
      switch (mlme->cmd) {
      case IW_MLME_DEAUTH:
@@ -1938,7 +1938,7 @@ static int r871x_get_ap_info(struct net_device

*dev,

Review

Quoted 36 lines
drivers/staging/rtl8712/rtl871x_ioctl_linux.c +4 -4
      u8 bssid[ETH_ALEN];
      char data[33];
 
-     if (padapter->driver_stopped || (pdata == NULL))
+     if (padapter->driver_stopped || !pdata)
              return -EINVAL;
      while (check_fwstate(pmlmepriv, _FW_UNDER_SURVEY |
                           _FW_UNDER_LINKING)) {
@@ -2002,7 +2002,7 @@ static int r871x_set_pid(struct net_device *dev,
      struct _adapter *padapter = netdev_priv(dev);
      struct iw_point *pdata = &wrqu->data;
 
-     if ((padapter->driver_stopped) || (pdata == NULL))
+     if (padapter->driver_stopped || !pdata)
              return -EINVAL;
      if (copy_from_user(&padapter->pid, pdata->pointer, sizeof(int)))
              return -EINVAL;
@@ -2018,7 +2018,7 @@ static int r871x_set_chplan(struct net_device *dev,
      struct iw_point *pdata = &wrqu->data;
      int ch_plan = -1;
 
-     if ((padapter->driver_stopped) || (pdata == NULL)) {
+     if (padapter->driver_stopped || !pdata) {
              ret = -EINVAL;
              goto exit;
      }
@@ -2038,7 +2038,7 @@ static int r871x_wps_start(struct net_device *dev,
      struct iw_point *pdata = &wrqu->data;
      u32   u32wps_start = 0;
 
-     if ((padapter->driver_stopped) || (pdata == NULL))
+     if (padapter->driver_stopped || !pdata)
              return -EINVAL;
      if (copy_from_user((void *)&u32wps_start, pdata->pointer, 4))
              return -EFAULT;
(quoted diff) +0 -0

b/drivers/staging/rtl8712/rtl871x_mlme.c

drivers/staging/rtl8712/rtl871x_mlme.c static void free_network_nolock(struct mlme_priv

Quoted 13 lines

index c666e03..d48f3d1 100644

drivers/staging/rtl8712/rtl871x_mlme.c +1 -1
@@ -95,7 +95,7 @@ static void _free_network(struct mlme_priv *pmlmepriv,
      unsigned long irqL;
      struct  __queue *free_queue = &(pmlmepriv->free_bss_pool);
 
-     if (pnetwork == NULL)
+     if (!pnetwork)
              return;
      if (pnetwork->fixed)
              return;
@@ -115,7 +115,7 @@ static void free_network_nolock(struct mlme_priv

*pmlmepriv,

drivers/staging/rtl8712/rtl871x_mlme.c void r8712_joinbss_event_callback(struct _adapter

Quoted 9 lines
drivers/staging/rtl8712/rtl871x_mlme.c +1 -1
 {
      struct  __queue *free_queue = &pmlmepriv->free_bss_pool;
 
-     if (pnetwork == NULL)
+     if (!pnetwork)
              return;
      if (pnetwork->fixed)
              return;
@@ -780,7 +780,7 @@ void r8712_joinbss_event_callback(struct _adapter

*adapter, u8 *pbuf)

drivers/staging/rtl8712/rtl871x_mlme.c void r8712_joinbss_event_callback(struct _adapter

Quoted 9 lines
drivers/staging/rtl8712/rtl871x_mlme.c +1 -1
                                      ptarget_wlan->fixed = true;
                      }
 
-                     if (ptarget_wlan == NULL) {
+                     if (!ptarget_wlan) {
                              if (check_fwstate(pmlmepriv,
                                      _FW_UNDER_LINKING))
                                      pmlmepriv->fw_state ^=
@@ -794,7 +794,7 @@ void r8712_joinbss_event_callback(struct _adapter

*adapter, u8 *pbuf)

drivers/staging/rtl8712/rtl871x_mlme.c void r8712_joinbss_event_callback(struct _adapter · line 795

Quoted 2 lines
drivers/staging/rtl8712/rtl871x_mlme.c +0 -0
                                      ptarget_sta =
 

r8712_get_stainfo(pstapriv,

Quoted 1 line

pnetwork->network.MacAddress);

drivers/staging/rtl8712/rtl871x_mlme.c void r8712_joinbss_event_callback(struct _adapter *adapter, u8 *pbuf) · line 798

Quoted 4 lines
drivers/staging/rtl8712/rtl871x_mlme.c +1 -1
-                                     if (ptarget_sta == NULL)
+                                     if (!ptarget_sta)
                                              ptarget_sta =

r8712_alloc_stainfo(pstapriv,

Quoted 1 line

pnetwork->network.MacAddress);

drivers/staging/rtl8712/rtl871x_mlme.c void r8712_stassoc_event_callback(struct _adapter

Quoted 1 line
drivers/staging/rtl8712/rtl871x_mlme.c +0 -0
@@ -905,7 +905,7 @@ void r8712_stassoc_event_callback(struct _adapter

*adapter, u8 *pbuf)

drivers/staging/rtl8712/rtl871x_mlme.c void r8712_stassoc_event_callback(struct _adapter

Quoted 9 lines
drivers/staging/rtl8712/rtl871x_mlme.c +1 -1
      if (!r8712_access_ctrl(&adapter->acl_list, pstassoc->macaddr))
              return;
      psta = r8712_get_stainfo(&adapter->stapriv, pstassoc->macaddr);
-     if (psta != NULL) {
+     if (psta) {
              /*the sta have been in sta_info_queue => do nothing
               *(between drv has received this event before and
               * fw have not yet to set key to CAM_ENTRY)
@@ -914,7 +914,7 @@ void r8712_stassoc_event_callback(struct _adapter

*adapter, u8 *pbuf)

drivers/staging/rtl8712/rtl871x_mlme.c int r8712_select_and_join_from_scan(struct

Quoted 9 lines
drivers/staging/rtl8712/rtl871x_mlme.c +1 -1
      }
 
      psta = r8712_alloc_stainfo(&adapter->stapriv, pstassoc->macaddr);
-     if (psta == NULL)
+     if (!psta)
              return;
      /* to do : init sta_info variable */
      psta->qos_option = 0;
@@ -1112,7 +1112,7 @@ int r8712_select_and_join_from_scan(struct

mlme_priv *pmlmepriv)

drivers/staging/rtl8712/rtl871x_mlme.c int r8712_select_and_join_from_scan(struct

Quoted 9 lines
drivers/staging/rtl8712/rtl871x_mlme.c +1 -1
      while (1) {
              if (end_of_queue_search(phead, pmlmepriv->pscanned)) {
                      if ((pmlmepriv->assoc_by_rssi) &&
-                         (pnetwork_max_rssi != NULL)) {
+                         (pnetwork_max_rssi)) {
                              pnetwork = pnetwork_max_rssi;
                              goto ask_for_joinbss;
                      }
@@ -1120,7 +1120,7 @@ int r8712_select_and_join_from_scan(struct

mlme_priv *pmlmepriv)

Review

Quoted 9 lines
drivers/staging/rtl8712/rtl871x_mlme.c +1 -1
              }
              pnetwork = container_of(pmlmepriv->pscanned,
                                      struct wlan_network, list);
-             if (pnetwork == NULL)
+             if (!pnetwork)
                      return _FAIL;
              pmlmepriv->pscanned = pmlmepriv->pscanned->next;
              if (pmlmepriv->assoc_by_bssid) {
(quoted diff) +0 -0

b/drivers/staging/rtl8712/rtl871x_mp_ioctl.c

Review

Quoted 13 lines

index 588346d..bbef96f9f 100644

drivers/staging/rtl8712/rtl871x_mp_ioctl.c +1 -1
@@ -186,7 +186,7 @@ static int mp_start_test(struct _adapter *padapter)
      if (psta)
              r8712_free_stainfo(padapter, psta);
      psta = r8712_alloc_stainfo(&padapter->stapriv, bssid.MacAddress);
-     if (psta == NULL) {
+     if (!psta) {
              res = _FAIL;
              goto end_of_mp_start_test;
      }
(quoted diff) +0 -0

b/drivers/staging/rtl8712/rtl871x_recv.c

drivers/staging/rtl8712/rtl871x_recv.c sint _r8712_init_recv_priv(struct recv_priv *precvpriv, · line 64

Quoted 6 lines

index 28f7369..aa4e406 100644

drivers/staging/rtl8712/rtl871x_recv.c +0 -0
@@ -63,7 +63,7 @@ sint _r8712_init_recv_priv(struct recv_priv *precvpriv,
      precvpriv->pallocated_frame_buf = kzalloc(NR_RECVFRAME *
                              sizeof(union recv_frame) +

RXFRAME_ALIGN_SZ,

drivers/staging/rtl8712/rtl871x_recv.c union recv_frame *r8712_alloc_recvframe(struct

Quoted 7 lines
drivers/staging/rtl8712/rtl871x_recv.c +1 -1
                              GFP_ATOMIC);
-     if (precvpriv->pallocated_frame_buf == NULL)
+     if (!precvpriv->pallocated_frame_buf)
              return _FAIL;
      kmemleak_not_leak(precvpriv->pallocated_frame_buf);
      precvpriv->precv_frame_buf = precvpriv->pallocated_frame_buf +
@@ -102,7 +102,7 @@ union recv_frame *r8712_alloc_recvframe(struct

__queue *pfree_recv_queue)

drivers/staging/rtl8712/rtl871x_recv.c union recv_frame *r8712_alloc_recvframe(struct __queue *pfree_recv_queue)

Quoted 7 lines
drivers/staging/rtl8712/rtl871x_recv.c +1 -1
      if (precvframe) {
              list_del_init(&precvframe->u.hdr.list);
              padapter = precvframe->u.hdr.adapter;
-             if (padapter != NULL) {
+             if (padapter) {
                      precvpriv = &padapter->recvpriv;
                      if (pfree_recv_queue ==

&precvpriv->free_recv_queue)

drivers/staging/rtl8712/rtl871x_recv.c union recv_frame *r8712_portctrl(struct _adapter

Quoted 11 lines
drivers/staging/rtl8712/rtl871x_recv.c +1 -1
                              precvpriv->free_recvframe_cnt--;
@@ -150,7 +150,7 @@ sint r8712_recvframe_chkmic(struct _adapter *adapter,
      stainfo = r8712_get_stainfo(&adapter->stapriv, &prxattrib->ta[0]);
      if (prxattrib->encrypt == _TKIP_) {
              /* calculate mic code */
-             if (stainfo != NULL) {
+             if (stainfo) {
                      if (IS_MCAST(prxattrib->ra)) {
                              iv = precvframe->u.hdr.rx_data +
                                   prxattrib->hdrlen;
@@ -248,7 +248,7 @@ union recv_frame *r8712_portctrl(struct _adapter

*adapter,

drivers/staging/rtl8712/rtl871x_recv.c static sint sta2sta_data_frame(struct _adapter

Quoted 9 lines
drivers/staging/rtl8712/rtl871x_recv.c +1 -1
              memcpy(&ether_type, ptr, 2);
              be16_to_cpus(&ether_type);
 
-             if ((psta != NULL) && (psta->ieee8021x_blocked)) {
+             if (psta && psta->ieee8021x_blocked) {
                      /* blocked
                       * only accept EAPOL frame
                       */
@@ -355,7 +355,7 @@ static sint sta2sta_data_frame(struct _adapter

*adapter,

drivers/staging/rtl8712/rtl871x_recv.c static sint sta2sta_data_frame(struct _adapter *adapter,

Quoted 3 lines
drivers/staging/rtl8712/rtl871x_recv.c +0 -0
              *psta = r8712_get_bcmc_stainfo(adapter);
      else
              *psta = r8712_get_stainfo(pstapriv, sta_addr); /* get

ap_info */

drivers/staging/rtl8712/rtl871x_recv.c static sint ap2sta_data_frame(struct _adapter

Quoted 6 lines
drivers/staging/rtl8712/rtl871x_recv.c +1 -1
-     if (*psta == NULL) {
+     if (!*psta) {
              if (check_fwstate(pmlmepriv, WIFI_MP_STATE))
                      adapter->mppriv.rx_pktloss++;
              return _FAIL;
@@ -405,7 +405,7 @@ static sint ap2sta_data_frame(struct _adapter

*adapter,

drivers/staging/rtl8712/rtl871x_recv.c static sint sta2sta_data_frame(struct _adapter *adapter,

Quoted 3 lines
drivers/staging/rtl8712/rtl871x_recv.c +0 -0
                      *psta = r8712_get_bcmc_stainfo(adapter);
              else
                      *psta = r8712_get_stainfo(pstapriv,

pattrib->bssid);

drivers/staging/rtl8712/rtl871x_recv.c static sint ap2sta_data_frame(struct _adapter

Quoted 6 lines
drivers/staging/rtl8712/rtl871x_recv.c +1 -1
-             if (*psta == NULL)
+             if (!*psta)
                      return _FAIL;
      } else if (check_fwstate(pmlmepriv, WIFI_MP_STATE) &&
                 check_fwstate(pmlmepriv, _FW_LINKED)) {
@@ -416,7 +416,7 @@ static sint ap2sta_data_frame(struct _adapter

*adapter,

drivers/staging/rtl8712/rtl871x_recv.c static sint sta2ap_data_frame(struct _adapter

Quoted 9 lines
drivers/staging/rtl8712/rtl871x_recv.c +1 -1
              memcpy(pattrib->ta, pattrib->src, ETH_ALEN);
              memcpy(pattrib->bssid,  mybssid, ETH_ALEN);
              *psta = r8712_get_stainfo(pstapriv, pattrib->bssid);
-             if (*psta == NULL)
+             if (!*psta)
                      return _FAIL;
      } else {
              return _FAIL;
@@ -441,7 +441,7 @@ static sint sta2ap_data_frame(struct _adapter

*adapter,

drivers/staging/rtl8712/rtl871x_recv.c static sint validate_recv_data_frame(struct _adapter

Quoted 9 lines
drivers/staging/rtl8712/rtl871x_recv.c +1 -1
              if (memcmp(pattrib->bssid, mybssid, ETH_ALEN))
                      return _FAIL;
              *psta = r8712_get_stainfo(pstapriv, pattrib->src);
-             if (*psta == NULL)
+             if (!*psta)
                      return _FAIL;
      }
      return _SUCCESS;
@@ -475,7 +475,7 @@ static sint validate_recv_data_frame(struct _adapter

*adapter,

drivers/staging/rtl8712/rtl871x_recv.c static sint validate_recv_data_frame(struct _adapter

Quoted 9 lines
drivers/staging/rtl8712/rtl871x_recv.c +1 -1
      pda = get_da(ptr);
      psa = get_sa(ptr);
      pbssid = get_hdr_bssid(ptr);
-     if (pbssid == NULL)
+     if (!pbssid)
              return _FAIL;
      memcpy(pattrib->dst, pda, ETH_ALEN);
      memcpy(pattrib->src, psa, ETH_ALEN);
@@ -505,7 +505,7 @@ static sint validate_recv_data_frame(struct _adapter

*adapter,

Review

Quoted 9 lines
drivers/staging/rtl8712/rtl871x_recv.c +1 -1
      }
      if (res == _FAIL)
              return _FAIL;
-     if (psta == NULL)
+     if (!psta)
              return _FAIL;
      precv_frame->u.hdr.psta = psta;
      pattrib->amsdu = 0;
(quoted diff) +0 -0

b/drivers/staging/rtl8712/rtl871x_recv.h

drivers/staging/rtl8712/rtl871x_recv.h int recv_func(struct _adapter *padapter, void

Quoted 4 lines

index f87b2ff..1a56cd4 100644

drivers/staging/rtl8712/rtl871x_recv.h +0 -0
@@ -138,7 +138,7 @@ int recv_func(struct _adapter *padapter, void

*pcontext);

drivers/staging/rtl8712/rtl871x_recv.h static inline u8 *get_rxmem(union recv_frame

Quoted 9 lines
drivers/staging/rtl8712/rtl871x_recv.h +1 -1
 static inline u8 *get_rxmem(union recv_frame *precvframe)
 {
      /* always return rx_head... */
-     if (precvframe == NULL)
+     if (!precvframe)
              return NULL;
      return precvframe->u.hdr.rx_head;
 }
@@ -146,7 +146,7 @@ static inline u8 *get_rxmem(union recv_frame

*precvframe)

drivers/staging/rtl8712/rtl871x_recv.h static inline u8 *recvframe_pull(union recv_frame

Quoted 9 lines
drivers/staging/rtl8712/rtl871x_recv.h +1 -1
 static inline u8 *get_recvframe_data(union recv_frame *precvframe)
 {
      /* always return rx_data */
-     if (precvframe == NULL)
+     if (!precvframe)
              return NULL;
      return precvframe->u.hdr.rx_data;
 }
@@ -156,7 +156,7 @@ static inline u8 *recvframe_pull(union recv_frame

*precvframe, sint sz)

drivers/staging/rtl8712/rtl871x_recv.h static inline u8 *recvframe_pull(union recv_frame · line 156

Quoted 1 line
drivers/staging/rtl8712/rtl871x_recv.h +0 -0
      /* used for extract sz bytes from rx_data, update rx_data and

return

drivers/staging/rtl8712/rtl871x_recv.h static inline u8 *recvframe_put(union recv_frame

Quoted 8 lines
drivers/staging/rtl8712/rtl871x_recv.h +1 -1
       * the updated rx_data to the caller
       */
-     if (precvframe == NULL)
+     if (!precvframe)
              return NULL;
      precvframe->u.hdr.rx_data += sz;
      if (precvframe->u.hdr.rx_data > precvframe->u.hdr.rx_tail) {
@@ -173,7 +173,7 @@ static inline u8 *recvframe_put(union recv_frame

*precvframe, sint sz)

drivers/staging/rtl8712/rtl871x_recv.h static inline u8 *recvframe_pull_tail(union

Quoted 9 lines
drivers/staging/rtl8712/rtl871x_recv.h +1 -1
       * return the updated rx_tail to the caller
       * after putting, rx_tail must be still larger than rx_end.
       */
-     if (precvframe == NULL)
+     if (!precvframe)
              return NULL;
      precvframe->u.hdr.rx_tail += sz;
      if (precvframe->u.hdr.rx_tail > precvframe->u.hdr.rx_end) {
@@ -191,7 +191,7 @@ static inline u8 *recvframe_pull_tail(union

recv_frame *precvframe, sint sz)

Review

Quoted 9 lines
drivers/staging/rtl8712/rtl871x_recv.h +1 -1
       * updated rx_end to the caller
       * after pulling, rx_end must be still larger than rx_data.
       */
-     if (precvframe == NULL)
+     if (!precvframe)
              return NULL;
      precvframe->u.hdr.rx_tail -= sz;
      if (precvframe->u.hdr.rx_tail < precvframe->u.hdr.rx_data) {
(quoted diff) +0 -0

b/drivers/staging/rtl8712/rtl871x_security.c

drivers/staging/rtl8712/rtl871x_security.c void r8712_wep_encrypt(struct _adapter *padapter, u8

Quoted 4 lines

index f826450..148e24e 100644

drivers/staging/rtl8712/rtl871x_security.c +0 -0
@@ -160,7 +160,7 @@ void r8712_wep_encrypt(struct _adapter *padapter, u8

*pxmitframe)

drivers/staging/rtl8712/rtl871x_security.c void r8712_wep_encrypt(struct _adapter *padapter, u8 *pxmitframe)

Quoted 7 lines
drivers/staging/rtl8712/rtl871x_security.c +1 -1
      struct  security_priv *psecuritypriv = &padapter->securitypriv;
      struct  xmit_priv *pxmitpriv = &padapter->xmitpriv;
 
-     if (((struct xmit_frame *)pxmitframe)->buf_addr == NULL)
+     if (((struct xmit_frame *)pxmitframe)->buf_addr==NULL)
              return;
      pframe = ((struct xmit_frame *)pxmitframe)->buf_addr +

TXDESC_OFFSET;

drivers/staging/rtl8712/rtl871x_security.c u32 r8712_tkip_encrypt(struct _adapter *padapter, u8

Quoted 2 lines
drivers/staging/rtl8712/rtl871x_security.c +0 -0
      /*start to encrypt each fragment*/
@@ -584,7 +584,7 @@ u32 r8712_tkip_encrypt(struct _adapter *padapter, u8

*pxmitframe)

drivers/staging/rtl8712/rtl871x_security.c u32 r8712_tkip_encrypt(struct _adapter *padapter, u8 *pxmitframe)

Quoted 7 lines
drivers/staging/rtl8712/rtl871x_security.c +1 -1
              else
                      stainfo = r8712_get_stainfo(&padapter->stapriv,
                                &pattrib->ra[0]);
-             if (stainfo != NULL) {
+             if (stainfo) {
                      prwskey = &stainfo->x_UncstKey.skey[0];
                      for (curfragnum = 0; curfragnum <

pattrib->nr_frags;

drivers/staging/rtl8712/rtl871x_security.c u32 r8712_tkip_decrypt(struct _adapter *padapter, u8

Quoted 2 lines
drivers/staging/rtl8712/rtl871x_security.c +0 -0
                           curfragnum++) {
@@ -658,7 +658,7 @@ u32 r8712_tkip_decrypt(struct _adapter *padapter, u8

*precvframe)

drivers/staging/rtl8712/rtl871x_security.c u32 r8712_aes_decrypt(struct _adapter *padapter,

Quoted 9 lines
drivers/staging/rtl8712/rtl871x_security.c +1 -1
      if (prxattrib->encrypt == _TKIP_) {
              stainfo = r8712_get_stainfo(&padapter->stapriv,
                                          &prxattrib->ta[0]);
-             if (stainfo != NULL) {
+             if (stainfo) {
                      iv = pframe + prxattrib->hdrlen;
                      payload = pframe + prxattrib->iv_len +
                                prxattrib->hdrlen;
@@ -1367,7 +1367,7 @@ u32 r8712_aes_decrypt(struct _adapter *padapter,

u8 *precvframe)

Review

Quoted 9 lines
drivers/staging/rtl8712/rtl871x_security.c +1 -1
      if (prxattrib->encrypt == _AES_) {
              stainfo = r8712_get_stainfo(&padapter->stapriv,
                                          &prxattrib->ta[0]);
-             if (stainfo != NULL) {
+             if (stainfo) {
                      if (IS_MCAST(prxattrib->ra)) {
                              iv = pframe + prxattrib->hdrlen;
                              idx = iv[3];
(quoted diff) +0 -0

b/drivers/staging/rtl8712/rtl871x_sta_mgt.c

drivers/staging/rtl8712/rtl871x_sta_mgt.c void r8712_free_stainfo(struct _adapter *padapter,

Quoted 4 lines

index 7c30b9e..f1439a7 100644

drivers/staging/rtl8712/rtl871x_sta_mgt.c +0 -0
@@ -150,7 +150,7 @@ void r8712_free_stainfo(struct _adapter *padapter,

struct sta_info *psta)

drivers/staging/rtl8712/rtl871x_sta_mgt.c struct sta_info *r8712_get_stainfo(struct sta_priv

Quoted 9 lines
drivers/staging/rtl8712/rtl871x_sta_mgt.c +1 -1
      struct  xmit_priv *pxmitpriv = &padapter->xmitpriv;
      struct  sta_priv *pstapriv = &padapter->stapriv;
 
-     if (psta == NULL)
+     if (!psta)
              return;
      pfree_sta_queue = &pstapriv->free_sta_queue;
      pstaxmitpriv = &psta->sta_xmitpriv;
@@ -223,7 +223,7 @@ struct sta_info *r8712_get_stainfo(struct sta_priv

*pstapriv, u8 *hwaddr)

Review

Quoted 9 lines
drivers/staging/rtl8712/rtl871x_sta_mgt.c +1 -1
      struct sta_info *psta = NULL;
      u32     index;
 
-     if (hwaddr == NULL)
+     if (!hwaddr)
              return NULL;
      index = wifi_mac_hash(hwaddr);
      spin_lock_irqsave(&pstapriv->sta_hash_lock, irqL);
(quoted diff) +0 -0

b/drivers/staging/rtl8712/rtl871x_xmit.c

drivers/staging/rtl8712/rtl871x_xmit.c sint r8712_update_attrib(struct _adapter *padapter,

Quoted 13 lines

index 7c88574..94c2a48 100644

drivers/staging/rtl8712/rtl871x_xmit.c +1 -1
@@ -156,7 +156,7 @@ void _free_xmit_priv(struct xmit_priv *pxmitpriv)
                                      pxmitpriv->pxmit_frame_buf;
      struct xmit_buf *pxmitbuf = (struct xmit_buf *)pxmitpriv->pxmitbuf;
 
-     if (pxmitpriv->pxmit_frame_buf == NULL)
+     if (!pxmitpriv->pxmit_frame_buf)
              return;
      for (i = 0; i < NR_XMITFRAME; i++) {
              r8712_xmit_complete(padapter, pxmitframe);
@@ -269,7 +269,7 @@ sint r8712_update_attrib(struct _adapter *padapter,

_pkt *pkt,

drivers/staging/rtl8712/rtl871x_xmit.c static sint xmitframe_addmic(struct _adapter

Quoted 9 lines
drivers/staging/rtl8712/rtl871x_xmit.c +1 -1
                      pattrib->mac_id = 5;
              } else {
                      psta = r8712_get_stainfo(pstapriv, pattrib->ra);
-                     if (psta == NULL)  /* drop the pkt */
+                     if (!psta)  /* drop the pkt */
                              return _FAIL;
                      if (check_fwstate(pmlmepriv, WIFI_STATION_STATE))
                              pattrib->mac_id = 5;
@@ -362,7 +362,7 @@ static sint xmitframe_addmic(struct _adapter

*padapter,

drivers/staging/rtl8712/rtl871x_xmit.c static sint xmitframe_addmic(struct _adapter *padapter,

Quoted 6 lines
drivers/staging/rtl8712/rtl871x_xmit.c +1 -1
                                          &pattrib->ra[0]);
      if (pattrib->encrypt == _TKIP_) {
              /*encode mic code*/
-             if (stainfo != NULL) {
+             if (stainfo) {
                      u8 null_key[16] = {0x0, 0x0, 0x0, 0x0, 0x0, 0x0,

0x0,

drivers/staging/rtl8712/rtl871x_xmit.c static sint xmitframe_addmic(struct _adapter · line 367

Quoted 1 line
drivers/staging/rtl8712/rtl871x_xmit.c +0 -0
                                         0x0, 0x0, 0x0, 0x0, 0x0, 0x0,

0x0,

drivers/staging/rtl8712/rtl871x_xmit.c sint r8712_xmitframe_coalesce(struct _adapter

Quoted 2 lines
drivers/staging/rtl8712/rtl871x_xmit.c +0 -0
                                         0x0, 0x0};
@@ -596,10 +596,10 @@ sint r8712_xmitframe_coalesce(struct _adapter

*padapter, _pkt *pkt,

drivers/staging/rtl8712/rtl871x_xmit.c sint r8712_xmitframe_coalesce(struct _adapter

Quoted 13 lines
drivers/staging/rtl8712/rtl871x_xmit.c +2 -2
      u8 *pbuf_start;
      sint bmcst = IS_MCAST(pattrib->ra);
 
-     if (pattrib->psta == NULL)
+     if (!pattrib->psta)
              return _FAIL;
      psta = pattrib->psta;
-     if (pxmitframe->buf_addr == NULL)
+     if (!pxmitframe->buf_addr)
              return _FAIL;
      pbuf_start = pxmitframe->buf_addr;
      ptxdesc = pbuf_start;
@@ -627,7 +627,7 @@ sint r8712_xmitframe_coalesce(struct _adapter

*padapter, _pkt *pkt,

drivers/staging/rtl8712/rtl871x_xmit.c void r8712_update_protection(struct _adapter

Quoted 9 lines
drivers/staging/rtl8712/rtl871x_xmit.c +1 -1
              mpdu_len -= pattrib->hdrlen;
              /* adding icv, if necessary...*/
              if (pattrib->iv_len) {
-                     if (psta != NULL) {
+                     if (psta) {
                              switch (pattrib->encrypt) {
                              case _WEP40_:
                              case _WEP104_:
@@ -718,7 +718,7 @@ void r8712_update_protection(struct _adapter

*padapter, u8 *ie, uint ie_len)

drivers/staging/rtl8712/rtl871x_xmit.c int r8712_free_xmitbuf(struct xmit_priv *pxmitpriv,

Quoted 9 lines
drivers/staging/rtl8712/rtl871x_xmit.c +1 -1
      case AUTO_VCS:
      default:
              perp = r8712_get_ie(ie, _ERPINFO_IE_, &erp_len, ie_len);
-             if (perp == NULL) {
+             if (!perp) {
                      pxmitpriv->vcs = NONE_VCS;
              } else {
                      protection = (*(perp + 2)) & BIT(1);
@@ -757,7 +757,7 @@ int r8712_free_xmitbuf(struct xmit_priv *pxmitpriv,

struct xmit_buf *pxmitbuf)

drivers/staging/rtl8712/rtl871x_xmit.c int r8712_free_xmitbuf(struct xmit_priv *pxmitpriv, · line 758

Quoted 2 lines
drivers/staging/rtl8712/rtl871x_xmit.c +0 -0
      unsigned long irqL;
      struct  __queue *pfree_xmitbuf_queue =

&pxmitpriv->free_xmitbuf_queue;

drivers/staging/rtl8712/rtl871x_xmit.c void r8712_free_xmitframe(struct xmit_priv

Quoted 7 lines
drivers/staging/rtl8712/rtl871x_xmit.c +1 -1
-     if (pxmitbuf == NULL)
+     if (!pxmitbuf)
              return _FAIL;
      spin_lock_irqsave(&pfree_xmitbuf_queue->lock, irqL);
      list_del_init(&pxmitbuf->list);
@@ -811,7 +811,7 @@ void r8712_free_xmitframe(struct xmit_priv

*pxmitpriv,

drivers/staging/rtl8712/rtl871x_xmit.c void r8712_free_xmitframe(struct xmit_priv

Quoted 9 lines
drivers/staging/rtl8712/rtl871x_xmit.c +1 -1
      struct  __queue *pfree_xmit_queue = &pxmitpriv->free_xmit_queue;
      struct _adapter *padapter = pxmitpriv->adapter;
 
-     if (pxmitframe == NULL)
+     if (!pxmitframe)
              return;
      spin_lock_irqsave(&pfree_xmit_queue->lock, irqL);
      list_del_init(&pxmitframe->list);
@@ -827,7 +827,7 @@ void r8712_free_xmitframe(struct xmit_priv

*pxmitpriv,

drivers/staging/rtl8712/rtl871x_xmit.c sint r8712_xmit_classifier(struct _adapter *padapter, · line 918

Quoted 10 lines
drivers/staging/rtl8712/rtl871x_xmit.c +1 -1
 void r8712_free_xmitframe_ex(struct xmit_priv *pxmitpriv,
                    struct xmit_frame *pxmitframe)
 {
-     if (pxmitframe == NULL)
+     if (!pxmitframe)
              return;
      if (pxmitframe->frame_tag == DATA_FRAMETAG)
              r8712_free_xmitframe(pxmitpriv, pxmitframe);
@@ -918,7 +918,7 @@ sint r8712_xmit_classifier(struct _adapter *padapter,
                              psta = r8712_get_stainfo(pstapriv,

pattrib->ra);

drivers/staging/rtl8712/rtl871x_xmit.c int r8712_pre_xmit(struct _adapter *padapter,

Quoted 8 lines
drivers/staging/rtl8712/rtl871x_xmit.c +1 -1
              }
      }
-     if (psta == NULL)
+     if (!psta)
              return _FAIL;
      ptxservq = get_sta_pending(padapter, &pstapending,
                 psta, pattrib->priority);
@@ -1030,7 +1030,7 @@ int r8712_pre_xmit(struct _adapter *padapter,

struct xmit_frame *pxmitframe)

Review

Quoted 9 lines
drivers/staging/rtl8712/rtl871x_xmit.c +1 -1
              return ret;
      }
      pxmitbuf = r8712_alloc_xmitbuf(pxmitpriv);
-     if (pxmitbuf == NULL) { /*enqueue packet*/
+     if (!pxmitbuf) { /*enqueue packet*/
              ret = false;
              r8712_xmit_enqueue(padapter, pxmitframe);
              spin_unlock_irqrestore(&pxmitpriv->lock, irqL);
(quoted diff) +0 -0

b/drivers/staging/rtl8712/usb_intf.c

drivers/staging/rtl8712/usb_intf.c static int r871xu_drv_init(struct usb_interface

Quoted 4 lines

index 7478bbd..91382c2 100644

drivers/staging/rtl8712/usb_intf.c +0 -0
@@ -577,7 +577,7 @@ static int r871xu_drv_init(struct usb_interface

*pusb_intf,

Quoted 11 lines
drivers/staging/rtl8712/usb_intf.c +1 -2
 error:
      usb_put_dev(udev);
      usb_set_intfdata(pusb_intf, NULL);
-     if (padapter && padapter->dvobj_deinit != NULL)
+     if (padapter && padapter->dvobj_deinit)
              padapter->dvobj_deinit(padapter);
      if (pnetdev)
              free_netdev(pnetdev);
--

2.7.4

Quoted 2 lines

--
You received this message because you are subscribed to the Google

Groups "outreachy-kernel" group.

Quoted 1 line

To unsubscribe from this group and stop receiving emails from it, send

an email to [email protected].

Quoted 2 lines

To post to this group, send email to [email protected]. To view this discussion on the web visit

https://groups.google.com/d/msgid/outreachy-kernel/1552408996-9962-1-git-send-email-digholebhagyashri%40gmail.com
.

Quoted 2 lines

For more options, visit https://groups.google.com/d/optout.

--
You received this message because you are subscribed to the Google Groups "outreachy-kernel" group.
To unsubscribe from this group and stop receiving emails from it, send an email to [email protected].
To post to this group, send email to [email protected]. To view this discussion on the web visit
https://groups.google.com/d/msgid/outreachy-kernel/alpine.DEB.2.20.1903121759300.4097%40hadrien
.
For more options, visit https://groups.google.com/d/optout.