2023-02-17 18:49:55

by Bitterblue Smith

[permalink] [raw]
Subject: [PATCH] wifi: rtl8xxxu: Remove always true condition in rtl8xxxu_print_chipinfo

Fix a new smatch warning:
drivers/net/wireless/realtek/rtl8xxxu/rtl8xxxu_core.c:1580 rtl8xxxu_print_chipinfo() warn: always true condition '(priv->chip_cut <= 15) => (0-15 <= 15)'

Reported-by: kernel test robot <[email protected]>
Link: https://lore.kernel.org/oe-kbuild-all/[email protected]/
Fixes: 7b0ac469e331 ("wifi: rtl8xxxu: Recognise all possible chip cuts")
Signed-off-by: Bitterblue Smith <[email protected]>
---
drivers/net/wireless/realtek/rtl8xxxu/rtl8xxxu_core.c | 6 +-----
1 file changed, 1 insertion(+), 5 deletions(-)

diff --git a/drivers/net/wireless/realtek/rtl8xxxu/rtl8xxxu_core.c b/drivers/net/wireless/realtek/rtl8xxxu/rtl8xxxu_core.c
index 620a5cc2bfdd..54ca6f2ced3f 100644
--- a/drivers/net/wireless/realtek/rtl8xxxu/rtl8xxxu_core.c
+++ b/drivers/net/wireless/realtek/rtl8xxxu/rtl8xxxu_core.c
@@ -1575,11 +1575,7 @@ rtl8xxxu_set_spec_sifs(struct rtl8xxxu_priv *priv, u16 cck, u16 ofdm)
static void rtl8xxxu_print_chipinfo(struct rtl8xxxu_priv *priv)
{
struct device *dev = &priv->udev->dev;
- char cut = '?';
-
- /* Currently always true: chip_cut is 4 bits. */
- if (priv->chip_cut <= 15)
- cut = 'A' + priv->chip_cut;
+ char cut = 'A' + priv->chip_cut;

dev_info(dev,
"RTL%s rev %c (%s) romver %d, %iT%iR, TX queues %i, WiFi=%i, BT=%i, GPS=%i, HI PA=%i\n",
--
2.39.1


2023-02-20 00:32:56

by Ping-Ke Shih

[permalink] [raw]
Subject: RE: [PATCH] wifi: rtl8xxxu: Remove always true condition in rtl8xxxu_print_chipinfo



> -----Original Message-----
> From: Bitterblue Smith <[email protected]>
> Sent: Saturday, February 18, 2023 2:49 AM
> To: [email protected]
> Cc: Jes Sorensen <[email protected]>; Ping-Ke Shih <[email protected]>
> Subject: [PATCH] wifi: rtl8xxxu: Remove always true condition in rtl8xxxu_print_chipinfo
>
> Fix a new smatch warning:
> drivers/net/wireless/realtek/rtl8xxxu/rtl8xxxu_core.c:1580 rtl8xxxu_print_chipinfo() warn: always true
> condition '(priv->chip_cut <= 15) => (0-15 <= 15)'
>
> Reported-by: kernel test robot <[email protected]>
> Link: https://lore.kernel.org/oe-kbuild-all/[email protected]/
> Fixes: 7b0ac469e331 ("wifi: rtl8xxxu: Recognise all possible chip cuts")
> Signed-off-by: Bitterblue Smith <[email protected]>

Reviewed-by: Ping-Ke Shih <[email protected]>

> ---
> drivers/net/wireless/realtek/rtl8xxxu/rtl8xxxu_core.c | 6 +-----
> 1 file changed, 1 insertion(+), 5 deletions(-)
>
> diff --git a/drivers/net/wireless/realtek/rtl8xxxu/rtl8xxxu_core.c
> b/drivers/net/wireless/realtek/rtl8xxxu/rtl8xxxu_core.c
> index 620a5cc2bfdd..54ca6f2ced3f 100644
> --- a/drivers/net/wireless/realtek/rtl8xxxu/rtl8xxxu_core.c
> +++ b/drivers/net/wireless/realtek/rtl8xxxu/rtl8xxxu_core.c
> @@ -1575,11 +1575,7 @@ rtl8xxxu_set_spec_sifs(struct rtl8xxxu_priv *priv, u16 cck, u16 ofdm)
> static void rtl8xxxu_print_chipinfo(struct rtl8xxxu_priv *priv)
> {
> struct device *dev = &priv->udev->dev;
> - char cut = '?';
> -
> - /* Currently always true: chip_cut is 4 bits. */
> - if (priv->chip_cut <= 15)
> - cut = 'A' + priv->chip_cut;
> + char cut = 'A' + priv->chip_cut;
>
> dev_info(dev,
> "RTL%s rev %c (%s) romver %d, %iT%iR, TX queues %i, WiFi=%i, BT=%i, GPS=%i, HI PA=%i\n",
> --
> 2.39.1
>
> ------Please consider the environment before printing this e-mail.

2023-02-22 12:31:29

by Kalle Valo

[permalink] [raw]
Subject: Re: [PATCH] wifi: rtl8xxxu: Remove always true condition in rtl8xxxu_print_chipinfo

Bitterblue Smith <[email protected]> wrote:

> Fix a new smatch warning:
> drivers/net/wireless/realtek/rtl8xxxu/rtl8xxxu_core.c:1580 rtl8xxxu_print_chipinfo() warn: always true condition '(priv->chip_cut <= 15) => (0-15 <= 15)'
>
> Reported-by: kernel test robot <[email protected]>
> Link: https://lore.kernel.org/oe-kbuild-all/[email protected]/
> Fixes: 7b0ac469e331 ("wifi: rtl8xxxu: Recognise all possible chip cuts")
> Signed-off-by: Bitterblue Smith <[email protected]>
> Reviewed-by: Ping-Ke Shih <[email protected]>

Patch applied to wireless-next.git, thanks.

b9b1e4fe2957 wifi: rtl8xxxu: Remove always true condition in rtl8xxxu_print_chipinfo

--
https://patchwork.kernel.org/project/linux-wireless/patch/[email protected]/

https://wireless.wiki.kernel.org/en/developers/documentation/submittingpatches