[PATCH] wifi: rtw89: coex: Fix wrong constant check of GPIO MUX signal

Gongwei Li posted 1 patch 1 month ago
drivers/net/wireless/realtek/rtw89/coex.c | 2 +-
1 file changed, 1 insertion(+), 1 deletion(-)
[PATCH] wifi: rtw89: coex: Fix wrong constant check of GPIO MUX signal
Posted by Gongwei Li 1 month ago
From: Gongwei Li <ligongwei@kylinos.cn>

In _fw_set_gpio(), the check for an invalid GPIO signal uses `sig == 0xff`.
However, _get_gpiosig_for_ver() never returns 0xff. Both of its failure
branches return BTC_DBG_NUM (defined as 32) when the requested signal is
unsupported for the current firmware version.

Check the result against BTC_DBG_NUM instead, the same as _show_gpio_dbg()
already does.

Fixes: 5c90259b9748 ("wifi: rtw89: coex: complete GPIO debug configuration handler")
Signed-off-by: Gongwei Li <ligongwei@kylinos.cn>
---
 drivers/net/wireless/realtek/rtw89/coex.c | 2 +-
 1 file changed, 1 insertion(+), 1 deletion(-)

diff --git a/drivers/net/wireless/realtek/rtw89/coex.c b/drivers/net/wireless/realtek/rtw89/coex.c
index 5a9dc4d8a00b..12bd5539e8c6 100644
--- a/drivers/net/wireless/realtek/rtw89/coex.c
+++ b/drivers/net/wireless/realtek/rtw89/coex.c
@@ -3365,7 +3365,7 @@ static void _fw_set_gpio(struct rtw89_dev *rtwdev, u8 type, u32 val)
 		gpio->mux.data.dlen = CXDGPIO_SET_L2;
 		gpio->mux.data.sig = _get_gpiosig_for_ver(rtwdev,
 							  FIELD_GET(GENMASK(7, 0), val));
-		if (gpio->mux.data.sig == 0xff)
+		if (gpio->mux.data.sig >= BTC_DBG_NUM)
 			return;
 		gpio->mux.data.gpio = FIELD_GET(GENMASK(15, 8), val);
 		l2_h2c = gpio->mux.fmt;
-- 
2.25.1
Re: [PATCH] wifi: rtw89: coex: Fix wrong constant check of GPIO MUX signal
Posted by Ping-Ke Shih 3 weeks, 5 days ago
Gongwei Li <13875017792@163.com> wrote:

> From: Gongwei Li <ligongwei@kylinos.cn>
> 
> In _fw_set_gpio(), the check for an invalid GPIO signal uses `sig == 0xff`.
> However, _get_gpiosig_for_ver() never returns 0xff. Both of its failure
> branches return BTC_DBG_NUM (defined as 32) when the requested signal is
> unsupported for the current firmware version.
> 
> Check the result against BTC_DBG_NUM instead, the same as _show_gpio_dbg()
> already does.
> 
> Fixes: 5c90259b9748 ("wifi: rtw89: coex: complete GPIO debug configuration handler")
> Signed-off-by: Gongwei Li <ligongwei@kylinos.cn>

1 patch(es) applied to rtw-next branch of rtw.git, thanks.

fc17fd87d9f2 wifi: rtw89: coex: Fix wrong constant check of GPIO MUX signal

---
https://github.com/pkshih/rtw.git