[PATCH 2/3] wifi: mt76: mt7925: report an error for an unknown testmode query id
JB Tsai
jb.tsai at mediatek.com
Thu Aug 13 01:50:00 PDT 2026
From: Tony-TC Lee <tony-tc.lee at mediatek.com>
ret is preseeded with 1, so a padding[0..1] matching neither
MCU_UNI_CMD_TESTMODE_CTRL nor MCU_UNI_CMD_TESTMODE_RX_STAT falls through
both branches and leaves it at 1. mt7925_testmode_dump() returns that to
netlink_dump(), where a positive value means "more data follows", so the
dump is held open and retried rather than failing.
Answer -EINVAL for an id that is neither, and drop the initialiser now
that every path assigns ret, which also lets the compiler check that.
Fixes: 0a41b6751e4f ("wifi: mt76: mt7925: add test mode support")
Signed-off-by: Tony-TC Lee <tony-tc.lee at mediatek.com>
---
drivers/net/wireless/mediatek/mt76/mt7925/testmode.c | 4 +++-
1 file changed, 3 insertions(+), 1 deletion(-)
diff --git a/drivers/net/wireless/mediatek/mt76/mt7925/testmode.c b/drivers/net/wireless/mediatek/mt76/mt7925/testmode.c
index 6ff261dfeedd..bf9516bc7bd1 100644
--- a/drivers/net/wireless/mediatek/mt76/mt7925/testmode.c
+++ b/drivers/net/wireless/mediatek/mt76/mt7925/testmode.c
@@ -90,7 +90,7 @@ mt7925_tm_query(struct mt792x_dev *dev, struct mt7925_tm_cmd *req,
struct mt7925_rftest_cmd cmd;
struct mt7925_rftest_cmd *pcmd = &cmd;
struct sk_buff *skb = NULL;
- int ret = 1;
+ int ret;
memset(pcmd, 0, sizeof(*pcmd));
memcpy(&pcmd->ctrl, &req->c, sizeof(struct uni_cmd_testmode_ctrl));
@@ -101,6 +101,8 @@ mt7925_tm_query(struct mt792x_dev *dev, struct mt7925_tm_cmd *req,
else if (*((uint16_t *)req->padding) == MCU_UNI_CMD_TESTMODE_RX_STAT)
ret = mt76_mcu_send_and_get_msg(&dev->mt76, MCU_UNI_QUERY(TESTMODE_RX_STAT),
&cmd, sizeof(cmd), true, &skb);
+ else
+ ret = -EINVAL;
if (ret)
goto out;
--
2.45.2
More information about the Linux-mediatek
mailing list