* [PATCH] staging: rtl8723bs: hal: remove if condition which is always false
@ 2021-10-10 7:32 Saurav Girepunje
2021-10-10 10:50 ` Fabio Aiuto
0 siblings, 1 reply; 5+ messages in thread
From: Saurav Girepunje @ 2021-10-10 7:32 UTC (permalink / raw)
To: gregkh, fabioaiuto83, marcocesati, dan.carpenter, lee.jones,
saurav.girepunje, linux-staging, linux-kernel
Cc: 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.
Signed-off-by: Saurav Girepunje <saurav.girepunje@gmail.com>
---
drivers/staging/rtl8723bs/hal/odm_NoiseMonitor.c | 10 ++++------
1 file changed, 4 insertions(+), 6 deletions(-)
diff --git a/drivers/staging/rtl8723bs/hal/odm_NoiseMonitor.c b/drivers/staging/rtl8723bs/hal/odm_NoiseMonitor.c
index 392cc8a398f5..612575ba961a 100644
--- a/drivers/staging/rtl8723bs/hal/odm_NoiseMonitor.c
+++ b/drivers/staging/rtl8723bs/hal/odm_NoiseMonitor.c
@@ -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
^ permalink raw reply related [flat|nested] 5+ messages in thread
* Re: [PATCH] staging: rtl8723bs: hal: remove if condition which is always false
2021-10-10 7:32 [PATCH] staging: rtl8723bs: hal: remove if condition which is always false Saurav Girepunje
@ 2021-10-10 10:50 ` Fabio Aiuto
2021-10-10 11:02 ` Saurav Girepunje
0 siblings, 1 reply; 5+ messages in thread
From: Fabio Aiuto @ 2021-10-10 10:50 UTC (permalink / raw)
To: Saurav Girepunje
Cc: gregkh, marcocesati, dan.carpenter, lee.jones, linux-staging,
linux-kernel, saurav.girepunje
Hello Surav,
thanks for your patch, see a comment below,
On Sun, Oct 10, 2021 at 01:02:56PM +0530, Saurav Girepunje wrote:
> 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.
>
> Signed-off-by: Saurav Girepunje <saurav.girepunje@gmail.com>
> ---
> drivers/staging/rtl8723bs/hal/odm_NoiseMonitor.c | 10 ++++------
> 1 file changed, 4 insertions(+), 6 deletions(-)
>
> diff --git a/drivers/staging/rtl8723bs/hal/odm_NoiseMonitor.c b/drivers/staging/rtl8723bs/hal/odm_NoiseMonitor.c
> index 392cc8a398f5..612575ba961a 100644
> --- a/drivers/staging/rtl8723bs/hal/odm_NoiseMonitor.c
> +++ b/drivers/staging/rtl8723bs/hal/odm_NoiseMonitor.c
> @@ -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;
If the condition is always false the whole block can be wiped out,
why did you keep it? Did you change the logic here?
>
> /* */
> --
> 2.32.0
>
thank you,
fabio
^ permalink raw reply [flat|nested] 5+ messages in thread
* Re: [PATCH] staging: rtl8723bs: hal: remove if condition which is always false
2021-10-10 10:50 ` Fabio Aiuto
@ 2021-10-10 11:02 ` Saurav Girepunje
2021-10-11 10:41 ` Dan Carpenter
0 siblings, 1 reply; 5+ messages in thread
From: Saurav Girepunje @ 2021-10-10 11:02 UTC (permalink / raw)
To: Fabio Aiuto
Cc: saurav.girepunje, gregkh, marcocesati, dan.carpenter, lee.jones,
linux-staging, linux-kernel
On 10/10/21 4:20 pm, Fabio Aiuto wrote:
> Hello Surav,
>
> thanks for your patch, see a comment below,
>
> On Sun, Oct 10, 2021 at 01:02:56PM +0530, Saurav Girepunje wrote:
>> 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.
>>
>> Signed-off-by: Saurav Girepunje <saurav.girepunje@gmail.com>
>> ---
>> drivers/staging/rtl8723bs/hal/odm_NoiseMonitor.c | 10 ++++------
>> 1 file changed, 4 insertions(+), 6 deletions(-)
>>
>> diff --git a/drivers/staging/rtl8723bs/hal/odm_NoiseMonitor.c b/drivers/staging/rtl8723bs/hal/odm_NoiseMonitor.c
>> index 392cc8a398f5..612575ba961a 100644
>> --- a/drivers/staging/rtl8723bs/hal/odm_NoiseMonitor.c
>> +++ b/drivers/staging/rtl8723bs/hal/odm_NoiseMonitor.c
>> @@ -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;
>
> If the condition is always false the whole block can be wiped out,
> why did you keep it? Did you change the logic here?
>
>>
>> /* */
>> --
>> 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
^ permalink raw reply [flat|nested] 5+ messages in thread
* Re: [PATCH] staging: rtl8723bs: hal: remove if condition which is always false
2021-10-10 11:02 ` Saurav Girepunje
@ 2021-10-11 10:41 ` Dan Carpenter
2021-10-11 17:11 ` Saurav Girepunje
0 siblings, 1 reply; 5+ messages in thread
From: Dan Carpenter @ 2021-10-11 10:41 UTC (permalink / raw)
To: Saurav Girepunje
Cc: Fabio Aiuto, saurav.girepunje, gregkh, marcocesati, lee.jones,
linux-staging, linux-kernel
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
^ permalink raw reply [flat|nested] 5+ messages in thread
* Re: [PATCH] staging: rtl8723bs: hal: remove if condition which is always false
2021-10-11 10:41 ` Dan Carpenter
@ 2021-10-11 17:11 ` Saurav Girepunje
0 siblings, 0 replies; 5+ messages in thread
From: Saurav Girepunje @ 2021-10-11 17:11 UTC (permalink / raw)
To: Dan Carpenter
Cc: Fabio Aiuto, saurav.girepunje, gregkh, marcocesati, lee.jones,
linux-staging, linux-kernel
On 11/10/21 4:11 pm, Dan Carpenter wrote:
> 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
^ permalink raw reply [flat|nested] 5+ messages in thread
end of thread, other threads:[~2021-10-11 17:11 UTC | newest]
Thread overview: 5+ messages (download: mbox.gz / follow: Atom feed)
-- links below jump to the message on this page --
2021-10-10 7:32 [PATCH] staging: rtl8723bs: hal: remove if condition which is always false Saurav Girepunje
2021-10-10 10:50 ` Fabio Aiuto
2021-10-10 11:02 ` Saurav Girepunje
2021-10-11 10:41 ` Dan Carpenter
2021-10-11 17:11 ` Saurav Girepunje
This is an external index of several public inboxes,
see mirroring instructions on how to clone and mirror
all data and code used by this external index.