Skip to content

Commit 79b6761

Browse files
DharaniTharan-725gregkh
authored andcommitted
staging: rtl8723bs: use ether_addr_copy() for MAC address copying
Replaces multiple memcpy() calls with ether_addr_copy() for copying MAC/Ethernet addresses in rtl8723bs. This improves readability and aligns with Linux kernel best practices for handling Ethernet addresses. Fixes the following checkpatch.pl warning: "Use ether_addr_copy() instead of memcpy() for Ethernet addresses." These updates enhance code clarity and maintain consistency with network driver conventions. Signed-off-by: Dharanitharan R <dharanitharan725@gmail.com> Link: https://patch.msgid.link/20251023145903.2557-1-dharanitharan725@gmail.com Signed-off-by: Greg Kroah-Hartman <gregkh@linuxfoundation.org>
1 parent de4cbbd commit 79b6761

1 file changed

Lines changed: 17 additions & 16 deletions

File tree

drivers/staging/rtl8723bs/hal/rtl8723b_cmd.c

Lines changed: 17 additions & 16 deletions
Original file line numberDiff line numberDiff line change
@@ -7,6 +7,7 @@
77

88
#include <drv_types.h>
99
#include <rtl8723b_hal.h>
10+
#include <linux/etherdevice.h>
1011
#include "hal_com_h2c.h"
1112

1213
#define MAX_H2C_BOX_NUMS 4
@@ -117,8 +118,8 @@ static void ConstructBeacon(struct adapter *padapter, u8 *pframe, u32 *pLength)
117118
*(fctrl) = 0;
118119

119120
eth_broadcast_addr(pwlanhdr->addr1);
120-
memcpy(pwlanhdr->addr2, myid(&(padapter->eeprompriv)), ETH_ALEN);
121-
memcpy(pwlanhdr->addr3, get_my_bssid(cur_network), ETH_ALEN);
121+
ether_addr_copy(pwlanhdr->addr2, myid(&(padapter->eeprompriv)));
122+
ether_addr_copy(pwlanhdr->addr3, get_my_bssid(cur_network));
122123

123124
SetSeqNum(pwlanhdr, 0/*pmlmeext->mgnt_seq*/);
124125
/* pmlmeext->mgnt_seq++; */
@@ -209,10 +210,10 @@ static void ConstructPSPoll(struct adapter *padapter, u8 *pframe, u32 *pLength)
209210
SetDuration(pframe, (pmlmeinfo->aid | 0xc000));
210211

211212
/* BSSID. */
212-
memcpy(pwlanhdr->addr1, get_my_bssid(&(pmlmeinfo->network)), ETH_ALEN);
213+
ether_addr_copy(pwlanhdr->addr1, get_my_bssid(&(pmlmeinfo->network)));
213214

214215
/* TA. */
215-
memcpy(pwlanhdr->addr2, myid(&(padapter->eeprompriv)), ETH_ALEN);
216+
ether_addr_copy(pwlanhdr->addr2, myid(&(padapter->eeprompriv)));
216217

217218
*pLength = 16;
218219
}
@@ -246,21 +247,21 @@ static void ConstructNullFunctionData(
246247
switch (cur_network->network.infrastructure_mode) {
247248
case Ndis802_11Infrastructure:
248249
SetToDs(fctrl);
249-
memcpy(pwlanhdr->addr1, get_my_bssid(&(pmlmeinfo->network)), ETH_ALEN);
250-
memcpy(pwlanhdr->addr2, myid(&(padapter->eeprompriv)), ETH_ALEN);
251-
memcpy(pwlanhdr->addr3, StaAddr, ETH_ALEN);
250+
ether_addr_copy(pwlanhdr->addr1, get_my_bssid(&(pmlmeinfo->network)));
251+
ether_addr_copy(pwlanhdr->addr2, myid(&(padapter->eeprompriv)));
252+
ether_addr_copy(pwlanhdr->addr3, StaAddr);
252253
break;
253254
case Ndis802_11APMode:
254255
SetFrDs(fctrl);
255-
memcpy(pwlanhdr->addr1, StaAddr, ETH_ALEN);
256-
memcpy(pwlanhdr->addr2, get_my_bssid(&(pmlmeinfo->network)), ETH_ALEN);
257-
memcpy(pwlanhdr->addr3, myid(&(padapter->eeprompriv)), ETH_ALEN);
256+
ether_addr_copy(pwlanhdr->addr1, StaAddr);
257+
ether_addr_copy(pwlanhdr->addr2, get_my_bssid(&(pmlmeinfo->network)));
258+
ether_addr_copy(pwlanhdr->addr3, myid(&(padapter->eeprompriv)));
258259
break;
259260
case Ndis802_11IBSS:
260261
default:
261-
memcpy(pwlanhdr->addr1, StaAddr, ETH_ALEN);
262-
memcpy(pwlanhdr->addr2, myid(&(padapter->eeprompriv)), ETH_ALEN);
263-
memcpy(pwlanhdr->addr3, get_my_bssid(&(pmlmeinfo->network)), ETH_ALEN);
262+
ether_addr_copy(pwlanhdr->addr1, StaAddr);
263+
ether_addr_copy(pwlanhdr->addr2, myid(&(padapter->eeprompriv)));
264+
ether_addr_copy(pwlanhdr->addr3, get_my_bssid(&(pmlmeinfo->network)));
264265
break;
265266
}
266267

@@ -765,9 +766,9 @@ static void ConstructBtNullFunctionData(
765766
SetPwrMgt(fctrl);
766767

767768
SetFrDs(fctrl);
768-
memcpy(pwlanhdr->addr1, StaAddr, ETH_ALEN);
769-
memcpy(pwlanhdr->addr2, myid(&padapter->eeprompriv), ETH_ALEN);
770-
memcpy(pwlanhdr->addr3, myid(&padapter->eeprompriv), ETH_ALEN);
769+
ether_addr_copy(pwlanhdr->addr1, StaAddr);
770+
ether_addr_copy(pwlanhdr->addr2, myid(&padapter->eeprompriv));
771+
ether_addr_copy(pwlanhdr->addr3, myid(&padapter->eeprompriv));
771772

772773
SetDuration(pwlanhdr, 0);
773774
SetSeqNum(pwlanhdr, 0);

0 commit comments

Comments
 (0)