Re: [PATCH v4 5/5] staging: rtl8723bs: remove duplicate rate checks in PHY_GetTxPowerIndexBase()

"Luka Gejak" <[email protected]>
Newsgroups dev.linux.lists.linux-kernel-mentees,dev.linux.lists.linux-staging,org.kernel.vger.linux-kernel
Message-ID <[email protected]>
On Thu Apr 9, 2026 at 3:50 PM CEST, Prithvi Tambewagh wrote:
> The code previously checked (Rate >= MGN_MCS0 && Rate <= MGN_MCS7)
> condition twice - once for the (BandWidth == CHANNEL_WIDTH_20) check and
> once for the (BandWidth == CHANNEL_WIDTH_40) check. Fix if statement
> formatting to move that if check as an outer if check to improve code
> formatting.
>
> Signed-off-by: Prithvi Tambewagh <[email protected]>
> ---
>  drivers/staging/rtl8723bs/hal/hal_com_phycfg.c | 7 +++----
>  1 file changed, 3 insertions(+), 4 deletions(-)
>
> diff --git a/drivers/staging/rtl8723bs/hal/hal_com_phycfg.c b/drivers/staging/rtl8723bs/hal/hal_com_phycfg.c
> index 2746da0a9846..45dbe1782bae 100644
> --- a/drivers/staging/rtl8723bs/hal/hal_com_phycfg.c
> +++ b/drivers/staging/rtl8723bs/hal/hal_com_phycfg.c
> @@ -473,11 +473,10 @@ u8 PHY_GetTxPowerIndexBase(
>  	if ((Rate >= MGN_6M && Rate <= MGN_54M) && !IS_CCK_RATE(Rate))
>  		txPower += pHalData->OFDM_24G_Diff[RFPath][TX_1S];
>  
> -	if (BandWidth == CHANNEL_WIDTH_20) { /*  BW20-1S, BW20-2S */
> -		if (MGN_MCS0 <= Rate && Rate <= MGN_MCS7)
> +	if (Rate >= MGN_MCS0 && Rate <= MGN_MCS7) {
> +		if (BandWidth == CHANNEL_WIDTH_20) /*  BW20-1S, BW20-2S */
>  			txPower += pHalData->BW20_24G_Diff[RFPath][TX_1S];
> -	} else if (BandWidth == CHANNEL_WIDTH_40) { /*  BW40-1S, BW40-2S */
> -		if (MGN_MCS0 <= Rate && Rate <= MGN_MCS7)
> +		else if (BandWidth == CHANNEL_WIDTH_40) /*  BW40-1S, BW40-2S */
>  			txPower += pHalData->BW40_24G_Diff[RFPath][TX_1S];
>  	}
>  

LGTM.
Reviewed-by: Luka Gejak <[email protected]>

Best regards,
Luka Gejak
lmpx.com only provides a reader for public news (NNTP) servers. It is not affiliated with the servers or forums shown here and is not responsible for the content of articles, which is written by their respective authors.