diff mbox series

[v3] wifi: rtw89: debug: fix error code in rtw89_debug_priv_send_h2c_set()

Message ID tencent_D74C0118F55D22E6A6B1767CCB01CCC1E305@qq.com (mailing list archive)
State Changes Requested
Delegated to: Kalle Valo
Headers show
Series [v3] wifi: rtw89: debug: fix error code in rtw89_debug_priv_send_h2c_set() | expand

Commit Message

Zhang Shurong July 5, 2023, 3:10 p.m. UTC
If there is a failure during rtw89_fw_h2c_raw() rtw89_debug_priv_send_h2c
should return negative error code instead of a positive value count.
Fix this bug by returning correct error code.

Fixes: e3ec7017f6a2 ("rtw89: add Realtek 802.11ax driver")

Signed-off-by: Zhang Shurong <zhang_shurong@foxmail.com>
---
Changes in v2:
- fixed compile error
Changes in v3:
- Corrected the annotation of this patch
- Used variable ret instead of err
---
 drivers/net/wireless/realtek/rtw89/debug.c | 5 +++--
 1 file changed, 3 insertions(+), 2 deletions(-)

Comments

Ping-Ke Shih July 6, 2023, 1:49 a.m. UTC | #1
> -----Original Message-----
> From: Zhang Shurong <zhang_shurong@foxmail.com>
> Sent: Wednesday, July 5, 2023 11:11 PM
> To: Ping-Ke Shih <pkshih@realtek.com>
> Cc: kvalo@kernel.org; linux-wireless@vger.kernel.org; linux-kernel@vger.kernel.org; Zhang Shurong
> <zhang_shurong@foxmail.com>
> Subject: [PATCH v3] wifi: rtw89: debug: fix error code in rtw89_debug_priv_send_h2c_set()
> 
> If there is a failure during rtw89_fw_h2c_raw() rtw89_debug_priv_send_h2c
> should return negative error code instead of a positive value count.
> Fix this bug by returning correct error code.
> 
> Fixes: e3ec7017f6a2 ("rtw89: add Realtek 802.11ax driver")
> 

No need a blank line here. 

> Signed-off-by: Zhang Shurong <zhang_shurong@foxmail.com>

Acked-by: Ping-Ke Shih <pkshih@realtek.com>

[...]
diff mbox series

Patch

diff --git a/drivers/net/wireless/realtek/rtw89/debug.c b/drivers/net/wireless/realtek/rtw89/debug.c
index 1db2d59d33ff..a4bbac916e22 100644
--- a/drivers/net/wireless/realtek/rtw89/debug.c
+++ b/drivers/net/wireless/realtek/rtw89/debug.c
@@ -3026,17 +3026,18 @@  static ssize_t rtw89_debug_priv_send_h2c_set(struct file *filp,
 	struct rtw89_debugfs_priv *debugfs_priv = filp->private_data;
 	struct rtw89_dev *rtwdev = debugfs_priv->rtwdev;
 	u8 *h2c;
+	int ret;
 	u16 h2c_len = count / 2;
 
 	h2c = rtw89_hex2bin_user(rtwdev, user_buf, count);
 	if (IS_ERR(h2c))
 		return -EFAULT;
 
-	rtw89_fw_h2c_raw(rtwdev, h2c, h2c_len);
+	ret = rtw89_fw_h2c_raw(rtwdev, h2c, h2c_len);
 
 	kfree(h2c);
 
-	return count;
+	return ret ? ret : count;
 }
 
 static int