staging: ks7010: refactor ks_wlan_set_wps_enable function
authorSergio Paracuellos <sergio.paracuellos@gmail.com>
Thu, 19 Apr 2018 05:08:02 +0000 (07:08 +0200)
committerGreg Kroah-Hartman <gregkh@linuxfoundation.org>
Mon, 23 Apr 2018 12:32:05 +0000 (14:32 +0200)
This commit refactors ks_wlan_set_wps_enable function to
improve readability handling the error first to avoid an
'else'.

Signed-off-by: Sergio Paracuellos <sergio.paracuellos@gmail.com>
Signed-off-by: Greg Kroah-Hartman <gregkh@linuxfoundation.org>
drivers/staging/ks7010/ks_wlan_net.c

index 81889a5..74946e9 100644 (file)
@@ -2224,11 +2224,10 @@ static int ks_wlan_set_wps_enable(struct net_device *dev,
        if (priv->sleep_mode == SLP_SLEEP)
                return -EPERM;
        /* for SLEEP MODE */
-       if (*uwrq == 0 || *uwrq == 1)
-               priv->wps.wps_enabled = *uwrq;
-       else
+       if (*uwrq != 0 && *uwrq != 1)
                return -EINVAL;
 
+       priv->wps.wps_enabled = *uwrq;
        hostif_sme_enqueue(priv, SME_WPS_ENABLE_REQUEST);
 
        return 0;