diff options
author | Aya Mahfouz <mahfouz.saif.elyazal@gmail.com> | 2015-03-04 09:00:02 +0200 |
---|---|---|
committer | Greg Kroah-Hartman <gregkh@linuxfoundation.org> | 2015-03-06 15:30:07 -0800 |
commit | 22905b8594d58a6fceeb4510a57e34571a075b45 (patch) | |
tree | 97a0c986652ff6deec744db9d75b02ca06d52c86 /drivers/staging/rtl8712 | |
parent | 8e5d9433412d34f02a83edd265605bfe6c347a0a (diff) |
staging: rtl8712: replace memset(x,0,ETH_ALEN)
eth_zero_addr() is a wrapper function for memset if 0 is going to
be assigned to a mac address. The aforementioned function replaces
memset. In addition, linux/etherdevice.h was included as a header
since it is the file that defines the inline function eth_zero_addr().
The changes were carried out using the following coccinelle script:
@header@
@@
#include <linux/etherdevice.h>
@eth_zero_addr@
expression e;
@@
-memset(e,0,ETH_ALEN);
+eth_zero_addr(e);
@eth_broadcast_addr@
identifier e;
@@
-memset(e,\(0xff\|0xFF\|255\),ETH_ALEN);
+eth_broadcast_addr(e);
@linux_header depends on !header && (eth_zero_addr || eth_broadcast_addr) @
@@
+ #include <linux/etherdevice.h>
+
@special_header depends on !header && !linux_header && (eth_zero_addr || eth_broadcast_addr) @
@@
+
+ #include <linux/etherdevice.h>
+
@custom_header depends on !header && !linux_header && !special_header && (eth_zero_addr || eth_broadcast_addr) @
@@
+
+ #include <linux/etherdevice.h>
Signed-off-by: Aya Mahfouz <mahfouz.saif.elyazal@gmail.com>
Signed-off-by: Greg Kroah-Hartman <gregkh@linuxfoundation.org>
Diffstat (limited to 'drivers/staging/rtl8712')
-rw-r--r-- | drivers/staging/rtl8712/rtl871x_ioctl_linux.c | 9 |
1 files changed, 5 insertions, 4 deletions
diff --git a/drivers/staging/rtl8712/rtl871x_ioctl_linux.c b/drivers/staging/rtl8712/rtl871x_ioctl_linux.c index 5d4470a9aeb5..eacba8c37cc1 100644 --- a/drivers/staging/rtl8712/rtl871x_ioctl_linux.c +++ b/drivers/staging/rtl8712/rtl871x_ioctl_linux.c @@ -46,6 +46,8 @@ #include <linux/semaphore.h> #include <net/iw_handler.h> #include <linux/if_arp.h> +#include <linux/etherdevice.h> + #define RTL_IOCTL_WPA_SUPPLICANT (SIOCIWFIRSTPRIV + 0x1E) @@ -112,7 +114,7 @@ void r8712_indicate_wx_disassoc_event(struct _adapter *padapter) union iwreq_data wrqu; wrqu.ap_addr.sa_family = ARPHRD_ETHER; - memset(wrqu.ap_addr.sa_data, 0, ETH_ALEN); + eth_zero_addr(wrqu.ap_addr.sa_data); wireless_send_event(padapter->pnetdev, SIOCGIWAP, &wrqu, NULL); } @@ -852,8 +854,7 @@ static int r871x_wx_set_pmkid(struct net_device *dev, strIssueBssid, ETH_ALEN)) { /* BSSID is matched, the same AP => Remove * this PMKID information and reset it. */ - memset(psecuritypriv->PMKIDList[j].Bssid, - 0x00, ETH_ALEN); + eth_zero_addr(psecuritypriv->PMKIDList[j].Bssid); psecuritypriv->PMKIDList[j].bUsed = false; break; } @@ -1118,7 +1119,7 @@ static int r8711_wx_get_wap(struct net_device *dev, WIFI_AP_STATE)) memcpy(wrqu->ap_addr.sa_data, pcur_bss->MacAddress, ETH_ALEN); else - memset(wrqu->ap_addr.sa_data, 0, ETH_ALEN); + eth_zero_addr(wrqu->ap_addr.sa_data); return 0; } |