linux-wireless.vger.kernel.org archive mirror
 help / color / mirror / Atom feed
* [PATCH] wifi: rtw89: debug: fix error code in rtw89_debug_priv_btc_manual_set
@ 2023-07-09  9:59 Zhang Shurong
  2023-07-13  1:06 ` Jakub Kicinski
  0 siblings, 1 reply; 2+ messages in thread
From: Zhang Shurong @ 2023-07-09  9:59 UTC (permalink / raw)
  To: pkshih; +Cc: kvalo, linux-wireless, linux-kernel, Zhang Shurong

If there is a failure during kstrtobool_from_user()
rtw89_debug_priv_btc_manual_set 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>
---
 drivers/net/wireless/realtek/rtw89/debug.c | 6 +++++-
 1 file changed, 5 insertions(+), 1 deletion(-)

diff --git a/drivers/net/wireless/realtek/rtw89/debug.c b/drivers/net/wireless/realtek/rtw89/debug.c
index 1db2d59d33ff..35fe6b4ad9b3 100644
--- a/drivers/net/wireless/realtek/rtw89/debug.c
+++ b/drivers/net/wireless/realtek/rtw89/debug.c
@@ -3192,9 +3192,13 @@ static ssize_t rtw89_debug_priv_btc_manual_set(struct file *filp,
 	struct rtw89_dev *rtwdev = debugfs_priv->rtwdev;
 	struct rtw89_btc *btc = &rtwdev->btc;
 	bool btc_manual;
+	int ret;
 
-	if (kstrtobool_from_user(user_buf, count, &btc_manual))
+	ret = kstrtobool_from_user(user_buf, count, &btc_manual);
+	if (ret) {
+		count = ret;
 		goto out;
+	}
 
 	btc->ctrl.manual = btc_manual;
 out:
-- 
2.30.2


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

* Re: [PATCH] wifi: rtw89: debug: fix error code in rtw89_debug_priv_btc_manual_set
  2023-07-09  9:59 [PATCH] wifi: rtw89: debug: fix error code in rtw89_debug_priv_btc_manual_set Zhang Shurong
@ 2023-07-13  1:06 ` Jakub Kicinski
  0 siblings, 0 replies; 2+ messages in thread
From: Jakub Kicinski @ 2023-07-13  1:06 UTC (permalink / raw)
  To: Zhang Shurong; +Cc: pkshih, kvalo, linux-wireless, linux-kernel

On Sun,  9 Jul 2023 17:59:06 +0800 Zhang Shurong wrote:
> Fixes: e3ec7017f6a2 ("rtw89: add Realtek 802.11ax driver")
> 
> Signed-off-by: Zhang Shurong <zhang_shurong@foxmail.com>

No empty lines between the tags, please.

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

end of thread, other threads:[~2023-07-13  1:06 UTC | newest]

Thread overview: 2+ messages (download: mbox.gz follow: Atom feed
-- links below jump to the message on this page --
2023-07-09  9:59 [PATCH] wifi: rtw89: debug: fix error code in rtw89_debug_priv_btc_manual_set Zhang Shurong
2023-07-13  1:06 ` Jakub Kicinski

This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox;
as well as URLs for NNTP newsgroup(s).