lists.openwall.net   lists  /  announce  owl-users  owl-dev  john-users  john-dev  passwdqc-users  yescrypt  popa3d-users  /  oss-security  kernel-hardening  musl  sabotage  tlsify  passwords  /  crypt-dev  xvendor  /  Bugtraq  Full-Disclosure  linux-kernel  linux-netdev  linux-ext4  linux-hardening  linux-cve-announce  PHC 
Open Source and information security mailing list archives
 
Hash Suite: Windows password security audit tool. GUI, reports in PDF.
[<prev] [next>] [<thread-prev] [day] [month] [year] [list]
Message-ID: <CAGRGNgVzKyyG=Ld_eK60Ry=AQ7KpGx_ZKw908CAXoA3a2CVX4g@mail.gmail.com>
Date: Sun, 24 Aug 2025 10:39:00 +1000
From: Julian Calaby <julian.calaby@...il.com>
To: Liao Yuanhong <liaoyuanhong@...o.com>
Cc: Ping-Ke Shih <pkshih@...ltek.com>, 
	"open list:REALTEK WIRELESS DRIVER (rtw89)" <linux-wireless@...r.kernel.org>, open list <linux-kernel@...r.kernel.org>
Subject: Re: [PATCH] wifi: rtw89: 8852bt: Simplify unnecessary if-else conditions

Hi Liao,

On Mon, Aug 18, 2025 at 4:44 PM Liao Yuanhong <liaoyuanhong@...o.com> wrote:
>
> Some simple if-else logic can be simplified using the ! operator to improve
> code readability.
>
> Signed-off-by: Liao Yuanhong <liaoyuanhong@...o.com>
> ---
>  drivers/net/wireless/realtek/rtw89/rtw8852bt_rfk.c | 5 +----
>  1 file changed, 1 insertion(+), 4 deletions(-)
>
> diff --git a/drivers/net/wireless/realtek/rtw89/rtw8852bt_rfk.c b/drivers/net/wireless/realtek/rtw89/rtw8852bt_rfk.c
> index d0e299803225..164ee0fde03b 100644
> --- a/drivers/net/wireless/realtek/rtw89/rtw8852bt_rfk.c
> +++ b/drivers/net/wireless/realtek/rtw89/rtw8852bt_rfk.c
> @@ -1803,10 +1803,7 @@ static void _dpk_onoff(struct rtw89_dev *rtwdev, enum rtw89_rf_path path, bool o
>
>         val = dpk->is_dpk_enable && !off && dpk->bp[path][kidx].path_ok;

Is this line ^^^

>
> -       if (off)
> -               off_reverse = false;
> -       else
> -               off_reverse = true;
> +       off_reverse = !off;
>
>         val = dpk->is_dpk_enable & off_reverse & dpk->bp[path][kidx].path_ok;

The same as this line ^^^

and if so, can we just delete the second one? Also, can we also then
delete the "off_reverse" variable?

Thanks,

-- 
Julian Calaby

Email: julian.calaby@...il.com
Profile: http://www.google.com/profiles/julian.calaby/

Powered by blists - more mailing lists

Powered by Openwall GNU/*/Linux Powered by OpenVZ