staging:rtl8723bs: hal: Remove comparision to NULL
cover staging:rtl8723bs: hal: Remove comparision to NULL
- This patchset removes comparision to NULL in various files of drivers/staging/rtl8723bs/hal/ .
- The changes are broken into 3 separate patches to keep the length of each patch below/near 100 lines for convinient reviewing.
- All patches have the same subject line as they all do the exact same thing.
Himadri Pandya (3):
staging: rtl8723bs: hal: Remove comparision to NULL
staging: rtl8723bs: hal: Remove comparision to NULL
staging: rtl8723bs: hal: Remove comparision to NULL
drivers/staging/rtl8723bs/hal/hal_btcoex.c | 8 ++++---- drivers/staging/rtl8723bs/hal/hal_com.c | 8 ++++---- drivers/staging/rtl8723bs/hal/hal_com_phycfg.c | 18 +++++++++--------- drivers/staging/rtl8723bs/hal/rtl8723b_cmd.c | 8 ++++---- drivers/staging/rtl8723bs/hal/rtl8723bs_xmit.c | 6 +++--- 5 files changed, 24 insertions(+), 24 deletions(-)
Signature · 1 line
2.17.1
PATCH 1/3 staging: rtl8723bs: hal: Remove comparision to NULL
Remove comparision to NULL. Suggested by Coccinelle.
--- drivers/staging/rtl8723bs/hal/rtl8723b_cmd.c | 8 ++++---- drivers/staging/rtl8723bs/hal/rtl8723bs_xmit.c | 6 +++--- 2 files changed, 7 insertions(+), 7 deletions(-)
drivers/staging/rtl8723bs/hal/rtl8723b_cmd.c +4 -4
@@ -1480,7 +1480,7 @@ static void rtl8723b_set_FwRsvdPagePkt( MaxRsvdPageBufSize = RsvdPageNum*PageSize; pcmdframe =rtw_alloc_cmdxmitframe (pxmitpriv); -if (pcmdframe ==NULL ) { +if (!pcmdframe) {DBG_871X ("%s: alloc ReservedPagePacket fail!\n" , __func__);return ; }
@@ -2069,7 +2069,7 @@ void rtl8723b_Add_RateATid(u32 mask = bitmap&0x0FFFFFFF ; psta = pmlmeinfo->FW_sta_info[mac_id].psta; -if (psta ==NULL ) +if (!psta)return ; bw = psta->bw_mode;
@@ -2107,7 +2107,7 @@ static void ConstructBtNullFunctionData( pmlmeext = &padapter->mlmeextpriv; pmlmeinfo = &pmlmeext->mlmext_info; -if (NULL == StaAddr) { +if (!StaAddr) {memcpy (bssid,myid (&padapter->eeprompriv),ETH_ALEN ); StaAddr = bssid; }
@@ -2176,7 +2176,7 @@ static void SetFwRsvdPagePkt_BTCoex(struct adapter *padapter) MaxRsvdPageBufSize = RsvdPageNum*PageSize; pcmdframe =rtw_alloc_cmdxmitframe (pxmitpriv); -if (pcmdframe ==NULL ) { +if (!pcmdframe) {DBG_8192C ("%s: alloc ReservedPagePacket fail!\n" , __func__);return ; }
drivers/staging/rtl8723bs/hal/rtl8723bs_xmit.c +3 -3
@@ -63,7 +63,7 @@ static s32 rtl8723_dequeue_writeport(struct adapter *padapter)else pxmitbuf =dequeue_pending_xmitbuf (pxmitpriv); -if (pxmitbuf ==NULL ) +if (!pxmitbuf)return true; deviceId =ffaddr2deviceId (pdvobjpriv, pxmitbuf->ff_hwaddr);
@@ -284,7 +284,7 @@ static s32 xmit_xmitframes(struct adapter *padapter, struct xmit_priv *pxmitpriv/* check xmit_buf size enough or not */ txlen = txdesc_size +rtw_wlan_pkt_size (pxmitframe);if ( - (NULL == pxmitbuf) || + (!pxmitbuf) || ((_RND (pxmitbuf->len,8 ) + txlen) > max_xmit_len) || (k >= (rtw_hal_sdio_max_txoqt_free_space (padapter)-1 )) ) {
@@ -307,7 +307,7 @@ static s32 xmit_xmitframes(struct adapter *padapter, struct xmit_priv *pxmitpriv } pxmitbuf =rtw_alloc_xmitbuf (pxmitpriv); -if (pxmitbuf ==NULL ) { +if (!pxmitbuf) {#ifdef DBG_XMIT_BUF DBG_871X_LEVEL (_drv_err_,"%s: xmit_buf is not enough!\n" , __func__);#endif
Signature · 1 line
2.17.1
PATCH 2/3 staging: rtl8723bs: hal: Remove comparision to NULL
In reply to Himadri PandyaRemove comparision to NULL. Suggested by Coccinelle.
--- drivers/staging/rtl8723bs/hal/hal_com_phycfg.c | 18 +++++++++--------- 1 file changed, 9 insertions(+), 9 deletions(-)
drivers/staging/rtl8723bs/hal/hal_com_phycfg.c +9 -9
@@ -2236,7 +2236,7 @@ int phy_ConfigMACWithParaFile(struct adapter *Adapter, char *pFileName)memset (pHalData->para_file_buf,0 ,MAX_PARA_FILE_BUF_LEN ); -if ((pHalData->mac_reg_len ==0 ) && (pHalData->mac_reg ==NULL )) { +if ((pHalData->mac_reg_len ==0 ) && !pHalData->mac_reg) {rtw_merge_string (file_path_bs,PATH_MAX , rtw_phy_file_path, pFileName);if (rtw_is_file_readable (file_path_bs) == true) {
@@ -2311,7 +2311,7 @@ int phy_ConfigBBWithParaFile(memset (pHalData->para_file_buf,0 ,MAX_PARA_FILE_BUF_LEN ); -if ((pBufLen !=NULL ) && (*pBufLen ==0 ) && (pBuf ==NULL )) { +if (pBufLen && (*pBufLen ==0 ) && !pBuf) {rtw_merge_string (file_path_bs,PATH_MAX , rtw_phy_file_path, pFileName);if (rtw_is_file_readable (file_path_bs) == true) {
@@ -2336,7 +2336,7 @@ int phy_ConfigBBWithParaFile( } } }else { -if ((pBufLen !=NULL ) && (*pBufLen ==0 ) && (pBuf ==NULL )) { +if (pBufLen && (*pBufLen ==0 ) && !pBuf) {memcpy (pHalData->para_file_buf, pBuf, *pBufLen); rtStatus = _SUCCESS; }else
@@ -2680,7 +2680,7 @@ int phy_ConfigBBWithPgParaFile(struct adapter *Adapter, char *pFileName)memset (pHalData->para_file_buf,0 ,MAX_PARA_FILE_BUF_LEN ); -if ((pHalData->bb_phy_reg_pg_len ==0 ) && (pHalData->bb_phy_reg_pg ==NULL )) { +if ((pHalData->bb_phy_reg_pg_len ==0 ) && !pHalData->bb_phy_reg_pg) {rtw_merge_string (file_path_bs,PATH_MAX , rtw_phy_file_path, pFileName);if (rtw_is_file_readable (file_path_bs) == true) {
@@ -2696,7 +2696,7 @@ int phy_ConfigBBWithPgParaFile(struct adapter *Adapter, char *pFileName) } } }else { -if ((pHalData->bb_phy_reg_pg_len !=0 ) && (pHalData->bb_phy_reg_pg !=NULL )) { +if ((pHalData->bb_phy_reg_pg_len !=0 ) && pHalData->bb_phy_reg_pg) {memcpy (pHalData->para_file_buf, pHalData->bb_phy_reg_pg, pHalData->bb_phy_reg_pg_len); rtStatus = _SUCCESS; }else
@@ -2743,7 +2743,7 @@ int PHY_ConfigRFWithParaFile(memset (pHalData->para_file_buf,0 ,MAX_PARA_FILE_BUF_LEN ); -if ((pBufLen !=NULL ) && (*pBufLen ==0 ) && (pBuf ==NULL )) { +if (pBufLen && (*pBufLen ==0 ) && !pBuf) {rtw_merge_string (file_path_bs,PATH_MAX , rtw_phy_file_path, pFileName);if (rtw_is_file_readable (file_path_bs) == true) {
@@ -2768,7 +2768,7 @@ int PHY_ConfigRFWithParaFile( } } }else { -if ((pBufLen !=NULL ) && (*pBufLen ==0 ) && (pBuf ==NULL )) { +if (pBufLen && (*pBufLen ==0 ) && !pBuf) {memcpy (pHalData->para_file_buf, pBuf, *pBufLen); rtStatus = _SUCCESS; }else
@@ -2925,7 +2925,7 @@ int PHY_ConfigRFWithTxPwrTrackParaFile(struct adapter *Adapter, char *pFileName)memset (pHalData->para_file_buf,0 ,MAX_PARA_FILE_BUF_LEN ); -if ((pHalData->rf_tx_pwr_track_len ==0 ) && (pHalData->rf_tx_pwr_track ==NULL )) { +if ((pHalData->rf_tx_pwr_track_len ==0 ) && !pHalData->rf_tx_pwr_track) {rtw_merge_string (file_path_bs,PATH_MAX , rtw_phy_file_path, pFileName);if (rtw_is_file_readable (file_path_bs) == true) {
@@ -3238,7 +3238,7 @@ int PHY_ConfigRFWithPowerLimitTableParaFile(memset (pHalData->para_file_buf,0 ,MAX_PARA_FILE_BUF_LEN ); -if ((pHalData->rf_tx_pwr_lmt_len ==0 ) && (pHalData->rf_tx_pwr_lmt ==NULL )) { +if ((pHalData->rf_tx_pwr_lmt_len ==0 ) && !pHalData->rf_tx_pwr_lmt) {rtw_merge_string (file_path_bs,PATH_MAX , rtw_phy_file_path, pFileName);if (rtw_is_file_readable (file_path_bs) == true) {
Signature · 1 line
2.17.1
PATCH 3/3 staging: rtl8723bs: hal: Remove comparision to NULL
In reply to Himadri PandyaRemove comparision to NULL. Suggested by Coccinelle.
--- drivers/staging/rtl8723bs/hal/hal_btcoex.c | 8 ++++---- drivers/staging/rtl8723bs/hal/hal_com.c | 8 ++++---- 2 files changed, 8 insertions(+), 8 deletions(-)
drivers/staging/rtl8723bs/hal/hal_btcoex.c +4 -4
@@ -75,7 +75,7 @@ static BTCDBGINFO GLBtcDbgInfo;static void DBG_BT_INFO_INIT (PBTCDBGINFO pinfo,u8 *pbuf,u32 size) { -if (NULL == pinfo) +if (!pinfo)return ;memset (pinfo,0 ,sizeof (BTCDBGINFO ));
@@ -95,7 +95,7 @@ void DBG_BT_INFO(u8 *dbgmsg) pinfo = &GLBtcDbgInfo; -if (NULL == pinfo->info) +if (!pinfo->info)return ; msglen =strlen (dbgmsg);
@@ -1571,7 +1571,7 @@ void hal_btcoex_SetDBG(struct adapter *padapter, u32 *pDbgModule)u32 i; -if (NULL == pDbgModule) +if (!pDbgModule)return ;for (i =0 ; i <BTC_MSG_MAX ; i++)
@@ -1585,7 +1585,7 @@ u32 hal_btcoex_GetDBG(struct adapter *padapter, u8 *pStrBuf, u32 bufSize)u32 leftSize; -if ((NULL == pStrBuf) || (0 == bufSize)) +if (!pStrBuf || (0 == bufSize))return 0 ; pstr = pStrBuf;
drivers/staging/rtl8723bs/hal/hal_com.c +4 -4
@@ -18,7 +18,7 @@ u8 rtw_hal_data_init(struct adapter *padapter)if (is_primary_adapter (padapter)) {/* if (padapter->isprimary) */ padapter->hal_data_sz =sizeof (struct hal_com_data ); padapter->HalData =vzalloc (padapter->hal_data_sz); -if (padapter->HalData ==NULL ) { +if (!padapter->HalData) {DBG_8192C ("cannot alloc memory for HAL DATA\n" );return _FAIL; }
@@ -909,7 +909,7 @@ s32 c2h_evt_read_88xx(struct adapter *adapter, u8 *buf)int i;u8 trigger; -if (buf ==NULL ) +if (!buf) goto exit; trigger =rtw_read8 (adapter,REG_C2HEVT_CLEAR );
@@ -982,7 +982,7 @@ void rtw_hal_update_sta_rate_mask(struct adapter *padapter, struct sta_info *pstu8 i, rf_type, limit;u32 tx_ra_bitmap; -if (psta ==NULL ) +if (!psta)return ; tx_ra_bitmap =0 ;
@@ -1407,7 +1407,7 @@ bool GetHexValueFromString(char *szStr, u32 *pu4bVal, u32 *pu4bMove)char *szScan = szStr;/* Check input parameter. */ -if (szStr ==NULL || pu4bVal ==NULL || pu4bMove ==NULL ) { +if (!szStr || !pu4bVal || !pu4bMove) {DBG_871X ("GetHexValueFromString(): Invalid input arguments! szStr: %p, pu4bVal: %p, pu4bMove: %p\n" , szStr, pu4bVal, pu4bMove);return false;
Signature · 1 line
2.17.1
Re: [Outreachy kernel] [PATCH 3/3] staging: rtl8723bs: hal: Remove comparision to NULL
Quoted 40 lines · Himadri Pandya
Remove comparision to NULL. Suggested by Coccinelle.
Signed-off-by Himadri Pandya <[email protected]>--- drivers/staging/rtl8723bs/hal/hal_btcoex.c | 8 ++++---- drivers/staging/rtl8723bs/hal/hal_com.c | 8 ++++---- 2 files changed, 8 insertions(+), 8 deletions(-)drivers/staging/rtl8723bs/hal/hal_btcoex.c +3
-3@@ -75,7 +75,7 @@ static BTCDBGINFO GLBtcDbgInfo;static void DBG_BT_INFO_INIT (PBTCDBGINFO pinfo,u8 *pbuf,u32 size) { -if (NULL == pinfo) +if (!pinfo)return ;memset (pinfo,0 ,sizeof (BTCDBGINFO ));@@ -95,7 +95,7 @@ void DBG_BT_INFO(u8 *dbgmsg) pinfo = &GLBtcDbgInfo; -if (NULL == pinfo->info) +if (!pinfo->info)return ; msglen =strlen (dbgmsg);@@ -1571,7 +1571,7 @@ void hal_btcoex_SetDBG(struct adapter *padapter, u32 *pDbgModule)u32 i; -if (NULL == pDbgModule) +if (!pDbgModule)return ;for (i =0 ; i <BTC_MSG_MAX ; i++)
drivers/staging/rtl8723bs/hal/hal_btcoex.c u32 hal_btcoex_GetDBG(struct adapter *padapter, u8 *pStrBuf, u32 bufSize) · line 1588
Quoted 5 lines
drivers/staging/rtl8723bs/hal/hal_btcoex.c +1
-1@@ -1585,7 +1585,7 @@ u32 hal_btcoex_GetDBG(struct adapter *padapter, u8 *pStrBuf, u32 bufSize)u32 leftSize; -if ((NULL == pStrBuf) || (0 == bufSize)) +if (!pStrBuf || (0 == bufSize))
It's another issue, so not for this patch, but the kernel prefers constants on the right.
julia
Quoted 53 lines
drivers/staging/rtl8723bs/hal/hal_btcoex.c +0
-0return 0 ; pstr = pStrBuf;drivers/staging/rtl8723bs/hal/hal_com.c +4
-5@@ -18,7 +18,7 @@ u8 rtw_hal_data_init(struct adapter *padapter)if (is_primary_adapter (padapter)) {/* if (padapter->isprimary) */ padapter->hal_data_sz =sizeof (struct hal_com_data ); padapter->HalData =vzalloc (padapter->hal_data_sz); -if (padapter->HalData ==NULL ) { +if (!padapter->HalData) {DBG_8192C ("cannot alloc memory for HAL DATA\n" );return _FAIL; }@@ -909,7 +909,7 @@ s32 c2h_evt_read_88xx(struct adapter *adapter, u8 *buf)int i;u8 trigger; -if (buf ==NULL ) +if (!buf) goto exit; trigger =rtw_read8 (adapter,REG_C2HEVT_CLEAR );@@ -982,7 +982,7 @@ void rtw_hal_update_sta_rate_mask(struct adapter *padapter, struct sta_info *pstu8 i, rf_type, limit;u32 tx_ra_bitmap; -if (psta ==NULL ) +if (!psta)return ; tx_ra_bitmap =0 ;@@ -1407,7 +1407,7 @@ bool GetHexValueFromString(char *szStr, u32 *pu4bVal, u32 *pu4bMove)char *szScan = szStr;/* Check input parameter. */ -if (szStr ==NULL || pu4bVal ==NULL || pu4bMove ==NULL ) { +if (!szStr || !pu4bVal || !pu4bMove) {DBG_871X ("GetHexValueFromString(): Invalid input arguments! szStr: %p, pu4bVal: %p, pu4bMove: %p\n" , szStr, pu4bVal, pu4bMove);return false; --2.17.1
--
You received this message because you are subscribed to the Google Groups "outreachy-kernel" group.
To unsubscribe from this group and stop receiving emails from it, send an email to [email protected]. To post to this group, send email to [email protected].
To view this discussion on the web visit https://groups.google.com/d/msgid/outreachy-kernel/20190316102759.20272-4-himadri18.07%40gmail.com.
For more options, visit https://groups.google.com/d/optout.
Re: [Outreachy kernel] [PATCH 3/3] staging: rtl8723bs: hal: Remove comparision to NULL
Quoted 50 lines · Julia Lawall,
Review
Quoted 9 lines · Himadri Pandya
Remove comparision to NULL. Suggested by Coccinelle.
Signed-off-by Himadri Pandya <[email protected]>--- drivers/staging/rtl8723bs/hal/hal_btcoex.c | 8 ++++---- drivers/staging/rtl8723bs/hal/hal_com.c | 8 ++++---- 2 files changed, 8 insertions(+), 8 deletions(-)(quoted diff) +0
-0
b/drivers/staging/rtl8723bs/hal/hal_btcoex.cdrivers/staging/rtl8723bs/hal/hal_btcoex.c void hal_btcoex_SetDBG(struct adapter *padapter,
Quoted 22 lines
index
2b43f6d3c762..8eb28f97ebcc100644drivers/staging/rtl8723bs/hal/hal_btcoex.c +2
-2@@ -75,7 +75,7 @@ static BTCDBGINFO GLBtcDbgInfo;static void DBG_BT_INFO_INIT (PBTCDBGINFO pinfo,u8 *pbuf,u32 size) { -if (NULL == pinfo) +if (!pinfo)return ;memset (pinfo,0 ,sizeof (BTCDBGINFO ));@@ -95,7 +95,7 @@ void DBG_BT_INFO(u8 *dbgmsg) pinfo = &GLBtcDbgInfo; -if (NULL == pinfo->info) +if (!pinfo->info)return ; msglen =strlen (dbgmsg);@@ -1571,7 +1571,7 @@ void hal_btcoex_SetDBG(struct adapter *padapter,u32 *pDbgModule)
drivers/staging/rtl8723bs/hal/hal_btcoex.c u32 hal_btcoex_GetDBG(struct adapter *padapter, u8
Quoted 9 lines
drivers/staging/rtl8723bs/hal/hal_btcoex.c +1
-1u32 i; -if (NULL == pDbgModule) +if (!pDbgModule)return ;for (i =0 ; i <BTC_MSG_MAX ; i++)@@ -1585,7 +1585,7 @@ u32 hal_btcoex_GetDBG(struct adapter *padapter, u8*pStrBuf, u32 bufSize)
Quoted 3 lines
drivers/staging/rtl8723bs/hal/hal_btcoex.c +0
-0u32 leftSize;
Quoted 8 lines
drivers/staging/rtl8723bs/hal/hal_btcoex.c u32 hal_btcoex_GetDBG(struct adapter *padapter, u8 *pStrBuf, u32 bufSize) · line 1588
Quoted 2 lines
drivers/staging/rtl8723bs/hal/hal_btcoex.c +1
-1-if ((NULL == pStrBuf) || (0 == bufSize)) +if (!pStrBuf || (0 == bufSize))It's another issue, so not for this patch, but the kernel prefers constants on the right.
julia
I couldn't understand. Should I resend this patch as well? Or it should not be part of this patchset?
Constants on the right means "pStrBuf == NULL" instead of "NULL == pStrBuf", right? In that case, if I'm removing the comparison itself, I guess it is okay. Please correct me if I'm mistaken.
Thank you.
- Himadri
Quoted 75 lines
Review
Quoted 4 lines
drivers/staging/rtl8723bs/hal/hal_btcoex.c +0
-0return 0 ; pstr = pStrBuf;(quoted diff) +0
-0
b/drivers/staging/rtl8723bs/hal/hal_com.cdrivers/staging/rtl8723bs/hal/hal_com.c u8 rtw_hal_data_init(struct adapter *padapter) · line 18
Quoted 5 lines
index
7f8ec55b08f1..b97b53c34449100644drivers/staging/rtl8723bs/hal/hal_com.c +0
-0@@ -18,7 +18,7 @@ u8 rtw_hal_data_init(struct adapter *padapter)if (is_primary_adapter (padapter)) {/* if (
padapter->isprimary) */drivers/staging/rtl8723bs/hal/hal_com.c s32 c2h_evt_read_88xx(struct adapter *adapter, u8
Quoted 8 lines
drivers/staging/rtl8723bs/hal/hal_com.c +1
-1padapter->hal_data_sz =sizeof (struct hal_com_data ); padapter->HalData =vzalloc (padapter->hal_data_sz); -if (padapter->HalData ==NULL ) { +if (!padapter->HalData) {DBG_8192C ("cannot alloc memory for HAL DATA\n" );return _FAIL; }@@ -909,7 +909,7 @@ s32 c2h_evt_read_88xx(struct adapter *adapter, u8*buf)
drivers/staging/rtl8723bs/hal/hal_com.c void rtw_hal_update_sta_rate_mask(struct adapter
Quoted 9 lines
drivers/staging/rtl8723bs/hal/hal_com.c +1
-1int i;u8 trigger; -if (buf ==NULL ) +if (!buf) goto exit; trigger =rtw_read8 (adapter,REG_C2HEVT_CLEAR );@@ -982,7 +982,7 @@ void rtw_hal_update_sta_rate_mask(struct adapter*padapter, struct
sta_info*pstdrivers/staging/rtl8723bs/hal/hal_com.c bool GetHexValueFromString(char *szStr, u32
Quoted 9 lines
drivers/staging/rtl8723bs/hal/hal_com.c +1
-1u8 i, rf_type, limit;u32 tx_ra_bitmap; -if (psta ==NULL ) +if (!psta)return ; tx_ra_bitmap =0 ;@@ -1407,7 +1407,7 @@ bool GetHexValueFromString(char *szStr, u32*pu4bVal, u32 *pu4bMove)
drivers/staging/rtl8723bs/hal/hal_com.c bool GetHexValueFromString(char *szStr, u32 *pu4bVal, u32 *pu4bMove)
Quoted 6 lines
drivers/staging/rtl8723bs/hal/hal_com.c +1
-1char *szScan = szStr;/* Check input parameter. */ -if (szStr ==NULL || pu4bVal ==NULL || pu4bMove ==NULL ) { +if (!szStr || !pu4bVal || !pu4bMove) { DBG_871X("GetHexValueFromString(): Invalid inputarguments! szStr: %p, pu4bVal: %p, pu4bMove: %p\n",
Quoted 7 lines
drivers/staging/rtl8723bs/hal/hal_com.c +0
-1szStr, pu4bVal, pu4bMove);return false; --2.17.1
--
You received this message because you are subscribed to the GoogleGroups "outreachy-kernel" group.
Quoted 1 line
To unsubscribe from this group and stop receiving emails from it, send
an email to [email protected].
Quoted 2 lines
To post to this group, send email to [email protected]. To view this discussion on the web visit
https://groups.google.com/d/msgid/outreachy-kernel/20190316102759.20272-4-himadri18.07%40gmail.com
.Quoted 2 lines
For more options, visit https://groups.google.com/d/optout.
--
You received this message because you are subscribed to the Google Groups "outreachy-kernel" group.
To unsubscribe from this group and stop receiving emails from it, send an email to [email protected].
To post to this group, send email to [email protected]. To view this discussion on the web visit
https://groups.google.com/d/msgid/outreachy-kernel/alpine.DEB.2.21.1903161317440.2487%40hadrien
.
For more options, visit https://groups.google.com/d/optout.
Re: [Outreachy kernel] [PATCH 3/3] staging: rtl8723bs: hal: Remove comparision to NULL
Quoted 59 lines · Himadri Pandya
On Sat, 16 Mar, 2019, 5:48 PM Julia Lawall, <[email protected]> wrote:
On Sat, 16 Mar 2019, Himadri Pandya wrote: > Remove comparision to NULL. Suggested by Coccinelle. > > Signed-off-by: Himadri Pandya <[email protected]> > --- > drivers/staging/rtl8723bs/hal/hal_btcoex.c | 8 ++++---- > drivers/staging/rtl8723bs/hal/hal_com.c | 8 ++++---- > 2 files changed, 8 insertions(+), 8 deletions(-) > > diff --git a/drivers/staging/rtl8723bs/hal/hal_btcoex.c b/drivers/staging/rtl8723bs/hal/hal_btcoex.c > index 2b43f6d3c762..8eb28f97ebcc 100644 > --- a/drivers/staging/rtl8723bs/hal/hal_btcoex.c > +++ b/drivers/staging/rtl8723bs/hal/hal_btcoex.c > @@ -75,7 +75,7 @@ static BTCDBGINFO GLBtcDbgInfo; > > static void DBG_BT_INFO_INIT(PBTCDBGINFO pinfo, u8 *pbuf, u32 size) > { > - if (NULL == pinfo) > + if (!pinfo) > return; > > memset(pinfo, 0, sizeof(BTCDBGINFO)); > @@ -95,7 +95,7 @@ void DBG_BT_INFO(u8 *dbgmsg) > > pinfo = &GLBtcDbgInfo; > > - if (NULL == pinfo->info) > + if (!pinfo->info) > return; > > msglen = strlen(dbgmsg); > @@ -1571,7 +1571,7 @@ void hal_btcoex_SetDBG(struct adapter *padapter, u32 *pDbgModule) > u32 i; > > > - if (NULL == pDbgModule) > + if (!pDbgModule) > return; > > for (i = 0; i < BTC_MSG_MAX; i++) > @@ -1585,7 +1585,7 @@ u32 hal_btcoex_GetDBG(struct adapter *padapter, u8 *pStrBuf, u32 bufSize) > u32 leftSize; > > > - if ((NULL == pStrBuf) || (0 == bufSize)) > + if (!pStrBuf || (0 == bufSize)) It's another issue, so not for this patch, but the kernel prefers constants on the right. julia
Quoted 3 lines
I couldn't understand. Should I resend this patch as well? Or it should not be part of this patchset?
Constants on the right means "pStrBuf == NULL" instead of "NULL == pStrBuf", right? In that case, if I'm removing the comparison itself, I guess it is okay. Please correct me if I'm mistaken.
I was referring to the 0, actually, which is on the left. If you want to make that change too, then it would be another patch in this series. But it's not obligatory, it was just an observation.
julia
Quoted 69 lines
Thank you.
- Himadri
> return 0; > > pstr = pStrBuf; > diff --git a/drivers/staging/rtl8723bs/hal/hal_com.c b/drivers/staging/rtl8723bs/hal/hal_com.c > index 7f8ec55b08f1..b97b53c34449 100644 > --- a/drivers/staging/rtl8723bs/hal/hal_com.c > +++ b/drivers/staging/rtl8723bs/hal/hal_com.c > @@ -18,7 +18,7 @@ u8 rtw_hal_data_init(struct adapter *padapter) > if (is_primary_adapter(padapter)) { /* if (padapter->isprimary) */ > padapter->hal_data_sz = sizeof(struct hal_com_data); > padapter->HalData = vzalloc(padapter->hal_data_sz); > - if (padapter->HalData == NULL) { > + if (!padapter->HalData) { > DBG_8192C("cannot alloc memory for HAL DATA\n"); > return _FAIL; > } > @@ -909,7 +909,7 @@ s32 c2h_evt_read_88xx(struct adapter *adapter, u8 *buf) > int i; > u8 trigger; > > - if (buf == NULL) > + if (!buf) > goto exit; > > trigger = rtw_read8(adapter, REG_C2HEVT_CLEAR); > @@ -982,7 +982,7 @@ void rtw_hal_update_sta_rate_mask(struct adapter *padapter, struct sta_info *pst > u8 i, rf_type, limit; > u32 tx_ra_bitmap; > > - if (psta == NULL) > + if (!psta) > return; > > tx_ra_bitmap = 0; > @@ -1407,7 +1407,7 @@ bool GetHexValueFromString(char *szStr, u32 *pu4bVal, u32 *pu4bMove) > char *szScan = szStr; > > /* Check input parameter. */ > - if (szStr == NULL || pu4bVal == NULL || pu4bMove == NULL) { > + if (!szStr || !pu4bVal || !pu4bMove) { > DBG_871X("GetHexValueFromString(): Invalid input arguments! szStr: %p, pu4bVal: %p, pu4bMove: %p\n", > szStr, pu4bVal, pu4bMove); > return false; > -- > 2.17.1 > > -- > You received this message because you are subscribed to the Google Groups "outreachy-kernel" group. > To unsubscribe from this group and stop receiving emails from it, send an email to [email protected]. > To post to this group, send email to [email protected]. > To view this discussion on the web visit https://groups.google.com/d/msgid/outreachy-kernel/20190316102759.20272-4-himadri18.07%40gmail.com. > For more options, visit https://groups.google.com/d/optout. > -- You received this message because you are subscribed to the Google Groups "outreachy-kernel" group. To unsubscribe from this group and stop receiving emails from it, send an email to [email protected]. To post to this group, send email to [email protected]. To view this discussion on the web visit https://groups.google.com/d/msgid/outreachy-kernel/alpine.DEB.2.21.1903161317440.2487%40hadrien. For more options, visit https://groups.google.com/d/optout.
Re: [Outreachy kernel] [PATCH 3/3] staging: rtl8723bs: hal: Remove comparision to NULL
Quoted 68 lines · Julia Lawall,
Quoted 3 lines · Himadri Pandya
On Sat, 16 Mar, 2019, 5:48 PM Julia Lawall, <[email protected]>
Quoted 13 lines · wrote:
On Sat, 16 Mar 2019, Himadri Pandya wrote: > Remove comparision to NULL. Suggested by Coccinelle. > > Signed-off-by: Himadri Pandya <[email protected]> > --- > drivers/staging/rtl8723bs/hal/hal_btcoex.c | 8 ++++---- > drivers/staging/rtl8723bs/hal/hal_com.c | 8 ++++---- > 2 files changed, 8 insertions(+), 8 deletions(-) > > diff --git a/drivers/staging/rtl8723bs/hal/hal_btcoex.c
b/drivers/staging/rtl8723bs/hal/hal_btcoex.cQuoted 6 lines
> index 2b43f6d3c762..8eb28f97ebcc 100644 > --- a/drivers/staging/rtl8723bs/hal/hal_btcoex.c > +++ b/drivers/staging/rtl8723bs/hal/hal_btcoex.c > @@ -75,7 +75,7 @@ static BTCDBGINFO GLBtcDbgInfo; > > static void DBG_BT_INFO_INIT(PBTCDBGINFO pinfo, u8 *pbuf, u32size)
Quoted 8 lines
> { > - if (NULL == pinfo) > + if (!pinfo) > return; > > memset(pinfo, 0, sizeof(BTCDBGINFO)); > @@ -95,7 +95,7 @@ void DBG_BT_INFO(u8 *dbgmsg) >Quoted 8 lines
> pinfo = &GLBtcDbgInfo; > > - if (NULL == pinfo->info) > + if (!pinfo->info) > return; > > msglen = strlen(dbgmsg); > @@ -1571,7 +1571,7 @@ void hal_btcoex_SetDBG(struct adapter*padapter, u32 *pDbgModule)
Quoted 9 lines
> u32 i; > > > - if (NULL == pDbgModule) > + if (!pDbgModule) > return; > > for (i = 0; i < BTC_MSG_MAX; i++) > @@ -1585,7 +1585,7 @@ u32 hal_btcoex_GetDBG(struct adapter*padapter, u8 *pStrBuf, u32 bufSize)
Quoted 12 lines
> u32 leftSize; > > > - if ((NULL == pStrBuf) || (0 == bufSize)) > + if (!pStrBuf || (0 == bufSize)) It's another issue, so not for this patch, but the kernel prefers constants on the right. julia
Quoted 8 lines
Quoted 1 line
I couldn't understand. Should I resend this patch as well? Or it should
not be part of this patchset?
Quoted 2 lines
Constants on the right means "pStrBuf == NULL" instead of "NULL ==
pStrBuf", right? In that case, if I'm removing the comparison itself, I guess it is okay. Please correct me if I'm mistaken.
I was referring to the 0, actually, which is on the left.
Understood.
If you want to
Quoted 5 lines
make that change too, then it would be another patch in this series. But it's not obligatory, it was just an observation.
julia
I'll do that. Thank you.
- Himadri
Quoted 99 lines
Quoted 10 lines
Thank you.
- Himadri
> return 0; > > pstr = pStrBuf; > diff --git a/drivers/staging/rtl8723bs/hal/hal_com.c
b/drivers/staging/rtl8723bs/hal/hal_com.cQuoted 5 lines
> index 7f8ec55b08f1..b97b53c34449 100644 > --- a/drivers/staging/rtl8723bs/hal/hal_com.c > +++ b/drivers/staging/rtl8723bs/hal/hal_com.c > @@ -18,7 +18,7 @@ u8 rtw_hal_data_init(struct adapter *padapter) > if (is_primary_adapter(padapter)) { /* if(
padapter->isprimary) */Quoted 1 line
> padapter->hal_data_sz = sizeof(struct
hal_com_data);Quoted 4 lines
> padapter->HalData = vzalloc(padapter->hal_data_sz); > - if (padapter->HalData == NULL) { > + if (!padapter->HalData) {> DBG_8192C("cannot alloc memory for HAL
DATA\n");
Quoted 3 lines
> return _FAIL; > } > @@ -909,7 +909,7 @@ s32 c2h_evt_read_88xx(struct adapter*adapter, u8 *buf)
Quoted 9 lines
> int i; > u8 trigger; > > - if (buf == NULL) > + if (!buf) > goto exit; > > trigger = rtw_read8(adapter, REG_C2HEVT_CLEAR); > @@ -982,7 +982,7 @@ void rtw_hal_update_sta_rate_mask(structadapter *padapter, struct
sta_info*pstQuoted 9 lines
> u8 i, rf_type, limit; > u32 tx_ra_bitmap; > > - if (psta == NULL) > + if (!psta) > return; > > tx_ra_bitmap = 0; > @@ -1407,7 +1407,7 @@ bool GetHexValueFromString(char *szStr,u32 *pu4bVal, u32 *pu4bMove)
Quoted 6 lines
> char *szScan = szStr; > > /* Check input parameter. */ > - if (szStr == NULL || pu4bVal == NULL || pu4bMove == NULL) { > + if (!szStr || !pu4bVal || !pu4bMove) { > DBG_871X("GetHexValueFromString(): Invalid inputarguments! szStr: %p, pu4bVal: %p, pu4bMove: %p\n",
Quoted 7 lines
> szStr, pu4bVal, pu4bMove); > return false; > -- > 2.17.1 > > -- > You received this message because you are subscribed to theGoogle Groups "outreachy-kernel" group.
Quoted 1 line
> To unsubscribe from this group and stop receiving emails from
it, send an email to [email protected].
Quoted 1 line
> To post to this group, send email to
Quoted 1 line
> To view this discussion on the web visit
https://groups.google.com/d/msgid/outreachy-kernel/20190316102759.20272-4-himadri18.07%40gmail.com
.Quoted 5 lines
> For more options, visit https://groups.google.com/d/optout.
>--
You received this message because you are subscribed to the GoogleGroups "outreachy-kernel" group.
Quoted 1 line
To unsubscribe from this group and stop receiving emails from it,
send an email to [email protected].
Quoted 1 line
To post to this group, send email to
Quoted 1 line
To view this discussion on the web visit
https://groups.google.com/d/msgid/outreachy-kernel/alpine.DEB.2.21.1903161317440.2487%40hadrien
.Quoted 4 lines
For more options, visit https://groups.google.com/d/optout.
--
You received this message because you are subscribed to the Google Groups "outreachy-kernel" group.
To unsubscribe from this group and stop receiving emails from it, send an email to [email protected].
To post to this group, send email to [email protected]. To view this discussion on the web visit
https://groups.google.com/d/msgid/outreachy-kernel/alpine.DEB.2.21.1903161334160.2487%40hadrien
.
For more options, visit https://groups.google.com/d/optout.
Quoted 6 lines · Himadri Pandya
- This patchset removes comparision to NULL in various files of
drivers/staging/rtl8723bs/hal/.- The changes are broken into 3 separate patches to keep the length of each patch below/near 100 lines for convinient reviewing.
Quoted 6 lines
- All patches have the same subject line as they all do the exact same thing.
Himadri Pandya (3):
staging: rtl8723bs: hal: Remove comparision to NULL
staging: rtl8723bs: hal: Remove comparision to NULL
staging: rtl8723bs: hal: Remove comparision to NULL
While it's a good thought to limit the patch size, you also have to come up with different subject lines for each patch.
julia
Quoted 18 lines
drivers/staging/rtl8723bs/hal/hal_btcoex.c | 8 ++++---- drivers/staging/rtl8723bs/hal/hal_com.c | 8 ++++---- drivers/staging/rtl8723bs/hal/hal_com_phycfg.c | 18 +++++++++--------- drivers/staging/rtl8723bs/hal/rtl8723b_cmd.c | 8 ++++---- drivers/staging/rtl8723bs/hal/rtl8723bs_xmit.c | 6 +++--- 5 files changed, 24 insertions(+), 24 deletions(-)--
2.17.1--
You received this message because you are subscribed to the Google Groups "outreachy-kernel" group.
To unsubscribe from this group and stop receiving emails from it, send an email to [email protected]. To post to this group, send email to [email protected].
To view this discussion on the web visit https://groups.google.com/d/msgid/outreachy-kernel/20190316102759.20272-1-himadri18.07%40gmail.com.
For more options, visit https://groups.google.com/d/optout.
Quoted 18 lines · Julia Lawall,
Quoted 7 lines · Himadri Pandya
- This patchset removes comparision to NULL in various files of
drivers/staging/rtl8723bs/hal/.- The changes are broken into 3 separate patches to keep the length of each patch below/near 100 lines for convinient reviewing.
- All patches have the same subject line as they all do the exact same
thing.
Quoted 5 lines
Himadri Pandya (3):
staging: rtl8723bs: hal: Remove comparision to NULL
staging: rtl8723bs: hal: Remove comparision to NULL
staging: rtl8723bs: hal: Remove comparision to NULL
Quoted 5 lines
While it's a good thought to limit the patch size, you also have to come up with different subject lines for each patch.
julia
Okay. Sending version 2 with different subject lines.
- Himadri
Quoted 35 lines
Quoted 9 lines
drivers/staging/rtl8723bs/hal/hal_btcoex.c | 8 ++++---- drivers/staging/rtl8723bs/hal/hal_com.c | 8 ++++---- drivers/staging/rtl8723bs/hal/hal_com_phycfg.c | 18 +++++++++--------- drivers/staging/rtl8723bs/hal/rtl8723b_cmd.c | 8 ++++---- drivers/staging/rtl8723bs/hal/rtl8723bs_xmit.c | 6 +++--- 5 files changed, 24 insertions(+), 24 deletions(-)Quoted 5 lines
--
2.17.1--
You received this message because you are subscribed to the GoogleGroups "outreachy-kernel" group.
Quoted 1 line
To unsubscribe from this group and stop receiving emails from it, send
an email to [email protected].
Quoted 2 lines
To post to this group, send email to [email protected]. To view this discussion on the web visit
https://groups.google.com/d/msgid/outreachy-kernel/20190316102759.20272-1-himadri18.07%40gmail.com
.Quoted 2 lines
For more options, visit https://groups.google.com/d/optout.
--
You received this message because you are subscribed to the Google Groups "outreachy-kernel" group.
To unsubscribe from this group and stop receiving emails from it, send an email to [email protected].
To post to this group, send email to [email protected]. To view this discussion on the web visit
https://groups.google.com/d/msgid/outreachy-kernel/alpine.DEB.2.21.1903161313530.2487%40hadrien
.
For more options, visit https://groups.google.com/d/optout.