staging: ks7010: refactor ks_wlan_set_scan_type function
This commit changes logic to handle invalid values first and just assign valid ones afterwards. Signed-off-by: Sergio Paracuellos <sergio.paracuellos@gmail.com> Signed-off-by: Greg Kroah-Hartman <gregkh@linuxfoundation.org>
This commit is contained in:
parent
25ee63eb2d
commit
7a2cc8db50
@ -1940,14 +1940,11 @@ static int ks_wlan_set_scan_type(struct net_device *dev,
|
||||
if (priv->sleep_mode == SLP_SLEEP)
|
||||
return -EPERM;
|
||||
/* for SLEEP MODE */
|
||||
if (*uwrq == ACTIVE_SCAN) { /* 0 */
|
||||
priv->reg.scan_type = ACTIVE_SCAN;
|
||||
} else if (*uwrq == PASSIVE_SCAN) { /* 1 */
|
||||
priv->reg.scan_type = PASSIVE_SCAN;
|
||||
} else {
|
||||
return -EINVAL;
|
||||
}
|
||||
|
||||
if (*uwrq != ACTIVE_SCAN && *uwrq != PASSIVE_SCAN)
|
||||
return -EINVAL;
|
||||
|
||||
priv->reg.scan_type = *uwrq;
|
||||
return 0;
|
||||
}
|
||||
|
||||
|
Loading…
Reference in New Issue
Block a user