diff mbox series

[next] wifi: rtw89: 8852a: remove redundant else statement

Message ID 20241030131416.3091954-1-colin.i.king@gmail.com (mailing list archive)
State Changes Requested
Delegated to: Ping-Ke Shih
Headers show
Series [next] wifi: rtw89: 8852a: remove redundant else statement | expand

Commit Message

Colin Ian King Oct. 30, 2024, 1:14 p.m. UTC
The cascaded if statements covers all 16 bit values in the comparisons
of dgain and the last else statement is not reachable and hence
dead code. Remove it.

Signed-off-by: Colin Ian King <colin.i.king@gmail.com>
---
 drivers/net/wireless/realtek/rtw89/rtw8852a_rfk.c | 2 --
 1 file changed, 2 deletions(-)

Comments

Jeff Johnson Oct. 30, 2024, 8:55 p.m. UTC | #1
On 10/30/2024 6:14 AM, Colin Ian King wrote:
> The cascaded if statements covers all 16 bit values in the comparisons
> of dgain and the last else statement is not reachable and hence
> dead code. Remove it.
> 
> Signed-off-by: Colin Ian King <colin.i.king@gmail.com>
> ---
>  drivers/net/wireless/realtek/rtw89/rtw8852a_rfk.c | 2 --
>  1 file changed, 2 deletions(-)
> 
> diff --git a/drivers/net/wireless/realtek/rtw89/rtw8852a_rfk.c b/drivers/net/wireless/realtek/rtw89/rtw8852a_rfk.c
> index 9db8713ac99b..f3568c4d0af6 100644
> --- a/drivers/net/wireless/realtek/rtw89/rtw8852a_rfk.c
> +++ b/drivers/net/wireless/realtek/rtw89/rtw8852a_rfk.c
> @@ -2248,8 +2248,6 @@ static s8 _dpk_dgain_mapping(struct rtw89_dev *rtwdev, u16 dgain)
>  		offset = -9;
>  	else if (dgain <= 0x155)

should you drop the test and unconditionally return -12 here?

>  		offset = -12;
> -	else
> -		offset = 0x0;
>  
>  	return offset;
>  }
Ping-Ke Shih Oct. 31, 2024, 2:22 a.m. UTC | #2
Jeff Johnson <quic_jjohnson@quicinc.com> wrote:
> On 10/30/2024 6:14 AM, Colin Ian King wrote:
> > The cascaded if statements covers all 16 bit values in the comparisons
> > of dgain and the last else statement is not reachable and hence
> > dead code. Remove it.
> >
> > Signed-off-by: Colin Ian King <colin.i.king@gmail.com>
> > ---
> >  drivers/net/wireless/realtek/rtw89/rtw8852a_rfk.c | 2 --
> >  1 file changed, 2 deletions(-)
> >
> > diff --git a/drivers/net/wireless/realtek/rtw89/rtw8852a_rfk.c b/drivers/net/wireless/realtek/rtw89/rtw8852a_rfk.c
> > index 9db8713ac99b..f3568c4d0af6 100644
> > --- a/drivers/net/wireless/realtek/rtw89/rtw8852a_rfk.c
> > +++ b/drivers/net/wireless/realtek/rtw89/rtw8852a_rfk.c
> > @@ -2248,8 +2248,6 @@ static s8 _dpk_dgain_mapping(struct rtw89_dev *rtwdev, u16 dgain)
> >               offset = -9;
> >       else if (dgain <= 0x155)
> 
> should you drop the test and unconditionally return -12 here?

Agree +1. People don't suspect the else case at first glance. 

> 
> >               offset = -12;
> > -     else
> > -             offset = 0x0;
> >
> >       return offset;
> >  }
>
diff mbox series

Patch

diff --git a/drivers/net/wireless/realtek/rtw89/rtw8852a_rfk.c b/drivers/net/wireless/realtek/rtw89/rtw8852a_rfk.c
index 9db8713ac99b..f3568c4d0af6 100644
--- a/drivers/net/wireless/realtek/rtw89/rtw8852a_rfk.c
+++ b/drivers/net/wireless/realtek/rtw89/rtw8852a_rfk.c
@@ -2248,8 +2248,6 @@  static s8 _dpk_dgain_mapping(struct rtw89_dev *rtwdev, u16 dgain)
 		offset = -9;
 	else if (dgain <= 0x155)
 		offset = -12;
-	else
-		offset = 0x0;
 
 	return offset;
 }