From: Sergio Paracuellos Date: Wed, 25 Apr 2018 14:01:49 +0000 (+0200) Subject: staging: ks7010: refactor ks_wlan_set_wap function X-Git-Url: http://git.lede-project.org./?a=commitdiff_plain;h=90db591233907386010c05a4bd060bb8dd3c515b;p=openwrt%2Fstaging%2Fblogic.git 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: Sergio Paracuellos Signed-off-by: Greg Kroah-Hartman --- diff --git a/drivers/staging/ks7010/ks_wlan_net.c b/drivers/staging/ks7010/ks_wlan_net.c index b4b38d86f4f8..f23838e2330e 100644 --- a/drivers/staging/ks7010/ks_wlan_net.c +++ b/drivers/staging/ks7010/ks_wlan_net.c @@ -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 */