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

Commit 90db5912 authored by Sergio Paracuellos's avatar Sergio Paracuellos Committed by Greg Kroah-Hartman
Browse files

staging: ks7010: refactor ks_wlan_set_wap function



Make use of ether_addr_copy instead of memcpy for copying
ethernet address data in ks_wlan_set_wap function and avoid
an 'else' just changing if logic to check invalid values first.

Signed-off-by: default avatarSergio Paracuellos <sergio.paracuellos@gmail.com>
Signed-off-by: default avatarGreg Kroah-Hartman <gregkh@linuxfoundation.org>
parent 60d4125d
Loading
Loading
Loading
Loading
+6 −8
Original line number Diff line number Diff line
@@ -316,18 +316,16 @@ static int ks_wlan_set_wap(struct net_device *dev, struct iw_request_info *info,
		return -EPERM;

	/* for SLEEP MODE */
	if (priv->reg.operation_mode == MODE_ADHOC ||
	    priv->reg.operation_mode == MODE_INFRASTRUCTURE) {
		memcpy(priv->reg.bssid, &awrq->ap_addr.sa_data, ETH_ALEN);

		if (is_valid_ether_addr((u8 *)priv->reg.bssid))
			priv->need_commit |= SME_MODE_SET;

	} else {
	if (priv->reg.operation_mode != MODE_ADHOC &&
	    priv->reg.operation_mode != MODE_INFRASTRUCTURE) {
		eth_zero_addr(priv->reg.bssid);
		return -EOPNOTSUPP;
	}

	ether_addr_copy(priv->reg.bssid, awrq->ap_addr.sa_data);
	if (is_valid_ether_addr((u8 *)priv->reg.bssid))
		priv->need_commit |= SME_MODE_SET;

	netdev_dbg(dev, "bssid = %pM\n", priv->reg.bssid);

	/* Write it to the card */