From: Sergio Paracuellos Date: Thu, 19 Apr 2018 05:08:02 +0000 (+0200) Subject: staging: ks7010: refactor ks_wlan_set_wps_enable function X-Git-Url: http://git.maquefel.me/?a=commitdiff_plain;h=6519967b959b2b412b6d6012f251a9d80e1f920c;p=linux.git staging: ks7010: refactor ks_wlan_set_wps_enable function 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 Signed-off-by: Greg Kroah-Hartman --- diff --git a/drivers/staging/ks7010/ks_wlan_net.c b/drivers/staging/ks7010/ks_wlan_net.c index 81889a5b22512..74946e964a255 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;