Multi-way decision contains two branches that can never be
executed. Statement starts with a convoluted variable assignment
('enabled') then branches on the value of this variable. Variable can
only take values 0 or 1, this variable is unnecessary.

Remove unnecessary variable. Remove two branches of multi-way
statement that can never be executed.

Signed-off-by: Tobin C. Harding <m...@tobin.cc>
---
 drivers/staging/ks7010/ks_wlan_net.c | 14 ++------------
 1 file changed, 2 insertions(+), 12 deletions(-)

diff --git a/drivers/staging/ks7010/ks_wlan_net.c 
b/drivers/staging/ks7010/ks_wlan_net.c
index 5e68699..dc89c16 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);
-- 
2.7.4

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

Reply via email to