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

Gongwei Li <[email protected]>
Newsgroups org.kernel.vger.linux-wireless,org.kernel.vger.linux-kernel
Message-ID <[email protected]>
From: Gongwei Li <[email protected]>

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 <[email protected]>
---
 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
lmpx.com only provides a reader for public news (NNTP) servers. It is not affiliated with the servers or forums shown here and is not responsible for the content of articles, which is written by their respective authors.