Skip to contentSkip to conversation

staging: rtl8723bs: hal: remove if condition which is always false

PATCH In review Saurav Girepunje 3 participants 5 messages Oct 10, 2021 – Oct 11, 2021 Staging

lore
Share & tools
lore
#0 lore raw

PATCH 1/1 staging: rtl8723bs: hal: remove if condition which is always false

Remove the if condition which is always false. The last update on variable max_rf_path is value 1. It's value is not changing after that. So if condition check for value 2 will be always false only.

---
 drivers/staging/rtl8723bs/hal/odm_NoiseMonitor.c | 10 ++++------
 1 file changed, 4 insertions(+), 6 deletions(-)
drivers/staging/rtl8723bs/hal/odm_NoiseMonitor.c +4 -6
index 392cc8a398f5..612575ba961a 100644
@@ -106,12 +106,10 @@ static s16 odm_InbandNoise_Monitor_NSeries(
 	pDM_Odm->noise_level.noise[RF_PATH_A] = -110 + reg_c50 + noise_data.sum[RF_PATH_A];
 	pDM_Odm->noise_level.noise_all += pDM_Odm->noise_level.noise[RF_PATH_A];
 
-	if (max_rf_path == 2) {
-		reg_c58 = (s32)PHY_QueryBBReg(pDM_Odm->Adapter, rOFDM0_XBAGCCore1, bMaskByte0);
-		reg_c58 &= ~BIT7;
-		pDM_Odm->noise_level.noise[RF_PATH_B] = -110 + reg_c58 + noise_data.sum[RF_PATH_B];
-		pDM_Odm->noise_level.noise_all += pDM_Odm->noise_level.noise[RF_PATH_B];
-	}
+	reg_c58 = (s32)PHY_QueryBBReg(pDM_Odm->Adapter, rOFDM0_XBAGCCore1, bMaskByte0);
+	reg_c58 &= ~BIT7;
+	pDM_Odm->noise_level.noise[RF_PATH_B] = -110 + reg_c58 + noise_data.sum[RF_PATH_B];
+	pDM_Odm->noise_level.noise_all += pDM_Odm->noise_level.noise[RF_PATH_B];
 	pDM_Odm->noise_level.noise_all /= max_rf_path;
 
 	/*  */

--
2.32.0

#1 lore raw

Hello Surav,

thanks for your patch, see a comment below,

Quoted 18 lines · Saurav Girepunje

Remove the if condition which is always false. The last update on variable max_rf_path is value 1. It's value is not changing after that. So if condition check for value 2 will be always false only.

---
 drivers/staging/rtl8723bs/hal/odm_NoiseMonitor.c | 10 ++++------
 1 file changed, 4 insertions(+), 6 deletions(-)
drivers/staging/rtl8723bs/hal/odm_NoiseMonitor.c +0 -1
index 392cc8a398f5..612575ba961a 100644
@@ -106,12 +106,10 @@ static s16 odm_InbandNoise_Monitor_NSeries(
 	pDM_Odm->noise_level.noise[RF_PATH_A] = -110 + reg_c50 + noise_data.sum[RF_PATH_A];
 	pDM_Odm->noise_level.noise_all += pDM_Odm->noise_level.noise[RF_PATH_A];
 
-	if (max_rf_path == 2) {

drivers/staging/rtl8723bs/hal/odm_NoiseMonitor.c static s16 odm_InbandNoise_Monitor_NSeries( · line 113

Quoted 10 lines
drivers/staging/rtl8723bs/hal/odm_NoiseMonitor.c +4 -5
-		reg_c58 = (s32)PHY_QueryBBReg(pDM_Odm->Adapter, rOFDM0_XBAGCCore1, bMaskByte0);
-		reg_c58 &= ~BIT7;
-		pDM_Odm->noise_level.noise[RF_PATH_B] = -110 + reg_c58 + noise_data.sum[RF_PATH_B];
-		pDM_Odm->noise_level.noise_all += pDM_Odm->noise_level.noise[RF_PATH_B];
-	}
+	reg_c58 = (s32)PHY_QueryBBReg(pDM_Odm->Adapter, rOFDM0_XBAGCCore1, bMaskByte0);
+	reg_c58 &= ~BIT7;
+	pDM_Odm->noise_level.noise[RF_PATH_B] = -110 + reg_c58 + noise_data.sum[RF_PATH_B];
+	pDM_Odm->noise_level.noise_all += pDM_Odm->noise_level.noise[RF_PATH_B];
 	pDM_Odm->noise_level.noise_all /= max_rf_path;

If the condition is always false the whole block can be wiped out, why did you keep it? Did you change the logic here?

Quoted 5 lines
drivers/staging/rtl8723bs/hal/odm_NoiseMonitor.c +0 -1
 	/*  */
--

2.32.0

thank you,

fabio

#2 lore raw
Quoted 38 lines · Fabio Aiuto

Hello Surav,

thanks for your patch, see a comment below,

Quoted 18 lines · Saurav Girepunje

Remove the if condition which is always false. The last update on variable max_rf_path is value 1. It's value is not changing after that. So if condition check for value 2 will be always false only.

---
  drivers/staging/rtl8723bs/hal/odm_NoiseMonitor.c | 10 ++++------
  1 file changed, 4 insertions(+), 6 deletions(-)
drivers/staging/rtl8723bs/hal/odm_NoiseMonitor.c +0 -1
index 392cc8a398f5..612575ba961a 100644
@@ -106,12 +106,10 @@ static s16 odm_InbandNoise_Monitor_NSeries(
  	pDM_Odm->noise_level.noise[RF_PATH_A] = -110 + reg_c50 + noise_data.sum[RF_PATH_A];
  	pDM_Odm->noise_level.noise_all += pDM_Odm->noise_level.noise[RF_PATH_A];
 
-	if (max_rf_path == 2) {

drivers/staging/rtl8723bs/hal/odm_NoiseMonitor.c static s16 odm_InbandNoise_Monitor_NSeries( · line 113

Quoted 10 lines
drivers/staging/rtl8723bs/hal/odm_NoiseMonitor.c +4 -5
-		reg_c58 = (s32)PHY_QueryBBReg(pDM_Odm->Adapter, rOFDM0_XBAGCCore1, bMaskByte0);
-		reg_c58 &= ~BIT7;
-		pDM_Odm->noise_level.noise[RF_PATH_B] = -110 + reg_c58 + noise_data.sum[RF_PATH_B];
-		pDM_Odm->noise_level.noise_all += pDM_Odm->noise_level.noise[RF_PATH_B];
-	}
+	reg_c58 = (s32)PHY_QueryBBReg(pDM_Odm->Adapter, rOFDM0_XBAGCCore1, bMaskByte0);
+	reg_c58 &= ~BIT7;
+	pDM_Odm->noise_level.noise[RF_PATH_B] = -110 + reg_c58 + noise_data.sum[RF_PATH_B];
+	pDM_Odm->noise_level.noise_all += pDM_Odm->noise_level.noise[RF_PATH_B];
  	pDM_Odm->noise_level.noise_all /= max_rf_path;

If the condition is always false the whole block can be wiped out, why did you keep it? Did you change the logic here?

Quoted 1 line
Quoted 9 lines
Quoted 4 lines

/* */
--
2.32.0

thank you,

fabio

Thanks for review Fabio.
It is changing the logic . I should be careful for this. whole block of if statement should also be removed.

Please ignore this patch.

Regards,
Saurav

#3 lore raw

Yep. And please go through the function and clean up all the references to max_rf_path. Change the "max_rf_path = 0" to 1 and delete the other assignment. Delete the comments about "max_rf_path == 2".

regards,
dan carpenter

#4 lore raw
Quoted 7 lines · Dan Carpenter

Yep. And please go through the function and clean up all the references to max_rf_path. Change the "max_rf_path = 0" to 1 and delete the other assignment. Delete the comments about "max_rf_path == 2".

regards,
dan carpenter

Yes, Is it good if I send 2 patches one to remove "if condition which is always false" and another one to "clean-up all the references to max_rf_path" on a single patch series.

Regards,
Saurav