Commit 552838fd authored by Michael Straube's avatar Michael Straube Committed by Greg Kroah-Hartman
Browse files

staging: r8188eu: clean up comparsions to NULL in core directory



Clean up comparsions to NULL in the core directory reported by
checkpatch.

x == NULL -> !x
x != NULL -> x

Signed-off-by: default avatarMichael Straube <straube.linux@gmail.com>
Link: https://lore.kernel.org/r/20210801084614.4328-2-straube.linux@gmail.com


Signed-off-by: default avatarGreg Kroah-Hartman <gregkh@linuxfoundation.org>
parent 725a3f1c
Loading
Loading
Loading
Loading
+11 −11
Original line number Diff line number Diff line
@@ -67,7 +67,7 @@ static void update_BCNTIM(struct adapter *padapter)
		tim_bitmap_le = cpu_to_le16(pstapriv->tim_bitmap);

		p = rtw_get_ie(pie + _FIXED_IE_LENGTH_, _TIM_IE_, &tim_ielen, pnetwork_mlmeext->IELength - _FIXED_IE_LENGTH_);
		if (p != NULL && tim_ielen > 0) {
		if (p && tim_ielen > 0) {
			tim_ielen += 2;
			premainder_ie = p+tim_ielen;
			tim_ie_offset = (int)(p - pie);
@@ -83,7 +83,7 @@ static void update_BCNTIM(struct adapter *padapter)

			/*  get supported rates len */
			p = rtw_get_ie(pie + _BEACON_IE_OFFSET_, _SUPPORTEDRATES_IE_, &tmp_len, (pnetwork_mlmeext->IELength - _BEACON_IE_OFFSET_));
			if (p !=  NULL)
			if (p)
				offset += tmp_len+2;

			/* DS Parameter Set IE, len = 3 */
@@ -164,7 +164,7 @@ void rtw_add_bcn_ie(struct adapter *padapter, struct wlan_bssid_ex *pnetwork, u8
		i += (pIE->Length + 2);
	}

	if (p != NULL && ielen > 0) {
	if (p && ielen > 0) {
		ielen += 2;

		premainder_ie = p+ielen;
@@ -211,7 +211,7 @@ void rtw_remove_bcn_ie(struct adapter *padapter, struct wlan_bssid_ex *pnetwork,

	p = rtw_get_ie(pie + _FIXED_IE_LENGTH_, index, &ielen,
		       pnetwork->IELength - _FIXED_IE_LENGTH_);
	if (p != NULL && ielen > 0) {
	if (p && ielen > 0) {
		ielen += 2;

		premainder_ie = p+ielen;
@@ -909,14 +909,14 @@ int rtw_check_beacon_data(struct adapter *padapter, u8 *pbuf, int len)
	memset(supportRate, 0, NDIS_802_11_LENGTH_RATES_EX);
	/*  get supported rates */
	p = rtw_get_ie(ie + _BEACON_IE_OFFSET_, _SUPPORTEDRATES_IE_, &ie_len, (pbss_network->IELength - _BEACON_IE_OFFSET_));
	if (p !=  NULL) {
	if (p) {
		memcpy(supportRate, p+2, ie_len);
		supportRateNum = ie_len;
	}

	/* get ext_supported rates */
	p = rtw_get_ie(ie + _BEACON_IE_OFFSET_, _EXT_SUPPORTEDRATES_IE_, &ie_len, pbss_network->IELength - _BEACON_IE_OFFSET_);
	if (p !=  NULL) {
	if (p) {
		memcpy(supportRate+supportRateNum, p+2, ie_len);
		supportRateNum += ie_len;
	}
@@ -978,7 +978,7 @@ int rtw_check_beacon_data(struct adapter *padapter, u8 *pbuf, int len)
			}
			break;
		}
		if ((p == NULL) || (ie_len == 0))
		if (!p || ie_len == 0)
			break;
	}

@@ -1002,7 +1002,7 @@ int rtw_check_beacon_data(struct adapter *padapter, u8 *pbuf, int len)
				break;
			}

			if ((p == NULL) || (ie_len == 0))
			if (!p || ie_len == 0)
				break;
		}
	}
@@ -1089,7 +1089,7 @@ int rtw_check_beacon_data(struct adapter *padapter, u8 *pbuf, int len)
	psta = rtw_get_stainfo(&padapter->stapriv, pbss_network->MacAddress);
	if (!psta) {
		psta = rtw_alloc_stainfo(&padapter->stapriv, pbss_network->MacAddress);
		if (psta == NULL)
		if (!psta)
			return _FAIL;
	}

@@ -1292,7 +1292,7 @@ static void update_bcn_wps_ie(struct adapter *padapter)

	pwps_ie = rtw_get_wps_ie(ie+_FIXED_IE_LENGTH_, ielen-_FIXED_IE_LENGTH_, NULL, &wps_ielen);

	if (pwps_ie == NULL || wps_ielen == 0)
	if (!pwps_ie || wps_ielen == 0)
		return;

	wps_offset = (uint)(pwps_ie-ie);
@@ -1308,7 +1308,7 @@ static void update_bcn_wps_ie(struct adapter *padapter)
	}

	pwps_ie_src = pmlmepriv->wps_beacon_ie;
	if (pwps_ie_src == NULL)
	if (!pwps_ie_src)
		return;

	wps_ielen = (uint)pwps_ie_src[1];/* to get ie data len */
+14 −14
Original line number Diff line number Diff line
@@ -336,7 +336,7 @@ static inline void __network_hash_link(struct adapter *priv,
{
	/*  Caller must spin_lock already! */
	ent->next_hash = priv->nethash[hash];
	if (ent->next_hash != NULL)
	if (ent->next_hash)
		ent->next_hash->pprev_hash = &ent->next_hash;
	priv->nethash[hash] = ent;
	ent->pprev_hash = &priv->nethash[hash];
@@ -346,7 +346,7 @@ static inline void __network_hash_unlink(struct nat25_network_db_entry *ent)
{
	/*  Caller must spin_lock already! */
	*(ent->pprev_hash) = ent->next_hash;
	if (ent->next_hash != NULL)
	if (ent->next_hash)
		ent->next_hash->pprev_hash = ent->pprev_hash;
	ent->next_hash = NULL;
	ent->pprev_hash = NULL;
@@ -360,7 +360,7 @@ static int __nat25_db_network_lookup_and_replace(struct adapter *priv,
	spin_lock_bh(&priv->br_ext_lock);

	db = priv->nethash[__nat25_network_hash(networkAddr)];
	while (db != NULL) {
	while (db) {
		if (!memcmp(db->networkAddr, networkAddr, MAX_NETWORK_ADDR_LEN)) {
			if (!__nat25_has_expired(priv, db)) {
				/*  replace the destination mac address */
@@ -411,7 +411,7 @@ static void __nat25_db_network_insert(struct adapter *priv,
	spin_lock_bh(&priv->br_ext_lock);
	hash = __nat25_network_hash(networkAddr);
	db = priv->nethash[hash];
	while (db != NULL) {
	while (db) {
		if (!memcmp(db->networkAddr, networkAddr, MAX_NETWORK_ADDR_LEN)) {
			memcpy(db->macAddr, macAddr, ETH_ALEN);
			db->ageing_timer = jiffies;
@@ -421,7 +421,7 @@ static void __nat25_db_network_insert(struct adapter *priv,
		db = db->next_hash;
	}
	db = (struct nat25_network_db_entry *) rtw_malloc(sizeof(*db));
	if (db == NULL) {
	if (!db) {
		spin_unlock_bh(&priv->br_ext_lock);
		return;
	}
@@ -452,7 +452,7 @@ void nat25_db_cleanup(struct adapter *priv)
	for (i = 0; i < NAT25_HASH_SIZE; i++) {
		struct nat25_network_db_entry *f;
		f = priv->nethash[i];
		while (f != NULL) {
		while (f) {
			struct nat25_network_db_entry *g;

			g = f->next_hash;
@@ -479,7 +479,7 @@ void nat25_db_expire(struct adapter *priv)
		struct nat25_network_db_entry *f;
		f = priv->nethash[i];

		while (f != NULL) {
		while (f) {
			struct nat25_network_db_entry *g;
			g = f->next_hash;

@@ -506,7 +506,7 @@ int nat25_db_handle(struct adapter *priv, struct sk_buff *skb, int method)
	unsigned char networkAddr[MAX_NETWORK_ADDR_LEN];
	unsigned int tmp;

	if (skb == NULL)
	if (!skb)
		return -1;

	if ((method <= NAT25_MIN) || (method >= NAT25_MAX))
@@ -675,7 +675,7 @@ int nat25_db_handle(struct adapter *priv, struct sk_buff *skb, int method)
		}

		/*   IPX   */
		if (ipx != NULL) {
		if (ipx) {
			switch (method) {
			case NAT25_CHECK:
				if (!memcmp(skb->data+ETH_ALEN, ipx->ipx_source.node, ETH_ALEN))
@@ -732,7 +732,7 @@ int nat25_db_handle(struct adapter *priv, struct sk_buff *skb, int method)
			default:
				return -1;
			}
		} else if (ea != NULL) {
		} else if (ea) {
			/* Sanity check fields. */
			if (ea->hw_len != ETH_ALEN || ea->pa_len != AARP_PA_ALEN) {
				DEBUG_WARN("NAT25: Appletalk AARP Sanity check fail!\n");
@@ -775,7 +775,7 @@ int nat25_db_handle(struct adapter *priv, struct sk_buff *skb, int method)
			default:
				return -1;
			}
		} else if (ddp != NULL) {
		} else if (ddp) {
			switch (method) {
			case NAT25_CHECK:
				return -1;
@@ -900,7 +900,7 @@ int nat25_db_handle(struct adapter *priv, struct sk_buff *skb, int method)
					int offset = 0;

					ptr = __nat25_find_pppoe_tag(ph, ntohs(PTT_RELAY_SID));
					if (ptr == NULL) {
					if (!ptr) {
						DEBUG_ERR("Fail to find PTT_RELAY_SID in FADO!\n");
						return -1;
					}
@@ -1132,7 +1132,7 @@ struct dhcpMessage {

void dhcp_flag_bcast(struct adapter *priv, struct sk_buff *skb)
{
	if (skb == NULL)
	if (!skb)
		return;

	if (!priv->ethBrExtInfo.dhcp_bcst_disable) {
@@ -1182,7 +1182,7 @@ void *scdb_findEntry(struct adapter *priv, unsigned char *macAddr,
	__nat25_generate_ipv4_network_addr(networkAddr, (unsigned int *)ipAddr);
	hash = __nat25_network_hash(networkAddr);
	db = priv->nethash[hash];
	while (db != NULL) {
	while (db) {
		if (!memcmp(db->networkAddr, networkAddr, MAX_NETWORK_ADDR_LEN)) {
			return (void *)db;
		}
+79 −79
Original line number Diff line number Diff line
@@ -33,7 +33,7 @@ int _rtw_init_cmd_priv (struct cmd_priv *pcmdpriv)
	pcmdpriv->cmd_allocated_buf = kzalloc(MAX_CMDSZ + CMDBUFF_ALIGN_SZ,
					      GFP_KERNEL);

	if (pcmdpriv->cmd_allocated_buf == NULL) {
	if (!pcmdpriv->cmd_allocated_buf) {
		res = _FAIL;
		goto exit;
	}
@@ -42,7 +42,7 @@ int _rtw_init_cmd_priv (struct cmd_priv *pcmdpriv)

	pcmdpriv->rsp_allocated_buf = kzalloc(MAX_RSPSZ + 4, GFP_KERNEL);

	if (pcmdpriv->rsp_allocated_buf == NULL) {
	if (!pcmdpriv->rsp_allocated_buf) {
		res = _FAIL;
		goto exit;
	}
@@ -85,7 +85,7 @@ void rtw_free_evt_priv(struct evt_priv *pevtpriv)

	while (!rtw_cbuf_empty(pevtpriv->c2h_queue)) {
		void *c2h = rtw_cbuf_pop(pevtpriv->c2h_queue);
		if (c2h != NULL && c2h != (void *)pevtpriv)
		if (c2h && c2h != (void *)pevtpriv)
			kfree(c2h);
	}
	RT_TRACE(_module_rtl871x_cmd_c_, _drv_info_, ("-rtw_free_evt_priv\n"));
@@ -121,7 +121,7 @@ int _rtw_enqueue_cmd(struct __queue *queue, struct cmd_obj *obj)
{
	unsigned long flags;

	if (obj == NULL)
	if (!obj)
		goto exit;

	spin_lock_irqsave(&queue->lock, flags);
@@ -207,7 +207,7 @@ u32 rtw_enqueue_cmd(struct cmd_priv *pcmdpriv, struct cmd_obj *cmd_obj)
	int res = _FAIL;
	struct adapter *padapter = pcmdpriv->padapter;

	if (cmd_obj == NULL)
	if (!cmd_obj)
		goto exit;

	cmd_obj->padapter = padapter;
@@ -253,7 +253,7 @@ void rtw_free_cmd_obj(struct cmd_obj *pcmd)
		kfree(pcmd->parmbuf);
	}

	if (pcmd->rsp != NULL) {
	if (pcmd->rsp) {
		if (pcmd->rspsz != 0) {
			/* free rsp in cmd_obj */
			kfree(pcmd->rsp);
@@ -337,7 +337,7 @@ int rtw_cmd_thread(void *context)
		/* call callback function for post-processed */
		if (pcmd->cmdcode < ARRAY_SIZE(rtw_cmd_callback)) {
			pcmd_callback = rtw_cmd_callback[pcmd->cmdcode].callback;
			if (pcmd_callback == NULL) {
			if (!pcmd_callback) {
				RT_TRACE(_module_rtl871x_cmd_c_, _drv_info_, ("mlme_cmd_hdl(): pcmd_callback = 0x%p, cmdcode = 0x%x\n", pcmd_callback, pcmd->cmdcode));
				rtw_free_cmd_obj(pcmd);
			} else {
@@ -358,7 +358,7 @@ int rtw_cmd_thread(void *context)
	/*  free all cmd_obj resources */
	do {
		pcmd = rtw_dequeue_cmd(pcmdpriv);
		if (pcmd == NULL)
		if (!pcmd)
			break;

		/* DBG_88E("%s: leaving... drop cmdcode:%u\n", __func__, pcmd->cmdcode); */
@@ -380,13 +380,13 @@ u8 rtw_setstandby_cmd(struct adapter *padapter, uint action)
	u8 ret = _SUCCESS;

	ph2c = kzalloc(sizeof(struct cmd_obj), GFP_ATOMIC);
	if (ph2c == NULL) {
	if (!ph2c) {
		ret = _FAIL;
		goto exit;
	}

	psetusbsuspend = kzalloc(sizeof(struct usb_suspend_parm), GFP_ATOMIC);
	if (psetusbsuspend == NULL) {
	if (!psetusbsuspend) {
		kfree(ph2c);
		ret = _FAIL;
		goto exit;
@@ -426,11 +426,11 @@ u8 rtw_sitesurvey_cmd(struct adapter *padapter, struct ndis_802_11_ssid *ssid,
	}

	ph2c = kzalloc(sizeof(struct cmd_obj), GFP_ATOMIC);
	if (ph2c == NULL)
	if (!ph2c)
		return _FAIL;

	psurveyPara = kzalloc(sizeof(struct sitesurvey_parm), GFP_ATOMIC);
	if (psurveyPara == NULL) {
	if (!psurveyPara) {
		kfree(ph2c);
		return _FAIL;
	}
@@ -499,13 +499,13 @@ u8 rtw_setdatarate_cmd(struct adapter *padapter, u8 *rateset)
	u8	res = _SUCCESS;

	ph2c = kzalloc(sizeof(struct cmd_obj), GFP_ATOMIC);
	if (ph2c == NULL) {
	if (!ph2c) {
		res = _FAIL;
		goto exit;
	}

	pbsetdataratepara = kzalloc(sizeof(struct setdatarate_parm), GFP_ATOMIC);
	if (pbsetdataratepara == NULL) {
	if (!pbsetdataratepara) {
		kfree(ph2c);
		res = _FAIL;
		goto exit;
@@ -528,13 +528,13 @@ u8 rtw_setbasicrate_cmd(struct adapter *padapter, u8 *rateset)
	u8	res = _SUCCESS;

	ph2c = kzalloc(sizeof(struct cmd_obj), GFP_ATOMIC);
	if (ph2c == NULL) {
	if (!ph2c) {
		res = _FAIL;
		goto exit;
	}
	pssetbasicratepara = kzalloc(sizeof(struct setbasicrate_parm), GFP_ATOMIC);

	if (pssetbasicratepara == NULL) {
	if (!pssetbasicratepara) {
		kfree(ph2c);
		res = _FAIL;
		goto exit;
@@ -565,13 +565,13 @@ u8 rtw_setphy_cmd(struct adapter *padapter, u8 modem, u8 ch)
	u8	res = _SUCCESS;

	ph2c = kzalloc(sizeof(struct cmd_obj), GFP_ATOMIC);
	if (ph2c == NULL) {
	if (!ph2c) {
		res = _FAIL;
		goto exit;
		}
	psetphypara = kzalloc(sizeof(struct setphy_parm), GFP_ATOMIC);

	if (psetphypara == NULL) {
	if (!psetphypara) {
		kfree(ph2c);
		res = _FAIL;
		goto exit;
@@ -598,13 +598,13 @@ u8 rtw_setbbreg_cmd(struct adapter *padapter, u8 offset, u8 val)
	u8	res = _SUCCESS;

	ph2c = kzalloc(sizeof(struct cmd_obj), GFP_ATOMIC);
	if (ph2c == NULL) {
	if (!ph2c) {
		res = _FAIL;
		goto exit;
		}
	pwritebbparm = kzalloc(sizeof(struct writeBB_parm), GFP_ATOMIC);

	if (pwritebbparm == NULL) {
	if (!pwritebbparm) {
		kfree(ph2c);
		res = _FAIL;
		goto exit;
@@ -629,13 +629,13 @@ u8 rtw_getbbreg_cmd(struct adapter *padapter, u8 offset, u8 *pval)
	u8	res = _SUCCESS;

	ph2c = kzalloc(sizeof(struct cmd_obj), GFP_ATOMIC);
	if (ph2c == NULL) {
	if (!ph2c) {
		res = _FAIL;
		goto exit;
		}
	prdbbparm = kzalloc(sizeof(struct readBB_parm), GFP_ATOMIC);

	if (prdbbparm == NULL) {
	if (!prdbbparm) {
		kfree(ph2c);
		return _FAIL;
	}
@@ -663,13 +663,13 @@ u8 rtw_setrfreg_cmd(struct adapter *padapter, u8 offset, u32 val)
	u8	res = _SUCCESS;

	ph2c = kzalloc(sizeof(struct cmd_obj), GFP_ATOMIC);
	if (ph2c == NULL) {
	if (!ph2c) {
		res = _FAIL;
		goto exit;
	}
	pwriterfparm = kzalloc(sizeof(struct writeRF_parm), GFP_ATOMIC);

	if (pwriterfparm == NULL) {
	if (!pwriterfparm) {
		kfree(ph2c);
		res = _FAIL;
		goto exit;
@@ -694,13 +694,13 @@ u8 rtw_getrfreg_cmd(struct adapter *padapter, u8 offset, u8 *pval)
	u8	res = _SUCCESS;

	ph2c = kzalloc(sizeof(struct cmd_obj), GFP_ATOMIC);
	if (ph2c == NULL) {
	if (!ph2c) {
		res = _FAIL;
		goto exit;
	}

	prdrfparm = kzalloc(sizeof(struct readRF_parm), GFP_ATOMIC);
	if (prdrfparm == NULL) {
	if (!prdrfparm) {
		kfree(ph2c);
		res = _FAIL;
		goto exit;
@@ -762,7 +762,7 @@ u8 rtw_createbss_cmd(struct adapter *padapter)
		RT_TRACE(_module_rtl871x_cmd_c_, _drv_info_, (" createbss for SSid:%s\n", pmlmepriv->assoc_ssid.Ssid));

	pcmd = kzalloc(sizeof(struct cmd_obj), GFP_KERNEL);
	if (pcmd == NULL) {
	if (!pcmd) {
		res = _FAIL;
		goto exit;
	}
@@ -787,7 +787,7 @@ u8 rtw_createbss_cmd_ex(struct adapter *padapter, unsigned char *pbss, unsigned
	u8	res = _SUCCESS;

	pcmd = kzalloc(sizeof(struct cmd_obj), GFP_ATOMIC);
	if (pcmd == NULL) {
	if (!pcmd) {
		res = _FAIL;
		goto exit;
	}
@@ -831,7 +831,7 @@ u8 rtw_joinbss_cmd(struct adapter *padapter, struct wlan_network *pnetwork)
	}

	pcmd = kzalloc(sizeof(struct cmd_obj), GFP_ATOMIC);
	if (pcmd == NULL) {
	if (!pcmd) {
		res = _FAIL;
		RT_TRACE(_module_rtl871x_cmd_c_, _drv_err_, ("rtw_joinbss_cmd: memory allocate for cmd_obj fail!!!\n"));
		goto exit;
@@ -856,8 +856,8 @@ u8 rtw_joinbss_cmd(struct adapter *padapter, struct wlan_network *pnetwork)
	}

	psecnetwork = (struct wlan_bssid_ex *)&psecuritypriv->sec_bss;
	if (psecnetwork == NULL) {
		if (pcmd != NULL)
	if (!psecnetwork) {
		if (pcmd)
			kfree(pcmd);

		res = _FAIL;
@@ -954,7 +954,7 @@ u8 rtw_disassoc_cmd(struct adapter *padapter, u32 deauth_timeout_ms, bool enqueu

	/* prepare cmd parameter */
	param = kzalloc(sizeof(*param), GFP_ATOMIC);
	if (param == NULL) {
	if (!param) {
		res = _FAIL;
		goto exit;
	}
@@ -963,7 +963,7 @@ u8 rtw_disassoc_cmd(struct adapter *padapter, u32 deauth_timeout_ms, bool enqueu
	if (enqueue) {
		/* need enqueue, prepare cmd_obj and enqueue */
		cmdobj = kzalloc(sizeof(*cmdobj), GFP_ATOMIC);
		if (cmdobj == NULL) {
		if (!cmdobj) {
			res = _FAIL;
			kfree(param);
			goto exit;
@@ -991,13 +991,13 @@ u8 rtw_setopmode_cmd(struct adapter *padapter, enum ndis_802_11_network_infra n
	u8	res = _SUCCESS;

	ph2c = kzalloc(sizeof(struct cmd_obj), GFP_KERNEL);
	if (ph2c == NULL) {
	if (!ph2c) {
		res = false;
		goto exit;
	}
	psetop = kzalloc(sizeof(struct setopmode_parm), GFP_KERNEL);

	if (psetop == NULL) {
	if (!psetop) {
		kfree(ph2c);
		res = false;
		goto exit;
@@ -1026,20 +1026,20 @@ u8 rtw_setstakey_cmd(struct adapter *padapter, u8 *psta, u8 unicast_key)
	u8	res = _SUCCESS;

	ph2c = kzalloc(sizeof(struct cmd_obj), GFP_KERNEL);
	if (ph2c == NULL) {
	if (!ph2c) {
		res = _FAIL;
		goto exit;
	}

	psetstakey_para = kzalloc(sizeof(struct set_stakey_parm), GFP_KERNEL);
	if (psetstakey_para == NULL) {
	if (!psetstakey_para) {
		kfree(ph2c);
		res = _FAIL;
		goto exit;
	}

	psetstakey_rsp = kzalloc(sizeof(struct set_stakey_rsp), GFP_KERNEL);
	if (psetstakey_rsp == NULL) {
	if (!psetstakey_rsp) {
		kfree(ph2c);
		kfree(psetstakey_para);
		res = _FAIL;
@@ -1085,14 +1085,14 @@ u8 rtw_clearstakey_cmd(struct adapter *padapter, u8 *psta, u8 entry, u8 enqueue)
		clear_cam_entry(padapter, entry);
	} else {
		ph2c = kzalloc(sizeof(struct cmd_obj), GFP_ATOMIC);
		if (ph2c == NULL) {
		if (!ph2c) {
			res = _FAIL;
			goto exit;
		}

		psetstakey_para = kzalloc(sizeof(struct set_stakey_parm),
					  GFP_ATOMIC);
		if (psetstakey_para == NULL) {
		if (!psetstakey_para) {
			kfree(ph2c);
			res = _FAIL;
			goto exit;
@@ -1100,7 +1100,7 @@ u8 rtw_clearstakey_cmd(struct adapter *padapter, u8 *psta, u8 entry, u8 enqueue)

		psetstakey_rsp = kzalloc(sizeof(struct set_stakey_rsp),
					 GFP_ATOMIC);
		if (psetstakey_rsp == NULL) {
		if (!psetstakey_rsp) {
			kfree(ph2c);
			kfree(psetstakey_para);
			res = _FAIL;
@@ -1132,13 +1132,13 @@ u8 rtw_setrttbl_cmd(struct adapter *padapter, struct setratable_parm *prate_tab
	u8	res = _SUCCESS;

	ph2c = kzalloc(sizeof(struct cmd_obj), GFP_KERNEL);
	if (ph2c == NULL) {
	if (!ph2c) {
		res = _FAIL;
		goto exit;
	}
	psetrttblparm = kzalloc(sizeof(struct setratable_parm), GFP_KERNEL);

	if (psetrttblparm == NULL) {
	if (!psetrttblparm) {
		kfree(ph2c);
		res = _FAIL;
		goto exit;
@@ -1162,13 +1162,13 @@ u8 rtw_getrttbl_cmd(struct adapter *padapter, struct getratable_rsp *pval)
	u8	res = _SUCCESS;

	ph2c = kzalloc(sizeof(struct cmd_obj), GFP_KERNEL);
	if (ph2c == NULL) {
	if (!ph2c) {
		res = _FAIL;
		goto exit;
	}
	pgetrttblparm = kzalloc(sizeof(struct getratable_parm), GFP_KERNEL);

	if (pgetrttblparm == NULL) {
	if (!pgetrttblparm) {
		kfree(ph2c);
		res = _FAIL;
		goto exit;
@@ -1201,20 +1201,20 @@ u8 rtw_setassocsta_cmd(struct adapter *padapter, u8 *mac_addr)
	u8	res = _SUCCESS;

	ph2c = kzalloc(sizeof(struct cmd_obj), GFP_ATOMIC);
	if (ph2c == NULL) {
	if (!ph2c) {
		res = _FAIL;
		goto exit;
	}

	psetassocsta_para = kzalloc(sizeof(struct set_assocsta_parm), GFP_ATOMIC);
	if (psetassocsta_para == NULL) {
	if (!psetassocsta_para) {
		kfree(ph2c);
		res = _FAIL;
		goto exit;
	}

	psetassocsta_rsp = kzalloc(sizeof(struct set_assocsta_rsp), GFP_ATOMIC);
	if (psetassocsta_rsp == NULL) {
	if (!psetassocsta_rsp) {
		kfree(ph2c);
		kfree(psetassocsta_para);
		return _FAIL;
@@ -1241,13 +1241,13 @@ u8 rtw_addbareq_cmd(struct adapter *padapter, u8 tid, u8 *addr)
	u8	res = _SUCCESS;

	ph2c = kzalloc(sizeof(struct cmd_obj), GFP_ATOMIC);
	if (ph2c == NULL) {
	if (!ph2c) {
		res = _FAIL;
		goto exit;
	}

	paddbareq_parm = kzalloc(sizeof(struct addBaReq_parm), GFP_ATOMIC);
	if (paddbareq_parm == NULL) {
	if (!paddbareq_parm) {
		kfree(ph2c);
		res = _FAIL;
		goto exit;
@@ -1276,13 +1276,13 @@ u8 rtw_dynamic_chk_wk_cmd(struct adapter *padapter)
	u8	res = _SUCCESS;

	ph2c = kzalloc(sizeof(struct cmd_obj), GFP_ATOMIC);
	if (ph2c == NULL) {
	if (!ph2c) {
		res = _FAIL;
		goto exit;
	}

	pdrvextra_cmd_parm = kzalloc(sizeof(struct drvextra_cmd_parm), GFP_ATOMIC);
	if (pdrvextra_cmd_parm == NULL) {
	if (!pdrvextra_cmd_parm) {
		kfree(ph2c);
		res = _FAIL;
		goto exit;
@@ -1316,7 +1316,7 @@ u8 rtw_set_ch_cmd(struct adapter *padapter, u8 ch, u8 bw, u8 ch_offset, u8 enque

	/* prepare cmd parameter */
	set_ch_parm = kzalloc(sizeof(*set_ch_parm), GFP_ATOMIC);
	if (set_ch_parm == NULL) {
	if (!set_ch_parm) {
		res = _FAIL;
		goto exit;
	}
@@ -1327,7 +1327,7 @@ u8 rtw_set_ch_cmd(struct adapter *padapter, u8 ch, u8 bw, u8 ch_offset, u8 enque
	if (enqueue) {
		/* need enqueue, prepare cmd_obj and enqueue */
		pcmdobj = kzalloc(sizeof(struct cmd_obj), GFP_ATOMIC);
		if (pcmdobj == NULL) {
		if (!pcmdobj) {
			kfree(set_ch_parm);
			res = _FAIL;
			goto exit;
@@ -1371,7 +1371,7 @@ u8 rtw_set_chplan_cmd(struct adapter *padapter, u8 chplan, u8 enqueue)
	/* prepare cmd parameter */
	setChannelPlan_param = kzalloc(sizeof(struct SetChannelPlan_param),
				       GFP_KERNEL);
	if (setChannelPlan_param == NULL) {
	if (!setChannelPlan_param) {
		res = _FAIL;
		goto exit;
	}
@@ -1380,7 +1380,7 @@ u8 rtw_set_chplan_cmd(struct adapter *padapter, u8 chplan, u8 enqueue)
	if (enqueue) {
		/* need enqueue, prepare cmd_obj and enqueue */
		pcmdobj = kzalloc(sizeof(struct	cmd_obj), GFP_KERNEL);
		if (pcmdobj == NULL) {
		if (!pcmdobj) {
			kfree(setChannelPlan_param);
			res = _FAIL;
			goto exit;
@@ -1416,13 +1416,13 @@ u8 rtw_led_blink_cmd(struct adapter *padapter, struct LED_871x *pLed)
	RT_TRACE(_module_rtl871x_cmd_c_, _drv_notice_, ("+rtw_led_blink_cmd\n"));

	pcmdobj = kzalloc(sizeof(struct cmd_obj), GFP_ATOMIC);
	if (pcmdobj == NULL) {
	if (!pcmdobj) {
		res = _FAIL;
		goto exit;
	}

	ledBlink_param = kzalloc(sizeof(struct LedBlink_param), GFP_ATOMIC);
	if (ledBlink_param == NULL) {
	if (!ledBlink_param) {
		kfree(pcmdobj);
		res = _FAIL;
		goto exit;
@@ -1449,14 +1449,14 @@ u8 rtw_set_csa_cmd(struct adapter *padapter, u8 new_ch_no)
	RT_TRACE(_module_rtl871x_cmd_c_, _drv_notice_, ("+rtw_set_csa_cmd\n"));

	pcmdobj = kzalloc(sizeof(struct cmd_obj), GFP_ATOMIC);
	if (pcmdobj == NULL) {
	if (!pcmdobj) {
		res = _FAIL;
		goto exit;
	}

	setChannelSwitch_param = kzalloc(sizeof(struct	SetChannelSwitch_param),
					 GFP_ATOMIC);
	if (setChannelSwitch_param == NULL) {
	if (!setChannelSwitch_param) {
		kfree(pcmdobj);
		res = _FAIL;
		goto exit;
@@ -1614,14 +1614,14 @@ u8 rtw_lps_ctrl_wk_cmd(struct adapter *padapter, u8 lps_ctrl_type, u8 enqueue)

	if (enqueue) {
		ph2c = kzalloc(sizeof(struct cmd_obj), GFP_ATOMIC);
		if (ph2c == NULL) {
		if (!ph2c) {
			res = _FAIL;
			goto exit;
		}

		pdrvextra_cmd_parm = kzalloc(sizeof(struct drvextra_cmd_parm),
					     GFP_ATOMIC);
		if (pdrvextra_cmd_parm == NULL) {
		if (!pdrvextra_cmd_parm) {
			kfree(ph2c);
			res = _FAIL;
			goto exit;
@@ -1657,14 +1657,14 @@ u8 rtw_rpt_timer_cfg_cmd(struct adapter *padapter, u16 min_time)
	u8	res = _SUCCESS;

	ph2c = kzalloc(sizeof(struct cmd_obj), GFP_ATOMIC);
	if (ph2c == NULL) {
	if (!ph2c) {
		res = _FAIL;
		goto exit;
	}

	pdrvextra_cmd_parm = kzalloc(sizeof(struct drvextra_cmd_parm),
				     GFP_ATOMIC);
	if (pdrvextra_cmd_parm == NULL) {
	if (!pdrvextra_cmd_parm) {
		kfree(ph2c);
		res = _FAIL;
		goto exit;
@@ -1699,14 +1699,14 @@ u8 rtw_antenna_select_cmd(struct adapter *padapter, u8 antenna, u8 enqueue)

	if (enqueue) {
		ph2c = kzalloc(sizeof(struct cmd_obj), GFP_KERNEL);
		if (ph2c == NULL) {
		if (!ph2c) {
			res = _FAIL;
			goto exit;
		}

		pdrvextra_cmd_parm = kzalloc(sizeof(struct drvextra_cmd_parm),
					     GFP_KERNEL);
		if (pdrvextra_cmd_parm == NULL) {
		if (!pdrvextra_cmd_parm) {
			kfree(ph2c);
			res = _FAIL;
			goto exit;
@@ -1744,13 +1744,13 @@ u8 p2p_protocol_wk_cmd(struct adapter *padapter, int intCmdType)
		return res;

	ph2c = kzalloc(sizeof(struct cmd_obj), GFP_ATOMIC);
	if (ph2c == NULL) {
	if (!ph2c) {
		res = _FAIL;
		goto exit;
	}

	pdrvextra_cmd_parm = kzalloc(sizeof(struct drvextra_cmd_parm), GFP_ATOMIC);
	if (pdrvextra_cmd_parm == NULL) {
	if (!pdrvextra_cmd_parm) {
		kfree(ph2c);
		res = _FAIL;
		goto exit;
@@ -1779,13 +1779,13 @@ u8 rtw_ps_cmd(struct adapter *padapter)
	u8	res = _SUCCESS;

	ppscmd = kzalloc(sizeof(struct cmd_obj), GFP_ATOMIC);
	if (ppscmd == NULL) {
	if (!ppscmd) {
		res = _FAIL;
		goto exit;
	}

	pdrvextra_cmd_parm = kzalloc(sizeof(struct drvextra_cmd_parm), GFP_ATOMIC);
	if (pdrvextra_cmd_parm == NULL) {
	if (!pdrvextra_cmd_parm) {
		kfree(ppscmd);
		res = _FAIL;
		goto exit;
@@ -1852,13 +1852,13 @@ u8 rtw_chk_hi_queue_cmd(struct adapter *padapter)
	u8	res = _SUCCESS;

	ph2c = kzalloc(sizeof(struct cmd_obj), GFP_ATOMIC);
	if (ph2c == NULL) {
	if (!ph2c) {
		res = _FAIL;
		goto exit;
	}

	pdrvextra_cmd_parm = kzalloc(sizeof(struct drvextra_cmd_parm), GFP_ATOMIC);
	if (pdrvextra_cmd_parm == NULL) {
	if (!pdrvextra_cmd_parm) {
		kfree(ph2c);
		res = _FAIL;
		goto exit;
@@ -1884,13 +1884,13 @@ u8 rtw_c2h_wk_cmd(struct adapter *padapter, u8 *c2h_evt)
	u8	res = _SUCCESS;

	ph2c = kzalloc(sizeof(struct cmd_obj), GFP_ATOMIC);
	if (ph2c == NULL) {
	if (!ph2c) {
		res = _FAIL;
		goto exit;
	}

	pdrvextra_cmd_parm = kzalloc(sizeof(struct drvextra_cmd_parm), GFP_ATOMIC);
	if (pdrvextra_cmd_parm == NULL) {
	if (!pdrvextra_cmd_parm) {
		kfree(ph2c);
		res = _FAIL;
		goto exit;
@@ -2103,7 +2103,7 @@ void rtw_createbss_cmd_callback(struct adapter *padapter, struct cmd_obj *pcmd)
		psta = rtw_get_stainfo(&padapter->stapriv, pnetwork->MacAddress);
		if (!psta) {
			psta = rtw_alloc_stainfo(&padapter->stapriv, pnetwork->MacAddress);
			if (psta == NULL) {
			if (!psta) {
				RT_TRACE(_module_rtl871x_cmd_c_, _drv_err_, ("\nCan't alloc sta_info when createbss_cmd_callback\n"));
				goto createbss_cmd_fail ;
			}
@@ -2114,9 +2114,9 @@ void rtw_createbss_cmd_callback(struct adapter *padapter, struct cmd_obj *pcmd)

		pwlan = _rtw_alloc_network(pmlmepriv);
		spin_lock_bh(&(pmlmepriv->scanned_queue.lock));
		if (pwlan == NULL) {
		if (!pwlan) {
			pwlan = rtw_get_oldest_wlan_network(&pmlmepriv->scanned_queue);
			if (pwlan == NULL) {
			if (!pwlan) {
				RT_TRACE(_module_rtl871x_cmd_c_, _drv_err_, ("\n Error:  can't get pwlan in rtw_joinbss_event_callback\n"));
				spin_unlock_bh(&(pmlmepriv->scanned_queue.lock));
				goto createbss_cmd_fail;
@@ -2151,7 +2151,7 @@ void rtw_setstaKey_cmdrsp_callback(struct adapter *padapter, struct cmd_obj *pc
	struct set_stakey_rsp *psetstakey_rsp = (struct set_stakey_rsp *)(pcmd->rsp);
	struct sta_info *psta = rtw_get_stainfo(pstapriv, psetstakey_rsp->addr);

	if (psta == NULL) {
	if (!psta) {
		RT_TRACE(_module_rtl871x_cmd_c_, _drv_err_, ("\nERROR: rtw_setstaKey_cmdrsp_callback => can't get sta_info\n\n"));
		goto exit;
	}
@@ -2168,7 +2168,7 @@ void rtw_setassocsta_cmdrsp_callback(struct adapter *padapter, struct cmd_obj *
	struct set_assocsta_rsp *passocsta_rsp = (struct set_assocsta_rsp *)(pcmd->rsp);
	struct sta_info *psta = rtw_get_stainfo(pstapriv, passocsta_parm->addr);

	if (psta == NULL) {
	if (!psta) {
		RT_TRACE(_module_rtl871x_cmd_c_, _drv_err_, ("\nERROR: setassocsta_cmdrsp_callbac => can't get sta_info\n\n"));
		goto exit;
	}
+2 −2
Original line number Diff line number Diff line
@@ -534,7 +534,7 @@ u8 rtw_efuse_map_write(struct adapter *padapter, u16 addr, u16 cnts, u8 *data)
		return _FAIL;

	map = rtw_zmalloc(mapLen);
	if (map == NULL)
	if (!map)
		return _FAIL;

	ret = rtw_efuse_map_read(padapter, 0, mapLen, map);
@@ -626,7 +626,7 @@ u8 rtw_BT_efuse_map_write(struct adapter *padapter, u16 addr, u16 cnts, u8 *data
		return _FAIL;

	map = rtw_zmalloc(mapLen);
	if (map == NULL)
	if (!map)
		return _FAIL;

	ret = rtw_BT_efuse_map_read(padapter, 0, mapLen, map);
+5 −5
Original line number Diff line number Diff line
@@ -705,7 +705,7 @@ u8 rtw_is_wps_ie(u8 *ie_ptr, uint *wps_ielen)
	u8 match = false;
	u8 eid, wps_oui[4] = {0x0, 0x50, 0xf2, 0x04};

	if (ie_ptr == NULL)
	if (!ie_ptr)
		return match;

	eid = ie_ptr[0];
@@ -1075,7 +1075,7 @@ u8 key_2char2num(u8 hch, u8 lch)
void rtw_macaddr_cfg(u8 *mac_addr)
{
	u8 mac[ETH_ALEN];
	if (mac_addr == NULL)
	if (!mac_addr)
		return;

	if (rtw_initmac) {	/* Users specify the mac address */
@@ -1183,7 +1183,7 @@ u8 *rtw_get_p2p_ie(u8 *in_ie, int in_len, u8 *p2p_ie, uint *p2p_ielen)
	u8 *p2p_ie_ptr;
	u8 eid, p2p_oui[4] = {0x50, 0x6F, 0x9A, 0x09};

	if (p2p_ielen != NULL)
	if (p2p_ielen)
		*p2p_ielen = 0;

	while (cnt < in_len) {
@@ -1195,9 +1195,9 @@ u8 *rtw_get_p2p_ie(u8 *in_ie, int in_len, u8 *p2p_ie, uint *p2p_ielen)
		if ((eid == _VENDOR_SPECIFIC_IE_) && !memcmp(&in_ie[cnt+2], p2p_oui, 4)) {
			p2p_ie_ptr = in_ie + cnt;

			if (p2p_ie != NULL)
			if (p2p_ie)
				memcpy(p2p_ie, &in_ie[cnt], in_ie[cnt + 1] + 2);
			if (p2p_ielen != NULL)
			if (p2p_ielen)
				*p2p_ielen = in_ie[cnt + 1] + 2;
			return p2p_ie_ptr;
		} else {
Loading