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.paracuel...@gmail.com>
---
 drivers/staging/ks7010/ks_wlan_net.c | 5 ++---
 1 file changed, 2 insertions(+), 3 deletions(-)

diff --git a/drivers/staging/ks7010/ks_wlan_net.c 
b/drivers/staging/ks7010/ks_wlan_net.c
index c5d176e..9771e6b 100644
--- a/drivers/staging/ks7010/ks_wlan_net.c
+++ b/drivers/staging/ks7010/ks_wlan_net.c
@@ -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;
-- 
2.7.4

_______________________________________________
devel mailing list
de...@linuxdriverproject.org
http://driverdev.linuxdriverproject.org/mailman/listinfo/driverdev-devel

Reply via email to