mirror of https://lore.kernel.org/lkml/
 help / color / mirror / Atom feed
* [PATCH] wifi: rtw89: fw: propagate real error code in rtw89_fw_h2c_add_general_pkt()
@ 2026-09-01  9:33 Gongwei Li
  2026-09-02  1:32 ` Ping-Ke Shih
  0 siblings, 1 reply; 2+ messages in thread
From: Gongwei Li @ 2026-09-01  9:33 UTC (permalink / raw)
  To: Ping-Ke Shih
  Cc: Chin-Yen Lee, Kalle Valo, linux-wireless, linux-kernel, Gongwei Li

From: Gongwei Li <ligongwei@kylinos.cn>

The error path of rtw89_fw_h2c_add_general_pkt() returns -ENOMEM
unconditionally, which masks the real reason of a failure. In
particular:

* rtw89_fw_h2c_add_pkt_offload() can fail with -ENOSPC when no more
  packet offload slot is available, or with the error of H2C TX, but
  the callers only see -ENOMEM and get misled when debugging.

* For an unsupported type, the switch default case returns -ENOMEM,
  which is misleading and should be -EINVAL.

Return a real error code instead of -ENOMEM, and use -EINVAL for
unsupported types.

Fixes: 5c12bb66b79d ("wifi: rtw89: refine packet offload flow")
Signed-off-by: Gongwei Li <ligongwei@kylinos.cn>
---
  drivers/net/wireless/realtek/rtw89/fw.c | 7 +++++--
  1 file changed, 5 insertions(+), 2 deletions(-)

diff --git a/drivers/net/wireless/realtek/rtw89/fw.c b/drivers/net/wireless/realtek/rtw89/fw.c
index d6a594b75ab2..ab2d0b0cb1e5 100644
--- a/drivers/net/wireless/realtek/rtw89/fw.c
+++ b/drivers/net/wireless/realtek/rtw89/fw.c
@@ -3013,11 +3013,14 @@ static int rtw89_fw_h2c_add_general_pkt(struct rtw89_dev *rtwdev,
 		skb = rtw89_arp_response_get(rtwdev, rtwvif_link);
 		break;
 	default:
+		ret = -EINVAL;
 		goto err;
 	}
 
-	if (!skb)
+	if (!skb) {
+		ret = -ENOMEM;
 		goto err;
+	}
 
 	ret = rtw89_fw_h2c_add_pkt_offload(rtwdev, &info->id, skb);
 	kfree_skb(skb);
@@ -3031,7 +3034,7 @@ static int rtw89_fw_h2c_add_general_pkt(struct rtw89_dev *rtwdev,
 
 err:
 	kfree(info);
-	return -ENOMEM;
+	return ret;
 }
 
 void rtw89_fw_release_general_pkt_list_vif(struct rtw89_dev *rtwdev,

-- 

2.25.1


^ permalink raw reply	[flat|nested] 2+ messages in thread

end of thread, other threads:[~2026-09-02  1:33 UTC | newest]

Thread overview: 2+ messages (download: mbox.gz / follow: Atom feed)
-- links below jump to the message on this page --
2026-09-01  9:33 [PATCH] wifi: rtw89: fw: propagate real error code in rtw89_fw_h2c_add_general_pkt() Gongwei Li
2026-09-02  1:32 ` Ping-Ke Shih

This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox

all inboxes | Powered by JetHome®