]> git.karo-electronics.de Git - linux-beck.git/commitdiff
Staging: ks7010: Replace memset with eth_zero_addr
authorBhumika Goyal <bhumirks@gmail.com>
Fri, 16 Sep 2016 14:24:37 +0000 (19:54 +0530)
committerGreg Kroah-Hartman <gregkh@linuxfoundation.org>
Sat, 17 Sep 2016 21:32:13 +0000 (23:32 +0200)
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>
drivers/staging/ks7010/ks_hostif.c
drivers/staging/ks7010/ks_wlan_net.c

index e3cc8ce26344af4146db44ecbf3afa6286d4c9ef..deb82ab6e4a35dc74535835c34f763a592c26e2c 100644 (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",
index c17c45d66a3f9a7945c0c86da7b066a42d361176..70cc9bee96c1f0be0ada7c404794f8feac32129b 100644 (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;