Staging: rtl8188eu: ioctl_linux: Clean up if function returned NULL on failure.
Clean some all functions to return NULL on failure. Used !x instead of x==NULL. Signed-off-by: Amit Ghadge <amitg.b14@gmail.com> Signed-off-by: Greg Kroah-Hartman <gregkh@linuxfoundation.org>
This commit is contained in:
parent
ec65ef8e8a
commit
4fe514dc20
|
@ -403,7 +403,7 @@ static int wpa_set_encryption(struct net_device *dev, struct ieee_param *param,
|
|||
wep_key_len = wep_key_len <= 5 ? 5 : 13;
|
||||
wep_total_len = wep_key_len + offsetof(struct ndis_802_11_wep, KeyMaterial);
|
||||
pwep = (struct ndis_802_11_wep *)rtw_malloc(wep_total_len);
|
||||
if (pwep == NULL) {
|
||||
if (!pwep) {
|
||||
RT_TRACE(_module_rtl871x_ioctl_os_c, _drv_err_, (" wpa_set_encryption: pwep allocate fail !!!\n"));
|
||||
goto exit;
|
||||
}
|
||||
|
@ -444,7 +444,7 @@ static int wpa_set_encryption(struct net_device *dev, struct ieee_param *param,
|
|||
|
||||
if (check_fwstate(pmlmepriv, WIFI_STATION_STATE | WIFI_MP_STATE)) { /* sta mode */
|
||||
psta = rtw_get_stainfo(pstapriv, get_bssid(pmlmepriv));
|
||||
if (psta == NULL) {
|
||||
if (!psta) {
|
||||
;
|
||||
} else {
|
||||
if (strcmp(param->u.crypt.alg, "none") != 0)
|
||||
|
@ -479,7 +479,7 @@ static int wpa_set_encryption(struct net_device *dev, struct ieee_param *param,
|
|||
}
|
||||
}
|
||||
pbcmc_sta = rtw_get_bcmc_stainfo(padapter);
|
||||
if (pbcmc_sta == NULL) {
|
||||
if (!pbcmc_sta) {
|
||||
;
|
||||
} else {
|
||||
/* Jeff: don't disable ieee8021x_blocked while clearing key */
|
||||
|
@ -505,9 +505,9 @@ static int rtw_set_wpa_ie(struct adapter *padapter, char *pie, unsigned short ie
|
|||
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)) {
|
||||
_clr_fwstate_(&padapter->mlmepriv, WIFI_UNDER_WPS);
|
||||
if (pie == NULL)
|
||||
if (!pie)
|
||||
return ret;
|
||||
else
|
||||
return -EINVAL;
|
||||
|
@ -515,7 +515,7 @@ static int rtw_set_wpa_ie(struct adapter *padapter, char *pie, unsigned short ie
|
|||
|
||||
if (ielen) {
|
||||
buf = kmemdup(pie, ielen, GFP_KERNEL);
|
||||
if (buf == NULL) {
|
||||
if (!buf) {
|
||||
ret = -ENOMEM;
|
||||
goto exit;
|
||||
}
|
||||
|
@ -1052,7 +1052,7 @@ static int rtw_wx_set_mlme(struct net_device *dev,
|
|||
struct adapter *padapter = (struct adapter *)rtw_netdev_priv(dev);
|
||||
struct iw_mlme *mlme = (struct iw_mlme *)extra;
|
||||
|
||||
if (mlme == NULL)
|
||||
if (!mlme)
|
||||
return -1;
|
||||
|
||||
DBG_88E("%s\n", __func__);
|
||||
|
@ -1899,7 +1899,7 @@ static int rtw_wx_set_enc_ext(struct net_device *dev,
|
|||
|
||||
param_len = sizeof(struct ieee_param) + pext->key_len;
|
||||
param = (struct ieee_param *)rtw_malloc(param_len);
|
||||
if (param == NULL)
|
||||
if (!param)
|
||||
return -1;
|
||||
|
||||
memset(param, 0, param_len);
|
||||
|
@ -2064,7 +2064,7 @@ static int wpa_supplicant_ioctl(struct net_device *dev, struct iw_point *p)
|
|||
}
|
||||
|
||||
param = (struct ieee_param *)rtw_malloc(p->length);
|
||||
if (param == NULL) {
|
||||
if (!param) {
|
||||
ret = -ENOMEM;
|
||||
goto out;
|
||||
}
|
||||
|
@ -2257,13 +2257,13 @@ static int rtw_set_encryption(struct net_device *dev, struct ieee_param *param,
|
|||
}
|
||||
}
|
||||
|
||||
if (strcmp(param->u.crypt.alg, "none") == 0 && (psta == NULL)) {
|
||||
if (strcmp(param->u.crypt.alg, "none") == 0 && (!psta)) {
|
||||
/* todo:clear default encryption keys */
|
||||
|
||||
DBG_88E("clear default encryption keys, keyid =%d\n", param->u.crypt.idx);
|
||||
goto exit;
|
||||
}
|
||||
if (strcmp(param->u.crypt.alg, "WEP") == 0 && (psta == NULL)) {
|
||||
if (strcmp(param->u.crypt.alg, "WEP") == 0 && (!psta)) {
|
||||
DBG_88E("r871x_set_encryption, crypt.alg = WEP\n");
|
||||
wep_key_idx = param->u.crypt.idx;
|
||||
wep_key_len = param->u.crypt.key_len;
|
||||
|
@ -2277,7 +2277,7 @@ static int rtw_set_encryption(struct net_device *dev, struct ieee_param *param,
|
|||
wep_key_len = wep_key_len <= 5 ? 5 : 13;
|
||||
wep_total_len = wep_key_len + offsetof(struct ndis_802_11_wep, KeyMaterial);
|
||||
pwep = (struct ndis_802_11_wep *)rtw_malloc(wep_total_len);
|
||||
if (pwep == NULL) {
|
||||
if (!pwep) {
|
||||
DBG_88E(" r871x_set_encryption: pwep allocate fail !!!\n");
|
||||
goto exit;
|
||||
}
|
||||
|
@ -2704,7 +2704,7 @@ static int rtw_set_wps_beacon(struct net_device *dev, struct ieee_param *param,
|
|||
if (ie_len > 0) {
|
||||
pmlmepriv->wps_beacon_ie = rtw_malloc(ie_len);
|
||||
pmlmepriv->wps_beacon_ie_len = ie_len;
|
||||
if (pmlmepriv->wps_beacon_ie == NULL) {
|
||||
if (!pmlmepriv->wps_beacon_ie) {
|
||||
DBG_88E("%s()-%d: rtw_malloc() ERROR!\n", __func__, __LINE__);
|
||||
return -EINVAL;
|
||||
}
|
||||
|
@ -2739,7 +2739,7 @@ static int rtw_set_wps_probe_resp(struct net_device *dev, struct ieee_param *par
|
|||
if (ie_len > 0) {
|
||||
pmlmepriv->wps_probe_resp_ie = rtw_malloc(ie_len);
|
||||
pmlmepriv->wps_probe_resp_ie_len = ie_len;
|
||||
if (pmlmepriv->wps_probe_resp_ie == NULL) {
|
||||
if (!pmlmepriv->wps_probe_resp_ie) {
|
||||
DBG_88E("%s()-%d: rtw_malloc() ERROR!\n", __func__, __LINE__);
|
||||
return -EINVAL;
|
||||
}
|
||||
|
@ -2769,7 +2769,7 @@ static int rtw_set_wps_assoc_resp(struct net_device *dev, struct ieee_param *par
|
|||
if (ie_len > 0) {
|
||||
pmlmepriv->wps_assoc_resp_ie = rtw_malloc(ie_len);
|
||||
pmlmepriv->wps_assoc_resp_ie_len = ie_len;
|
||||
if (pmlmepriv->wps_assoc_resp_ie == NULL) {
|
||||
if (!pmlmepriv->wps_assoc_resp_ie) {
|
||||
DBG_88E("%s()-%d: rtw_malloc() ERROR!\n", __func__, __LINE__);
|
||||
return -EINVAL;
|
||||
}
|
||||
|
@ -2871,7 +2871,7 @@ static int rtw_hostapd_ioctl(struct net_device *dev, struct iw_point *p)
|
|||
}
|
||||
|
||||
param = (struct ieee_param *)rtw_malloc(p->length);
|
||||
if (param == NULL) {
|
||||
if (!param) {
|
||||
ret = -ENOMEM;
|
||||
goto out;
|
||||
}
|
||||
|
@ -2981,7 +2981,7 @@ static int rtw_wx_set_priv(struct net_device *dev,
|
|||
pmlmepriv->wps_probe_req_ie = NULL;
|
||||
|
||||
pmlmepriv->wps_probe_req_ie = rtw_malloc(cp_sz);
|
||||
if (pmlmepriv->wps_probe_req_ie == NULL) {
|
||||
if (!pmlmepriv->wps_probe_req_ie) {
|
||||
pr_info("%s()-%d: rtw_malloc() ERROR!\n", __func__, __LINE__);
|
||||
ret = -EINVAL;
|
||||
goto FREE_EXT;
|
||||
|
|
Loading…
Reference in a new issue