Donate to e Foundation | Murena handsets with /e/OS | Own a part of Murena! Learn more

Commit 7a2cc8db authored by Sergio Paracuellos's avatar Sergio Paracuellos Committed by Greg Kroah-Hartman
Browse files

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: default avatarSergio Paracuellos <sergio.paracuellos@gmail.com>
Signed-off-by: default avatarGreg Kroah-Hartman <gregkh@linuxfoundation.org>
parent 25ee63eb
Loading
Loading
Loading
Loading
+3 −6
Original line number Diff line number Diff line
@@ -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 {

	if (*uwrq != ACTIVE_SCAN && *uwrq != PASSIVE_SCAN)
		return -EINVAL;
	}

	priv->reg.scan_type = *uwrq;
	return 0;
}