Linux kernel mirror (for testing) git.kernel.org/pub/scm/linux/kernel/git/torvalds/linux.git
kernel os linux
1
fork

Configure Feed

Select the types of activity you want to include in your feed.

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>

authored by

Dharanitharan R and committed by
Greg Kroah-Hartman
79b67612 de4cbbdf

+17 -16
+17 -16
drivers/staging/rtl8723bs/hal/rtl8723b_cmd.c
··· 7 7 8 8 #include <drv_types.h> 9 9 #include <rtl8723b_hal.h> 10 + #include <linux/etherdevice.h> 10 11 #include "hal_com_h2c.h" 11 12 12 13 #define MAX_H2C_BOX_NUMS 4 ··· 118 117 *(fctrl) = 0; 119 118 120 119 eth_broadcast_addr(pwlanhdr->addr1); 121 - memcpy(pwlanhdr->addr2, myid(&(padapter->eeprompriv)), ETH_ALEN); 122 - memcpy(pwlanhdr->addr3, get_my_bssid(cur_network), ETH_ALEN); 120 + ether_addr_copy(pwlanhdr->addr2, myid(&(padapter->eeprompriv))); 121 + ether_addr_copy(pwlanhdr->addr3, get_my_bssid(cur_network)); 123 122 124 123 SetSeqNum(pwlanhdr, 0/*pmlmeext->mgnt_seq*/); 125 124 /* pmlmeext->mgnt_seq++; */ ··· 210 209 SetDuration(pframe, (pmlmeinfo->aid | 0xc000)); 211 210 212 211 /* BSSID. */ 213 - memcpy(pwlanhdr->addr1, get_my_bssid(&(pmlmeinfo->network)), ETH_ALEN); 212 + ether_addr_copy(pwlanhdr->addr1, get_my_bssid(&(pmlmeinfo->network))); 214 213 215 214 /* TA. */ 216 - memcpy(pwlanhdr->addr2, myid(&(padapter->eeprompriv)), ETH_ALEN); 215 + ether_addr_copy(pwlanhdr->addr2, myid(&(padapter->eeprompriv))); 217 216 218 217 *pLength = 16; 219 218 } ··· 247 246 switch (cur_network->network.infrastructure_mode) { 248 247 case Ndis802_11Infrastructure: 249 248 SetToDs(fctrl); 250 - memcpy(pwlanhdr->addr1, get_my_bssid(&(pmlmeinfo->network)), ETH_ALEN); 251 - memcpy(pwlanhdr->addr2, myid(&(padapter->eeprompriv)), ETH_ALEN); 252 - memcpy(pwlanhdr->addr3, StaAddr, ETH_ALEN); 249 + ether_addr_copy(pwlanhdr->addr1, get_my_bssid(&(pmlmeinfo->network))); 250 + ether_addr_copy(pwlanhdr->addr2, myid(&(padapter->eeprompriv))); 251 + ether_addr_copy(pwlanhdr->addr3, StaAddr); 253 252 break; 254 253 case Ndis802_11APMode: 255 254 SetFrDs(fctrl); 256 - memcpy(pwlanhdr->addr1, StaAddr, ETH_ALEN); 257 - memcpy(pwlanhdr->addr2, get_my_bssid(&(pmlmeinfo->network)), ETH_ALEN); 258 - memcpy(pwlanhdr->addr3, myid(&(padapter->eeprompriv)), ETH_ALEN); 255 + ether_addr_copy(pwlanhdr->addr1, StaAddr); 256 + ether_addr_copy(pwlanhdr->addr2, get_my_bssid(&(pmlmeinfo->network))); 257 + ether_addr_copy(pwlanhdr->addr3, myid(&(padapter->eeprompriv))); 259 258 break; 260 259 case Ndis802_11IBSS: 261 260 default: 262 - memcpy(pwlanhdr->addr1, StaAddr, ETH_ALEN); 263 - memcpy(pwlanhdr->addr2, myid(&(padapter->eeprompriv)), ETH_ALEN); 264 - memcpy(pwlanhdr->addr3, get_my_bssid(&(pmlmeinfo->network)), ETH_ALEN); 261 + ether_addr_copy(pwlanhdr->addr1, StaAddr); 262 + ether_addr_copy(pwlanhdr->addr2, myid(&(padapter->eeprompriv))); 263 + ether_addr_copy(pwlanhdr->addr3, get_my_bssid(&(pmlmeinfo->network))); 265 264 break; 266 265 } 267 266 ··· 766 765 SetPwrMgt(fctrl); 767 766 768 767 SetFrDs(fctrl); 769 - memcpy(pwlanhdr->addr1, StaAddr, ETH_ALEN); 770 - memcpy(pwlanhdr->addr2, myid(&padapter->eeprompriv), ETH_ALEN); 771 - memcpy(pwlanhdr->addr3, myid(&padapter->eeprompriv), ETH_ALEN); 768 + ether_addr_copy(pwlanhdr->addr1, StaAddr); 769 + ether_addr_copy(pwlanhdr->addr2, myid(&padapter->eeprompriv)); 770 + ether_addr_copy(pwlanhdr->addr3, myid(&padapter->eeprompriv)); 772 771 773 772 SetDuration(pwlanhdr, 0); 774 773 SetSeqNum(pwlanhdr, 0);