diff options
author | Sergio Paracuellos <sergio.paracuellos@gmail.com> | 2018-04-25 16:01:41 +0200 |
---|---|---|
committer | Greg Kroah-Hartman <gregkh@linuxfoundation.org> | 2018-04-26 09:17:34 +0200 |
commit | 25ee63eb2da2a908685c8318b891054accfc6d0d (patch) | |
tree | ac62686eba815f5966334bed4ff358bb434f842a /drivers/staging/ks7010 | |
parent | ad9bd58c2adf6c4faf5e62bf7479d2d30c183bc6 (diff) |
staging: ks7010: refactor ks_wlan_set_beacon_lost function
Change if condition to handle invalid value first and
avoid nonsense else's path improving readability.
Signed-off-by: Sergio Paracuellos <sergio.paracuellos@gmail.com>
Signed-off-by: Greg Kroah-Hartman <gregkh@linuxfoundation.org>
Diffstat (limited to 'drivers/staging/ks7010')
-rw-r--r-- | drivers/staging/ks7010/ks_wlan_net.c | 10 |
1 files changed, 5 insertions, 5 deletions
diff --git a/drivers/staging/ks7010/ks_wlan_net.c b/drivers/staging/ks7010/ks_wlan_net.c index aaa57c263002..e2e72cd7e457 100644 --- a/drivers/staging/ks7010/ks_wlan_net.c +++ b/drivers/staging/ks7010/ks_wlan_net.c @@ -1973,17 +1973,17 @@ static int ks_wlan_set_beacon_lost(struct net_device *dev, if (priv->sleep_mode == SLP_SLEEP) return -EPERM; /* for SLEEP MODE */ - if (*uwrq >= BEACON_LOST_COUNT_MIN && *uwrq <= BEACON_LOST_COUNT_MAX) - priv->reg.beacon_lost_count = *uwrq; - else + if (*uwrq < BEACON_LOST_COUNT_MIN || *uwrq > BEACON_LOST_COUNT_MAX) return -EINVAL; + priv->reg.beacon_lost_count = *uwrq; + if (priv->reg.operation_mode == MODE_INFRASTRUCTURE) { priv->need_commit |= SME_MODE_SET; return -EINPROGRESS; /* Call commit handler */ - } else { - return 0; } + + return 0; } static int ks_wlan_get_beacon_lost(struct net_device *dev, |