aboutsummaryrefslogtreecommitdiffstats
path: root/drivers/staging/ks7010
diff options
context:
space:
mode:
authorSergio Paracuellos <sergio.paracuellos@gmail.com>2018-04-25 16:01:44 +0200
committerGreg Kroah-Hartman <gregkh@linuxfoundation.org>2018-04-26 09:35:03 +0200
commit8521b4e65e2330e5b952d4341976fe3b98c4efa0 (patch)
tree68b1e966490213b8d387f7031f8b9f1f2341d57b /drivers/staging/ks7010
parentstaging: ks7010: refactor ks_wlan_set_power_mgmt function (diff)
downloadlinux-dev-8521b4e65e2330e5b952d4341976fe3b98c4efa0.tar.xz
linux-dev-8521b4e65e2330e5b952d4341976fe3b98c4efa0.zip
staging: ks7010: refactor ks_wlan_set_preamble function
Change if logic to handle invalid values first and just assign at the end the valid one if it is the case. 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.c8
1 files changed, 2 insertions, 6 deletions
diff --git a/drivers/staging/ks7010/ks_wlan_net.c b/drivers/staging/ks7010/ks_wlan_net.c
index 3c9fbb9bcd52..87c051958bf3 100644
--- a/drivers/staging/ks7010/ks_wlan_net.c
+++ b/drivers/staging/ks7010/ks_wlan_net.c
@@ -1860,14 +1860,10 @@ static int ks_wlan_set_preamble(struct net_device *dev,
return -EPERM;
/* for SLEEP MODE */
- if (*uwrq == LONG_PREAMBLE) { /* 0 */
- priv->reg.preamble = LONG_PREAMBLE;
- } else if (*uwrq == SHORT_PREAMBLE) { /* 1 */
- priv->reg.preamble = SHORT_PREAMBLE;
- } else {
+ if (*uwrq != LONG_PREAMBLE && *uwrq != SHORT_PREAMBLE)
return -EINVAL;
- }
+ priv->reg.preamble = *uwrq;
priv->need_commit |= SME_MODE_SET;
return -EINPROGRESS; /* Call commit handler */
}