* [PATCH] wifi: rtw89: fix rtw89_read_chip_ver() for RTL8852B and RTL8851B
@ 2023-04-21 10:44 Dan Carpenter
2023-04-21 11:48 ` Ping-Ke Shih
2023-05-05 12:01 ` Kalle Valo
0 siblings, 2 replies; 4+ messages in thread
From: Dan Carpenter @ 2023-04-21 10:44 UTC (permalink / raw)
To: Ping-Ke Shih; +Cc: Kalle Valo, linux-wireless, kernel-janitors
The if statement is reversed so it will not record the chip version.
This was detected using Smatch:
drivers/net/wireless/realtek/rtw89/core.c:3593 rtw89_read_chip_ver()
error: uninitialized symbol 'val'.
Fixes: a6fb2bb84654 ("wifi: rtw89: read version of analog hardware")
Signed-off-by: Dan Carpenter <dan.carpenter@linaro.org>
---
drivers/net/wireless/realtek/rtw89/core.c | 2 +-
1 file changed, 1 insertion(+), 1 deletion(-)
diff --git a/drivers/net/wireless/realtek/rtw89/core.c b/drivers/net/wireless/realtek/rtw89/core.c
index 7fc0a26a4d73..1d462c9e46d9 100644
--- a/drivers/net/wireless/realtek/rtw89/core.c
+++ b/drivers/net/wireless/realtek/rtw89/core.c
@@ -3587,7 +3587,7 @@ static void rtw89_read_chip_ver(struct rtw89_dev *rtwdev)
if (chip->chip_id == RTL8852B || chip->chip_id == RTL8851B) {
ret = rtw89_mac_read_xtal_si(rtwdev, XTAL_SI_CV, &val);
- if (!ret)
+ if (ret)
return;
rtwdev->hal.acv = u8_get_bits(val, XTAL_SI_ACV_MASK);
--
2.39.2
^ permalink raw reply related [flat|nested] 4+ messages in thread
* Re: [PATCH] wifi: rtw89: fix rtw89_read_chip_ver() for RTL8852B and RTL8851B
2023-04-21 10:44 [PATCH] wifi: rtw89: fix rtw89_read_chip_ver() for RTL8852B and RTL8851B Dan Carpenter
@ 2023-04-21 11:48 ` Ping-Ke Shih
2023-04-21 12:39 ` Dan Carpenter
2023-05-05 12:01 ` Kalle Valo
1 sibling, 1 reply; 4+ messages in thread
From: Ping-Ke Shih @ 2023-04-21 11:48 UTC (permalink / raw)
To: dan.carpenter; +Cc: kvalo, linux-wireless, kernel-janitors
On Fri, 2023-04-21 at 13:44 +0300, Dan Carpenter wrote:
>
> The if statement is reversed so it will not record the chip version.
> This was detected using Smatch:
>
> drivers/net/wireless/realtek/rtw89/core.c:3593 rtw89_read_chip_ver()
> error: uninitialized symbol 'val'.
I use smatch to check our driver regularly, but I can't find this error.
With the latest version v0.5.0-8321-g556064ca, I still can't find it.
Do I need to specify additional arguments? Thanks.
>
> Fixes: a6fb2bb84654 ("wifi: rtw89: read version of analog hardware")
> Signed-off-by: Dan Carpenter <dan.carpenter@linaro.org>
Acked-by: Ping-Ke Shih <pkshih@realtek.com>
> ---
> drivers/net/wireless/realtek/rtw89/core.c | 2 +-
> 1 file changed, 1 insertion(+), 1 deletion(-)
>
> diff --git a/drivers/net/wireless/realtek/rtw89/core.c b/drivers/net/wireless/realtek/rtw89/core.c
> index 7fc0a26a4d73..1d462c9e46d9 100644
> --- a/drivers/net/wireless/realtek/rtw89/core.c
> +++ b/drivers/net/wireless/realtek/rtw89/core.c
> @@ -3587,7 +3587,7 @@ static void rtw89_read_chip_ver(struct rtw89_dev *rtwdev)
>
> if (chip->chip_id == RTL8852B || chip->chip_id == RTL8851B) {
> ret = rtw89_mac_read_xtal_si(rtwdev, XTAL_SI_CV, &val);
> - if (!ret)
> + if (ret)
> return;
>
> rtwdev->hal.acv = u8_get_bits(val, XTAL_SI_ACV_MASK);
> --
> 2.39.2
>
>
> ------Please consider the environment before printing this e-mail.
^ permalink raw reply [flat|nested] 4+ messages in thread
* Re: [PATCH] wifi: rtw89: fix rtw89_read_chip_ver() for RTL8852B and RTL8851B
2023-04-21 11:48 ` Ping-Ke Shih
@ 2023-04-21 12:39 ` Dan Carpenter
0 siblings, 0 replies; 4+ messages in thread
From: Dan Carpenter @ 2023-04-21 12:39 UTC (permalink / raw)
To: Ping-Ke Shih; +Cc: kvalo, linux-wireless, kernel-janitors
On Fri, Apr 21, 2023 at 11:48:43AM +0000, Ping-Ke Shih wrote:
> On Fri, 2023-04-21 at 13:44 +0300, Dan Carpenter wrote:
> >
> > The if statement is reversed so it will not record the chip version.
> > This was detected using Smatch:
> >
> > drivers/net/wireless/realtek/rtw89/core.c:3593 rtw89_read_chip_ver()
> > error: uninitialized symbol 'val'.
>
> I use smatch to check our driver regularly, but I can't find this error.
> With the latest version v0.5.0-8321-g556064ca, I still can't find it.
> Do I need to specify additional arguments? Thanks.
>
You need the cross function database (which takes like 9 hours to build).
~/smatch/smatch_scripts/build_kernel_data.sh
regards,
dan carpenter
^ permalink raw reply [flat|nested] 4+ messages in thread
* Re: [PATCH] wifi: rtw89: fix rtw89_read_chip_ver() for RTL8852B and RTL8851B
2023-04-21 10:44 [PATCH] wifi: rtw89: fix rtw89_read_chip_ver() for RTL8852B and RTL8851B Dan Carpenter
2023-04-21 11:48 ` Ping-Ke Shih
@ 2023-05-05 12:01 ` Kalle Valo
1 sibling, 0 replies; 4+ messages in thread
From: Kalle Valo @ 2023-05-05 12:01 UTC (permalink / raw)
To: Dan Carpenter; +Cc: Ping-Ke Shih, linux-wireless, kernel-janitors
Dan Carpenter <dan.carpenter@linaro.org> wrote:
> The if statement is reversed so it will not record the chip version.
> This was detected using Smatch:
>
> drivers/net/wireless/realtek/rtw89/core.c:3593 rtw89_read_chip_ver()
> error: uninitialized symbol 'val'.
>
> Fixes: a6fb2bb84654 ("wifi: rtw89: read version of analog hardware")
> Signed-off-by: Dan Carpenter <dan.carpenter@linaro.org>
> Acked-by: Ping-Ke Shih <pkshih@realtek.com>
Patch applied to wireless-next.git, thanks.
9d4f491b860e wifi: rtw89: fix rtw89_read_chip_ver() for RTL8852B and RTL8851B
--
https://patchwork.kernel.org/project/linux-wireless/patch/e4d912a2-37f8-4068-8861-7b9494ae731b@kili.mountain/
https://wireless.wiki.kernel.org/en/developers/documentation/submittingpatches
^ permalink raw reply [flat|nested] 4+ messages in thread
end of thread, other threads:[~2023-05-05 12:02 UTC | newest]
Thread overview: 4+ messages (download: mbox.gz / follow: Atom feed)
-- links below jump to the message on this page --
2023-04-21 10:44 [PATCH] wifi: rtw89: fix rtw89_read_chip_ver() for RTL8852B and RTL8851B Dan Carpenter
2023-04-21 11:48 ` Ping-Ke Shih
2023-04-21 12:39 ` Dan Carpenter
2023-05-05 12:01 ` Kalle Valo
This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox;
as well as URLs for NNTP newsgroup(s).