mirror of https://lore.kernel.org/lkml/
 help / color / mirror / Atom feed
* [PATCH v2] wifi: rtw89: debug: fix error code in rtw89_debug_priv_btc_manual_set
@ 2023-07-15  6:44 Zhang Shurong
       [not found] ` <a97b0b0c-8141-5391-727a-aa29fedc016b@web.de>
  0 siblings, 1 reply; 2+ messages in thread
From: Zhang Shurong @ 2023-07-15  6:44 UTC (permalink / raw)
  To: pkshih, Markus.Elfring, kuba
  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 returning the count driectly.

Fix this bug by returning the correct error code.

Fixes: e3ec7017f6a2 ("rtw89: add Realtek 802.11ax driver")
Signed-off-by: Zhang Shurong <zhang_shurong@foxmail.com>
---
Changes in v2:
- Corrected the format of this patch
- Used variable ret instead of goto out

 drivers/net/wireless/realtek/rtw89/debug.c | 8 +++++---
 1 file changed, 5 insertions(+), 3 deletions(-)

diff --git a/drivers/net/wireless/realtek/rtw89/debug.c b/drivers/net/wireless/realtek/rtw89/debug.c
index a4bbac916e22..ce5a9ac08145 100644
--- a/drivers/net/wireless/realtek/rtw89/debug.c
+++ b/drivers/net/wireless/realtek/rtw89/debug.c
@@ -3193,12 +3193,14 @@ 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))
-		goto out;
+	ret = kstrtobool_from_user(user_buf, count, &btc_manual);
+	if (ret)
+		return ret;
 
 	btc->ctrl.manual = btc_manual;
-out:
+
 	return count;
 }
 
-- 
2.30.2


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

end of thread, other threads:[~2023-07-15  9:56 UTC | newest]

Thread overview: 2+ messages (download: mbox.gz / follow: Atom feed)
-- links below jump to the message on this page --
2023-07-15  6:44 [PATCH v2] wifi: rtw89: debug: fix error code in rtw89_debug_priv_btc_manual_set Zhang Shurong
     [not found] ` <a97b0b0c-8141-5391-727a-aa29fedc016b@web.de>
2023-07-15  9:56   ` Zhang Shurong

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®