staging: ks7010: avoid an 'else' in ks_wlan_set_power
authorSergio Paracuellos <sergio.paracuellos@gmail.com>
Wed, 25 Apr 2018 14:01:51 +0000 (16:01 +0200)
committerGreg Kroah-Hartman <gregkh@linuxfoundation.org>
Thu, 26 Apr 2018 07:35:04 +0000 (09:35 +0200)
Change if logic to handle invalid case for operation_mode
at first avoiding an 'else' path.

Signed-off-by: Sergio Paracuellos <sergio.paracuellos@gmail.com>
Signed-off-by: Greg Kroah-Hartman <gregkh@linuxfoundation.org>
drivers/staging/ks7010/ks_wlan_net.c

index 45f850a20ed69f1a3cd6c51ca6b54c30a5e2bcc4..9d79af9eefc88cd9a6dd75e935cbee2b58e8ac01 100644 (file)
@@ -1045,10 +1045,9 @@ static int ks_wlan_set_power(struct net_device *dev,
        if (vwrq->power.disabled) {
                priv->reg.power_mgmt = POWER_MGMT_ACTIVE;
        } else {
-               if (priv->reg.operation_mode == MODE_INFRASTRUCTURE)
-                       priv->reg.power_mgmt = POWER_MGMT_SAVE1;
-               else
+               if (priv->reg.operation_mode != MODE_INFRASTRUCTURE)
                        return -EINVAL;
+               priv->reg.power_mgmt = POWER_MGMT_SAVE1;
        }
 
        hostif_sme_enqueue(priv, SME_POW_MNGMT_REQUEST);