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

staging: rtl8712: clean up comparsions to NULL



Clean up comparsions to NULL Reported by checkpatch.
if (x == NULL) -> if (!x)
if (x != NULL) -> if (x)

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


Signed-off-by: default avatarGreg Kroah-Hartman <gregkh@linuxfoundation.org>
parent dbbc8fdf
Loading
Loading
Loading
Loading
+2 −2
Original line number Diff line number Diff line
@@ -161,7 +161,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);
	}
@@ -191,7 +191,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);
	}
+1 −1
Original line number Diff line number Diff line
@@ -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);
+8 −8
Original line number Diff line number Diff line
@@ -481,11 +481,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;
@@ -777,7 +777,7 @@ static int r871x_wx_set_pmkid(struct net_device *dev,
 *	If cmd is IW_PMKSA_REMOVE, it means the wpa_supplicant wants to
 *	remove a PMKID/BSSID from driver.
 */
	if (pPMK == NULL)
	if (!pPMK)
		return -EINVAL;
	memcpy(strIssueBssid, pPMK->bssid.sa_data, ETH_ALEN);
	switch (pPMK->cmd) {
@@ -1099,7 +1099,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:
@@ -1950,7 +1950,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)) {
@@ -2014,7 +2014,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;
@@ -2030,7 +2030,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;
	}
@@ -2050,7 +2050,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;
+5 −6
Original line number Diff line number Diff line
@@ -754,7 +754,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 ^=
@@ -768,7 +768,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);
@@ -879,7 +879,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)
@@ -888,7 +888,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;
@@ -1080,8 +1080,7 @@ int r8712_select_and_join_from_scan(struct mlme_priv *pmlmepriv)
	pmlmepriv->pscanned = phead->next;
	while (1) {
		if (end_of_queue_search(phead, pmlmepriv->pscanned)) {
			if ((pmlmepriv->assoc_by_rssi) &&
			    (pnetwork_max_rssi != NULL)) {
			if (pmlmepriv->assoc_by_rssi && pnetwork_max_rssi) {
				pnetwork = pnetwork_max_rssi;
				goto ask_for_joinbss;
			}
+1 −1
Original line number Diff line number Diff line
@@ -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 = -ENOMEM;
		goto end_of_mp_start_test;
	}
Loading