Staging: ks7010: Replace memset with eth_zero_addr

Use eth_zero_addr to assign zero address to the given address array
instead of memset when the second argument in memset is address
of zero. Coccinelle was used to do the replacement and add the
header file linux/etherdevice.h if not already present.
Script:
@header@
@@
#include <linux/etherdevice.h>

@r1@
expression e;
@@

-memset(e,0,ETH_ALEN);
+eth_zero_addr(e);

@includeheader depends on r1 && !header@
@@
+ #include <linux/etherdevice.h>
#include <...>

Signed-off-by: Bhumika Goyal <bhumirks@gmail.com>
Acked-by: Julia Lawall <julia.lawall@lip6.fr>
Signed-off-by: Greg Kroah-Hartman <gregkh@linuxfoundation.org>
This commit is contained in:
Bhumika Goyal 2016-09-16 19:54:37 +05:30 committed by Greg Kroah-Hartman
parent faa48ea82b
commit 30b48e2dbe
2 changed files with 7 additions and 6 deletions

View File

@ -14,6 +14,7 @@
#include "eap_packet.h"
#include "michael_mic.h"
#include <linux/etherdevice.h>
#include <linux/if_ether.h>
#include <linux/if_arp.h>
@ -780,7 +781,7 @@ void hostif_start_confirm(struct ks_wlan_private *priv)
wrqu.data.flags = 0;
wrqu.ap_addr.sa_family = ARPHRD_ETHER;
if ((priv->connect_status & CONNECT_STATUS_MASK) == CONNECT_STATUS) {
memset(wrqu.ap_addr.sa_data, '\0', ETH_ALEN);
eth_zero_addr(wrqu.ap_addr.sa_data);
DPRINTK(3, "IWEVENT: disconnect\n");
wireless_send_event(priv->net_dev, SIOCGIWAP, &wrqu, NULL);
}
@ -838,7 +839,7 @@ void hostif_connect_indication(struct ks_wlan_private *priv)
wrqu0.ap_addr.sa_family = ARPHRD_ETHER;
if ((priv->connect_status & CONNECT_STATUS_MASK) == DISCONNECT_STATUS &&
(old_status & CONNECT_STATUS_MASK) == CONNECT_STATUS) {
memset(wrqu0.ap_addr.sa_data, '\0', ETH_ALEN);
eth_zero_addr(wrqu0.ap_addr.sa_data);
DPRINTK(3, "IWEVENT: disconnect\n");
DPRINTK(3, "disconnect :: scan_ind_count=%d\n",
priv->scan_ind_count);
@ -910,7 +911,7 @@ void hostif_stop_confirm(struct ks_wlan_private *priv)
if ((priv->connect_status & CONNECT_STATUS_MASK) ==
DISCONNECT_STATUS
&& (old_status & CONNECT_STATUS_MASK) == CONNECT_STATUS) {
memset(wrqu0.ap_addr.sa_data, '\0', ETH_ALEN);
eth_zero_addr(wrqu0.ap_addr.sa_data);
DPRINTK(3, "IWEVENT: disconnect\n");
printk("IWEVENT: disconnect\n");
DPRINTK(3, "disconnect :: scan_ind_count=%d\n",

View File

@ -401,7 +401,7 @@ static int ks_wlan_set_wap(struct net_device *dev, struct iw_request_info *info,
priv->need_commit |= SME_MODE_SET;
}
} else {
memset(priv->reg.bssid, 0x0, ETH_ALEN);
eth_zero_addr(priv->reg.bssid);
return -EOPNOTSUPP;
}
@ -432,7 +432,7 @@ static int ks_wlan_get_wap(struct net_device *dev, struct iw_request_info *info,
if ((priv->connect_status & CONNECT_STATUS_MASK) == CONNECT_STATUS) {
memcpy(awrq->sa_data, &(priv->current_ap.bssid[0]), ETH_ALEN);
} else {
memset(awrq->sa_data, 0, ETH_ALEN);
eth_zero_addr(awrq->sa_data);
}
awrq->sa_family = ARPHRD_ETHER;
@ -2091,7 +2091,7 @@ static int ks_wlan_set_pmksa(struct net_device *dev,
list_for_each(ptr, &priv->pmklist.head) {
pmk = list_entry(ptr, struct pmk_t, list);
if (!memcmp(pmksa->bssid.sa_data, pmk->bssid, ETH_ALEN)) { /* match address! list del. */
memset(pmk->bssid, 0, ETH_ALEN);
eth_zero_addr(pmk->bssid);
memset(pmk->pmkid, 0, IW_PMKID_LEN);
list_del_init(&pmk->list);
break;