mirror of
https://git.kernel.org/pub/scm/linux/kernel/git/stable/linux.git
synced 2024-10-05 00:20:32 +00:00
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>
This commit is contained in:
parent
2ab6fd5963
commit
dc59ef2af2
1 changed files with 2 additions and 12 deletions
|
@ -1199,27 +1199,17 @@ static int ks_wlan_set_power(struct net_device *dev,
|
||||||
{
|
{
|
||||||
struct ks_wlan_private *priv =
|
struct ks_wlan_private *priv =
|
||||||
(struct ks_wlan_private *)netdev_priv(dev);
|
(struct ks_wlan_private *)netdev_priv(dev);
|
||||||
short enabled;
|
|
||||||
|
|
||||||
if (priv->sleep_mode == SLP_SLEEP)
|
if (priv->sleep_mode == SLP_SLEEP)
|
||||||
return -EPERM;
|
return -EPERM;
|
||||||
|
|
||||||
/* for SLEEP MODE */
|
if (vwrq->disabled) {
|
||||||
enabled = vwrq->disabled ? 0 : 1;
|
|
||||||
if (enabled == 0) { /* 0 */
|
|
||||||
priv->reg.powermgt = POWMGT_ACTIVE_MODE;
|
priv->reg.powermgt = POWMGT_ACTIVE_MODE;
|
||||||
} else if (enabled) { /* 1 */
|
} else {
|
||||||
if (priv->reg.operation_mode == MODE_INFRASTRUCTURE)
|
if (priv->reg.operation_mode == MODE_INFRASTRUCTURE)
|
||||||
priv->reg.powermgt = POWMGT_SAVE1_MODE;
|
priv->reg.powermgt = POWMGT_SAVE1_MODE;
|
||||||
else
|
else
|
||||||
return -EINVAL;
|
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);
|
hostif_sme_enqueue(priv, SME_POW_MNGMT_REQUEST);
|
||||||
|
|
Loading…
Reference in a new issue