diff options
author | Tobin C. Harding <me@tobin.cc> | 2017-04-10 13:15:48 +1000 |
---|---|---|
committer | Greg Kroah-Hartman <gregkh@linuxfoundation.org> | 2017-04-11 16:05:50 +0200 |
commit | dc59ef2af26de72289b5ac576298445c676f2c5b (patch) | |
tree | 6583e4990660a614852ce7ae84aae0579f609bd1 /drivers/staging/ks7010 | |
parent | 2ab6fd596317c89b96f0cfd8811f12dd047bbd9e (diff) |
staging: ks7010: fix multi-way decision
Multi-way decision contains two anomalies.
Firstly, a local variable is defined to be the inverse truth variable
of a struct member. This local variable is used as the conditional to
the multi-way decision. This is unnecessary, the same logic can be
expressed using the struct member directly.
Secondly, there are four branches in the multi-way decision, two of
which can never be executed. This is dead code.
Remove unnecessary local variable. Remove two branches of multi-way
decision statement that can never be executed.
Signed-off-by: Tobin C. Harding <me@tobin.cc>
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 | 14 |
1 files changed, 2 insertions, 12 deletions
diff --git a/drivers/staging/ks7010/ks_wlan_net.c b/drivers/staging/ks7010/ks_wlan_net.c index e86e5e2b6d5c..89fcd23e8f94 100644 --- a/drivers/staging/ks7010/ks_wlan_net.c +++ b/drivers/staging/ks7010/ks_wlan_net.c @@ -1199,27 +1199,17 @@ static int ks_wlan_set_power(struct net_device *dev, { struct ks_wlan_private *priv = (struct ks_wlan_private *)netdev_priv(dev); - short enabled; if (priv->sleep_mode == SLP_SLEEP) return -EPERM; - /* for SLEEP MODE */ - enabled = vwrq->disabled ? 0 : 1; - if (enabled == 0) { /* 0 */ + if (vwrq->disabled) { priv->reg.powermgt = POWMGT_ACTIVE_MODE; - } else if (enabled) { /* 1 */ + } else { if (priv->reg.operation_mode == MODE_INFRASTRUCTURE) priv->reg.powermgt = POWMGT_SAVE1_MODE; else return -EINVAL; - } else if (enabled) { /* 2 */ - if (priv->reg.operation_mode == MODE_INFRASTRUCTURE) - priv->reg.powermgt = POWMGT_SAVE2_MODE; - else - return -EINVAL; - } else { - return -EINVAL; } hostif_sme_enqueue(priv, SME_POW_MNGMT_REQUEST); |