diff mbox series

[09/10] wifi: rtw88: fix incorrect error codes in rtw_debugfs_set_coex_enable

Message ID tencent_226E4B142CC7835E6109554EE2E0C6A01605@qq.com (mailing list archive)
State Changes Requested
Delegated to: Kalle Valo
Headers show
Series [01/10] wifi: rtw88: fix incorrect error codes in rtw_debugfs_set_write_reg | expand

Commit Message

Zhang Shurong April 22, 2023, 10:04 a.m. UTC
If there is a failure during copy_from_user, rtw_debugfs_set_coex_enable
should return negative error code instead of a positive value count.

Fix this bug by returning correct error code.

Signed-off-by: Zhang Shurong <zhang_shurong@foxmail.com>
---
 drivers/net/wireless/realtek/rtw88/debug.c | 4 +++-
 1 file changed, 3 insertions(+), 1 deletion(-)
diff mbox series

Patch

diff --git a/drivers/net/wireless/realtek/rtw88/debug.c b/drivers/net/wireless/realtek/rtw88/debug.c
index aef43f3ca364..f9bcb44b42ac 100644
--- a/drivers/net/wireless/realtek/rtw88/debug.c
+++ b/drivers/net/wireless/realtek/rtw88/debug.c
@@ -883,7 +883,9 @@  static ssize_t rtw_debugfs_set_coex_enable(struct file *filp,
 	bool enable;
 	int ret;
 
-	rtw_debugfs_copy_from_user(tmp, sizeof(tmp), buffer, count, 1);
+	ret = rtw_debugfs_copy_from_user(tmp, sizeof(tmp), buffer, count, 1);
+	if (ret < 0)
+		return ret;
 
 	ret = kstrtobool(tmp, &enable);
 	if (ret) {