staging: rtl8723bs: fix type issue in DYNAMIC_BB_DYNAMIC_TXPWR
PATCH v2 1/1 staging: rtl8723bs: fix type issue in DYNAMIC_BB_DYNAMIC_TXPWR
Add explicit cast to fix -Werror=overflow warning for BIT(2) usage in DYNAMIC_BB_DYNAMIC_TXPWR
---
Changes in v2:
- remove BIT2 macro in osdep_service.h
- migrate DYNAMIC_BB_DYNAMIC_TXPWR macro in rtw_mlme_ext.h to BIT(2)
- cast usage of DYNAMIC_BB_DYNAMIC_TXPWR to u32 in rtw_wlan_util.c
v1: https://lore.kernel.org/linux-staging/[email protected]
drivers/staging/rtl8723bs/core/rtw_wlan_util.c | 4 ++-- drivers/staging/rtl8723bs/include/osdep_service.h | 1 - drivers/staging/rtl8723bs/include/rtw_mlme_ext.h | 2 +- 3 files changed, 3 insertions(+), 4 deletions(-)
drivers/staging/rtl8723bs/core/rtw_wlan_util.c +2 -2
@@ -1476,13 +1476,13 @@ void update_IOT_info(struct adapter *padapter) pmlmeinfo->turboMode_cts2self =0 ; pmlmeinfo->turboMode_rtsen =1 ;/* disable high power */ -Switch_DM_Func (padapter, (~DYNAMIC_BB_DYNAMIC_TXPWR ), false); +Switch_DM_Func (padapter, ((u32)(~DYNAMIC_BB_DYNAMIC_TXPWR )), false);break ;case HT_IOT_PEER_REALTEK :/* rtw_write16(padapter, 0x4cc, 0xffff); */ /* rtw_write16(padapter, 0x546, 0x01c0); */ /* disable high power */ -Switch_DM_Func (padapter, (~DYNAMIC_BB_DYNAMIC_TXPWR ), false); +Switch_DM_Func (padapter, ((u32)(~DYNAMIC_BB_DYNAMIC_TXPWR )), false);break ;default : pmlmeinfo->turboMode_cts2self =0 ;
drivers/staging/rtl8723bs/include/osdep_service.h +0 -1
@@ -14,7 +14,6 @@#include <osdep_service_linux.h> -#define BIT2 0x00000004extern int RTW_STATUS_CODE (int error_code);
drivers/staging/rtl8723bs/include/rtw_mlme_ext.h +1 -1
@@ -28,7 +28,7 @@/* ====== ODM_ABILITY_E ======== */ /* BB ODM section BIT 0-15 */ #define DYNAMIC_BB_DIG BIT(0)/* ODM_BB_DIG */ -#define DYNAMIC_BB_DYNAMIC_TXPWR BIT2/* ODM_BB_DYNAMIC_TXPWR */ +#define DYNAMIC_BB_DYNAMIC_TXPWR BIT(2)/* ODM_BB_DYNAMIC_TXPWR */ #define DYNAMIC_BB_ANT_DIV BIT(6)/* ODM_BB_ANT_DIV */ /* RF ODM section BIT 24-31 */
Signature · 1 line
2.54.0
Quoted 5 lines · Michael Steinmötzger
Add explicit cast to fix -Werror=overflow warning for BIT(2) usage in
DYNAMIC_BB_DYNAMIC_TXPWRSuggested-by Nikolay Kulikov <[email protected]>Signed-off-by Michael Steinmötzger <[email protected]>
This does not apply to staging-next.
It's better to do this in a series of two patches, where in the first, replace BIT2 with BIT(2) and add a type cast, like here:
Quoted 36 lines
drivers/staging/rtl8723bs/core/rtw_wlan_util.c +2
-2@@ -1476,13 +1476,13 @@ void update_IOT_info(struct adapter *padapter) pmlmeinfo->turboMode_cts2self =0 ; pmlmeinfo->turboMode_rtsen =1 ;/* disable high power */ -Switch_DM_Func (padapter, (~DYNAMIC_BB_DYNAMIC_TXPWR ), false); +Switch_DM_Func (padapter, ((u32)(~DYNAMIC_BB_DYNAMIC_TXPWR )), false);break ;case HT_IOT_PEER_REALTEK :/* rtw_write16(padapter, 0x4cc, 0xffff); */ /* rtw_write16(padapter, 0x546, 0x01c0); */ /* disable high power */ -Switch_DM_Func (padapter, (~DYNAMIC_BB_DYNAMIC_TXPWR ), false); +Switch_DM_Func (padapter, ((u32)(~DYNAMIC_BB_DYNAMIC_TXPWR )), false);break ;default : pmlmeinfo->turboMode_cts2self =0 ;drivers/staging/rtl8723bs/include/rtw_mlme_ext.h +1
-1@@ -28,7 +28,7 @@/* ====== ODM_ABILITY_E ======== */ /* BB ODM section BIT 0-15 */ #define DYNAMIC_BB_DIG BIT(0)/* ODM_BB_DIG */ -#define DYNAMIC_BB_DYNAMIC_TXPWR BIT2/* ODM_BB_DYNAMIC_TXPWR */ +#define DYNAMIC_BB_DYNAMIC_TXPWR BIT(2)/* ODM_BB_DYNAMIC_TXPWR */ #define DYNAMIC_BB_ANT_DIV BIT(6)/* ODM_BB_ANT_DIV */ /* RF ODM section BIT 24-31 */ Signature · 1 line
2.54.0
And in the second, remove the BIT2 macro and all the othere, like in v1:
drivers/staging/rtl8723bs/include/osdep_service.h line 19
Quoted 12 lines
drivers/staging/rtl8723bs/include/osdep_service.h +0
-1@@ -14,7 +14,6 @@#include <osdep_service_linux.h> -#define BIT2 0x00000004extern int RTW_STATUS_CODE (int error_code);
Thanks,
Nikolay