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 81889a5b2251253997829900fe80a28c088ce7f2..74946e964a255163bcda5112cf39e13e07e9377b 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;