OSDN Git Service

staging: rtl8188eu: Remove some unneeded goto statements
authorLarry Finger <Larry.Finger@lwfinger.net>
Mon, 10 Feb 2020 18:02:34 +0000 (12:02 -0600)
committerGreg Kroah-Hartman <gregkh@linuxfoundation.org>
Mon, 10 Feb 2020 18:32:38 +0000 (10:32 -0800)
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-6-Larry.Finger@lwfinger.net
Signed-off-by: Greg Kroah-Hartman <gregkh@linuxfoundation.org>
drivers/staging/rtl8188eu/os_dep/ioctl_linux.c

index acca3ae..ba53959 100644 (file)
@@ -2009,21 +2009,16 @@ static int wpa_supplicant_ioctl(struct net_device *dev, struct iw_point *p)
        struct ieee_param *param;
        uint ret = 0;
 
-       if (!p->pointer || p->length != sizeof(struct ieee_param)) {
-               ret = -EINVAL;
-               goto out;
-       }
+       if (!p->pointer || p->length != sizeof(struct ieee_param))
+               return -EINVAL;
 
        param = (struct ieee_param *)rtw_malloc(p->length);
-       if (!param) {
-               ret = -ENOMEM;
-               goto out;
-       }
+       if (!param)
+               return -ENOMEM;
 
        if (copy_from_user(param, p->pointer, p->length)) {
                kfree(param);
-               ret = -EFAULT;
-               goto out;
+               return -EFAULT;
        }
 
        switch (param->cmd) {
@@ -2054,9 +2049,6 @@ static int wpa_supplicant_ioctl(struct net_device *dev, struct iw_point *p)
                ret = -EFAULT;
 
        kfree(param);
-
-out:
-
        return ret;
 }
 
@@ -2791,26 +2783,19 @@ static int rtw_hostapd_ioctl(struct net_device *dev, struct iw_point *p)
        * so, we just check hw_init_completed
        */
 
-       if (!padapter->hw_init_completed) {
-               ret = -EPERM;
-               goto out;
-       }
+       if (!padapter->hw_init_completed)
+               return -EPERM;
 
-       if (!p->pointer || p->length != sizeof(struct ieee_param)) {
-               ret = -EINVAL;
-               goto out;
-       }
+       if (!p->pointer || p->length != sizeof(struct ieee_param))
+               return -EINVAL;
 
        param = (struct ieee_param *)rtw_malloc(p->length);
-       if (!param) {
-               ret = -ENOMEM;
-               goto out;
-       }
+       if (!param)
+               return -ENOMEM;
 
        if (copy_from_user(param, p->pointer, p->length)) {
                kfree(param);
-               ret = -EFAULT;
-               goto out;
+               return -EFAULT;
        }
 
        switch (param->cmd) {
@@ -2865,7 +2850,6 @@ static int rtw_hostapd_ioctl(struct net_device *dev, struct iw_point *p)
        if (ret == 0 && copy_to_user(p->pointer, param, p->length))
                ret = -EFAULT;
        kfree(param);
-out:
        return ret;
 }
 #endif