staging: rtl8723bs: use ether_addr_copy() and simplify NULL checks
PATCH v2 1/1 staging: rtl8723bs: use ether_addr_copy() and simplify NULL checks
From: dharanitharan27 <[email protected]>
This patch addresses multiple checkpatch warnings and coding-style issues in rtl8723bs:
- Lines 120, 212, 215, 249, 255, 256, 261, 262, 263: Replaced memcpy() with ether_addr_copy() for MAC/Ether address copies, following kernel best practices.
These changes improve code clarity, align with Linux kernel style guidelines, and fix checkpatch.pl warnings.
---
Tested by compiling the module successfully with:
make M=drivers/staging/rtl8723bs
--- drivers/staging/rtl8723bs/hal/rtl8723b_cmd.c | 33 ++++++++++---------- 1 file changed, 17 insertions(+), 16 deletions(-)
drivers/staging/rtl8723bs/hal/rtl8723b_cmd.c +17 -16
@@ -7,6 +7,7 @@#include <drv_types.h> #include <rtl8723b_hal.h> +#include <linux/etherdevice.h> #include "hal_com_h2c.h" #define MAX_H2C_BOX_NUMS 4
@@ -117,8 +118,8 @@ static void ConstructBeacon(struct adapter *padapter, u8 *pframe, u32 *pLength) *(fctrl) =0 ;eth_broadcast_addr (pwlanhdr->addr1); -memcpy (pwlanhdr->addr2,myid (&(padapter->eeprompriv)),ETH_ALEN ); -memcpy (pwlanhdr->addr3,get_my_bssid (cur_network),ETH_ALEN ); +ether_addr_copy (pwlanhdr->addr2,myid (&(padapter->eeprompriv))); +ether_addr_copy (pwlanhdr->addr3,get_my_bssid (cur_network));SetSeqNum (pwlanhdr,0 /*pmlmeext->mgnt_seq*/ );/* pmlmeext->mgnt_seq++; */
@@ -209,10 +210,10 @@ static void ConstructPSPoll(struct adapter *padapter, u8 *pframe, u32 *pLength)SetDuration (pframe, (pmlmeinfo->aid |0xc000 ));/* BSSID. */ -memcpy (pwlanhdr->addr1,get_my_bssid (&(pmlmeinfo->network)),ETH_ALEN ); +ether_addr_copy (pwlanhdr->addr1,get_my_bssid (&(pmlmeinfo->network)));/* TA. */ -memcpy (pwlanhdr->addr2,myid (&(padapter->eeprompriv)),ETH_ALEN ); +ether_addr_copy (pwlanhdr->addr2,myid (&(padapter->eeprompriv))); *pLength =16 ; }
@@ -246,21 +247,21 @@ static void ConstructNullFunctionData(switch (cur_network->network.infrastructure_mode) {case Ndis802_11Infrastructure:SetToDs (fctrl); -memcpy (pwlanhdr->addr1,get_my_bssid (&(pmlmeinfo->network)),ETH_ALEN ); -memcpy (pwlanhdr->addr2,myid (&(padapter->eeprompriv)),ETH_ALEN ); -memcpy (pwlanhdr->addr3, StaAddr,ETH_ALEN ); +ether_addr_copy (pwlanhdr->addr1,get_my_bssid (&(pmlmeinfo->network))); +ether_addr_copy (pwlanhdr->addr2,myid (&(padapter->eeprompriv))); +ether_addr_copy (pwlanhdr->addr3, StaAddr);break ;case Ndis802_11APMode:SetFrDs (fctrl); -memcpy (pwlanhdr->addr1, StaAddr,ETH_ALEN ); -memcpy (pwlanhdr->addr2,get_my_bssid (&(pmlmeinfo->network)),ETH_ALEN ); -memcpy (pwlanhdr->addr3,myid (&(padapter->eeprompriv)),ETH_ALEN ); +ether_addr_copy (pwlanhdr->addr1, StaAddr); +ether_addr_copy (pwlanhdr->addr2,get_my_bssid (&(pmlmeinfo->network))); +ether_addr_copy (pwlanhdr->addr3,myid (&(padapter->eeprompriv)));break ;case Ndis802_11IBSS:default : -memcpy (pwlanhdr->addr1, StaAddr,ETH_ALEN ); -memcpy (pwlanhdr->addr2,myid (&(padapter->eeprompriv)),ETH_ALEN ); -memcpy (pwlanhdr->addr3,get_my_bssid (&(pmlmeinfo->network)),ETH_ALEN ); +ether_addr_copy (pwlanhdr->addr1, StaAddr); +ether_addr_copy (pwlanhdr->addr2,myid (&(padapter->eeprompriv))); +ether_addr_copy (pwlanhdr->addr3,get_my_bssid (&(pmlmeinfo->network)));break ; }
@@ -765,9 +766,9 @@ static void ConstructBtNullFunctionData(SetPwrMgt (fctrl);SetFrDs (fctrl); -memcpy (pwlanhdr->addr1, StaAddr,ETH_ALEN ); -memcpy (pwlanhdr->addr2,myid (&padapter->eeprompriv),ETH_ALEN ); -memcpy (pwlanhdr->addr3,myid (&padapter->eeprompriv),ETH_ALEN ); +ether_addr_copy (pwlanhdr->addr1, StaAddr); +ether_addr_copy (pwlanhdr->addr2,myid (&padapter->eeprompriv)); +ether_addr_copy (pwlanhdr->addr3,myid (&padapter->eeprompriv));SetDuration (pwlanhdr,0 );SetSeqNum (pwlanhdr,0 );
Signature · 1 line
2.43.0
Subject is has "[PATCH v3] [PATCH v2]"
Quoted 1 line · Dharanitharan R
From: dharanitharan27 <[email protected]>
^^^^^^^^^^^^^^^
Wrong email address.
Quoted 7 lines
This patch addresses multiple checkpatch warnings and coding-style issues in rtl8723bs:
- Lines 120, 212, 215, 249, 255, 256, 261, 262, 263: Replaced
memcpy()withether_addr_copy()for MAC/Ether address copies, following kernel best practices.
We don't really care about the line numbers... Remove that from the commit message.
Quoted 5 lines
These changes improve code clarity, align with Linux kernel style guidelines, and fix checkpatch.pl warnings.
---
^^^
Anything below this line will be removed from the final commit message so the Signed-off-by needs to be above it.
Quoted 5 lines
Tested by compiling the module successfully with:
make M=drivers/staging/rtl8723bsSigned-off-by Dharanitharan R <[email protected]>---
We need a list of changes here under the --- cut off.
v4: fix subject, and from email address tweak the commit message
v3: something
v2: whatever
regards,
dan carpenter