rtlwifi: use eth_zero_addr() to assign zero address
authorWei Yongjun <yongjun_wei@trendmicro.com.cn>
Thu, 15 Nov 2012 13:24:57 +0000 (21:24 +0800)
committerJohn W. Linville <linville@tuxdriver.com>
Fri, 16 Nov 2012 19:29:07 +0000 (14:29 -0500)
Using eth_zero_addr() to assign zero address insetad of
memset() or an inefficient copy from a static array.

Signed-off-by: Wei Yongjun <yongjun_wei@trendmicro.com.cn>
Signed-off-by: John W. Linville <linville@tuxdriver.com>
drivers/net/wireless/rtlwifi/cam.c
drivers/net/wireless/rtlwifi/core.c

index ca69e35e50f126582ae73b2b9a35f96a8a075469..0e510f73041ab88659b131c2a392598046e127fe 100644 (file)
@@ -337,7 +337,7 @@ void rtl_cam_del_entry(struct ieee80211_hw *hw, u8 *sta_addr)
                if (((bitmap & BIT(0)) == BIT(0)) &&
                    (memcmp(addr, sta_addr, ETH_ALEN) == 0)) {
                        /* Remove from HW Security CAM */
-                       memset(rtlpriv->sec.hwsec_cam_sta_addr[i], 0, ETH_ALEN);
+                       eth_zero_addr(rtlpriv->sec.hwsec_cam_sta_addr[i]);
                        rtlpriv->sec.hwsec_cam_bitmap &= ~(BIT(0) << i);
                        RT_TRACE(rtlpriv, COMP_SEC, DBG_LOUD,
                                 "del CAM entry %d\n", i);
index a7c0e52869ba3c708cf39685c59489122353b4a0..be33aa14c8afaa6672497d156abebb4b3cd146f9 100644 (file)
@@ -962,7 +962,6 @@ static int rtl_op_set_key(struct ieee80211_hw *hw, enum set_key_cmd cmd,
        int err = 0;
        u8 mac_addr[ETH_ALEN];
        u8 bcast_addr[ETH_ALEN] = { 0xff, 0xff, 0xff, 0xff, 0xff, 0xff };
-       u8 zero_addr[ETH_ALEN] = { 0 };
 
        if (rtlpriv->cfg->mod_params->sw_crypto || rtlpriv->sec.use_sw_sec) {
                RT_TRACE(rtlpriv, COMP_ERR, DBG_WARNING,
@@ -1057,7 +1056,7 @@ static int rtl_op_set_key(struct ieee80211_hw *hw, enum set_key_cmd cmd,
                        memcpy(rtlpriv->sec.key_buf[key_idx],
                               key->key, key->keylen);
                        rtlpriv->sec.key_len[key_idx] = key->keylen;
-                       memcpy(mac_addr, zero_addr, ETH_ALEN);
+                       eth_zero_addr(mac_addr);
                } else if (group_key) { /* group key */
                        RT_TRACE(rtlpriv, COMP_SEC, DBG_DMESG,
                                 "set group key\n");
@@ -1108,7 +1107,7 @@ static int rtl_op_set_key(struct ieee80211_hw *hw, enum set_key_cmd cmd,
                }
                memset(rtlpriv->sec.key_buf[key_idx], 0, key->keylen);
                rtlpriv->sec.key_len[key_idx] = 0;
-               memcpy(mac_addr, zero_addr, ETH_ALEN);
+               eth_zero_addr(mac_addr);
                /*
                 *mac80211 will delete entrys one by one,
                 *so don't use rtl_cam_reset_all_entry