Skip to contentSkip to conversation

rtw88: Fix an error code in rtw_debugfs_set_rsvd_page()

PATCH In review Dan Carpenter 2 participants 2 messages Mar 15, 2021 – Apr 11, 2021

Subsystems (2)
lore
Share & tools
lore
#0 lore raw

PATCH v2 1/1 rtw88: Fix an error code in rtw_debugfs_set_rsvd_page()

The sscanf() function returns the number of matches (0 or 1 in this case). It doesn't return error codes. We should return -EINVAL if the string is invalid

Fixes c376c1fc87b7 ("rtw88: add h2c command in debugfs")

---
v2: Style change. Keep "num" variable.

 drivers/net/wireless/realtek/rtw88/debug.c | 2 +-
 1 file changed, 1 insertion(+), 1 deletion(-)
drivers/net/wireless/realtek/rtw88/debug.c +1 -1
index 948cb79050ea..e7d51ac9b689 100644
@@ -270,7 +270,7 @@ static ssize_t rtw_debugfs_set_rsvd_page(struct file *filp,
 
 	if (num != 2) {
 		rtw_warn(rtwdev, "invalid arguments\n");
-		return num;
+		return -EINVAL;
 	}
 
 	debugfs_priv->rsvd_page.page_offset = offset;
Signature · 1 line
2.30.1
#1 lore raw
Quoted 6 lines · Dan Carpenter

The sscanf() function returns the number of matches (0 or 1 in this case). It doesn't return error codes. We should return -EINVAL if the string is invalid

Fixes c376c1fc87b7 ("rtw88: add h2c command in debugfs")

Patch applied to wireless-drivers-next.git, thanks.

c9eaee0c2ec6 rtw88: Fix an error code in rtw_debugfs_set_rsvd_page()

Signature · 3 lines
https://patchwork.kernel.org/project/linux-wireless/patch/YE8nmatMDBDDWkjq@mwanda/

https://wireless.wiki.kernel.org/en/developers/documentation/submittingpatches