forked from Minki/linux
staging: rtl8723bs: Remove unneeded goto statements
In routines rtw_hostapd_ioctl() and wpa_supplicant_ioctl(), several error conditions involve setting a variable indicating the error, followed by a goto. The code following the target of that goto merely returns the value. It is simpler, therefore to return the error value immediately, and eliminate the got target. Signed-off-by: Larry Finger <Larry.Finger@lwfinger.net> Cc: Pietro Oliva <pietroliva@gmail.com> Link: https://lore.kernel.org/r/20200210180235.21691-7-Larry.Finger@lwfinger.net Signed-off-by: Greg Kroah-Hartman <gregkh@linuxfoundation.org>
This commit is contained in:
parent
e40c6d0f87
commit
9a4556bd8f
|
@ -3373,21 +3373,16 @@ static int wpa_supplicant_ioctl(struct net_device *dev, struct iw_point *p)
|
||||||
|
|
||||||
/* down(&ieee->wx_sem); */
|
/* down(&ieee->wx_sem); */
|
||||||
|
|
||||||
if (!p->pointer || p->length != sizeof(struct ieee_param)) {
|
if (!p->pointer || p->length != sizeof(struct ieee_param))
|
||||||
ret = -EINVAL;
|
return -EINVAL;
|
||||||
goto out;
|
|
||||||
}
|
|
||||||
|
|
||||||
param = rtw_malloc(p->length);
|
param = rtw_malloc(p->length);
|
||||||
if (param == NULL) {
|
if (param == NULL)
|
||||||
ret = -ENOMEM;
|
return -ENOMEM;
|
||||||
goto out;
|
|
||||||
}
|
|
||||||
|
|
||||||
if (copy_from_user(param, p->pointer, p->length)) {
|
if (copy_from_user(param, p->pointer, p->length)) {
|
||||||
kfree(param);
|
kfree(param);
|
||||||
ret = -EFAULT;
|
return -EFAULT;
|
||||||
goto out;
|
|
||||||
}
|
}
|
||||||
|
|
||||||
switch (param->cmd) {
|
switch (param->cmd) {
|
||||||
|
@ -3421,12 +3416,8 @@ static int wpa_supplicant_ioctl(struct net_device *dev, struct iw_point *p)
|
||||||
|
|
||||||
kfree(param);
|
kfree(param);
|
||||||
|
|
||||||
out:
|
|
||||||
|
|
||||||
/* up(&ieee->wx_sem); */
|
/* up(&ieee->wx_sem); */
|
||||||
|
|
||||||
return ret;
|
return ret;
|
||||||
|
|
||||||
}
|
}
|
||||||
|
|
||||||
static int rtw_set_encryption(struct net_device *dev, struct ieee_param *param, u32 param_len)
|
static int rtw_set_encryption(struct net_device *dev, struct ieee_param *param, u32 param_len)
|
||||||
|
@ -4200,28 +4191,19 @@ static int rtw_hostapd_ioctl(struct net_device *dev, struct iw_point *p)
|
||||||
* so, we just check hw_init_completed
|
* so, we just check hw_init_completed
|
||||||
*/
|
*/
|
||||||
|
|
||||||
if (!padapter->hw_init_completed) {
|
if (!padapter->hw_init_completed)
|
||||||
ret = -EPERM;
|
return -EPERM;
|
||||||
goto out;
|
|
||||||
}
|
|
||||||
|
|
||||||
|
if (!p->pointer || p->length != sizeof(*param))
|
||||||
/* if (p->length < sizeof(struct ieee_param) || !p->pointer) { */
|
return -EINVAL;
|
||||||
if (!p->pointer || p->length != sizeof(*param)) {
|
|
||||||
ret = -EINVAL;
|
|
||||||
goto out;
|
|
||||||
}
|
|
||||||
|
|
||||||
param = rtw_malloc(p->length);
|
param = rtw_malloc(p->length);
|
||||||
if (param == NULL) {
|
if (param == NULL)
|
||||||
ret = -ENOMEM;
|
return -ENOMEM;
|
||||||
goto out;
|
|
||||||
}
|
|
||||||
|
|
||||||
if (copy_from_user(param, p->pointer, p->length)) {
|
if (copy_from_user(param, p->pointer, p->length)) {
|
||||||
kfree(param);
|
kfree(param);
|
||||||
ret = -EFAULT;
|
return -EFAULT;
|
||||||
goto out;
|
|
||||||
}
|
}
|
||||||
|
|
||||||
/* DBG_871X("%s, cmd =%d\n", __func__, param->cmd); */
|
/* DBG_871X("%s, cmd =%d\n", __func__, param->cmd); */
|
||||||
|
@ -4321,13 +4303,8 @@ static int rtw_hostapd_ioctl(struct net_device *dev, struct iw_point *p)
|
||||||
if (ret == 0 && copy_to_user(p->pointer, param, p->length))
|
if (ret == 0 && copy_to_user(p->pointer, param, p->length))
|
||||||
ret = -EFAULT;
|
ret = -EFAULT;
|
||||||
|
|
||||||
|
|
||||||
kfree(param);
|
kfree(param);
|
||||||
|
|
||||||
out:
|
|
||||||
|
|
||||||
return ret;
|
return ret;
|
||||||
|
|
||||||
}
|
}
|
||||||
|
|
||||||
static int rtw_wx_set_priv(struct net_device *dev,
|
static int rtw_wx_set_priv(struct net_device *dev,
|
||||||
|
|
Loading…
Reference in New Issue
Block a user