[PATCH] rtw88: Fix an error code in rtw_debugfs_set_rsvd_page()

[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

 



The sscanf() function returns either 0 or 1 here.  It doesn't return
error codes.  We should return -EINVAL if the string is invalid.

Fixes: c376c1fc87b7 ("rtw88: add h2c command in debugfs")
Signed-off-by: Dan Carpenter <dan.carpenter@xxxxxxxxxx>
---
 drivers/net/wireless/realtek/rtw88/debug.c | 7 ++-----
 1 file changed, 2 insertions(+), 5 deletions(-)

diff --git a/drivers/net/wireless/realtek/rtw88/debug.c b/drivers/net/wireless/realtek/rtw88/debug.c
index 948cb79050ea..99be7fcb5d71 100644
--- a/drivers/net/wireless/realtek/rtw88/debug.c
+++ b/drivers/net/wireless/realtek/rtw88/debug.c
@@ -262,15 +262,12 @@ static ssize_t rtw_debugfs_set_rsvd_page(struct file *filp,
 	struct rtw_dev *rtwdev = debugfs_priv->rtwdev;
 	char tmp[32 + 1];
 	u32 offset, page_num;
-	int num;
 
 	rtw_debugfs_copy_from_user(tmp, sizeof(tmp), buffer, count, 2);
 
-	num = sscanf(tmp, "%d %d", &offset, &page_num);
-
-	if (num != 2) {
+	if (sscanf(tmp, "%d %d", &offset, &page_num) != 2) {
 		rtw_warn(rtwdev, "invalid arguments\n");
-		return num;
+		return -EINVAL;
 	}
 
 	debugfs_priv->rsvd_page.page_offset = offset;
-- 
2.30.0




[Index of Archives]     [Kernel Development]     [Kernel Announce]     [Kernel Newbies]     [Linux Networking Development]     [Share Photos]     [IDE]     [Security]     [Git]     [Netfilter]     [Yosemite News]     [MIPS Linux]     [ARM Linux]     [Device Mapper]

  Powered by Linux