2021-03-15 09:28:22

by Dan Carpenter

[permalink] [raw]
Subject: [PATCH v2] 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")
Signed-off-by: Dan Carpenter <[email protected]>
---
v2: Style change. Keep "num" variable.

drivers/net/wireless/realtek/rtw88/debug.c | 2 +-
1 file changed, 1 insertion(+), 1 deletion(-)

diff --git a/drivers/net/wireless/realtek/rtw88/debug.c b/drivers/net/wireless/realtek/rtw88/debug.c
index 948cb79050ea..e7d51ac9b689 100644
--- a/drivers/net/wireless/realtek/rtw88/debug.c
+++ b/drivers/net/wireless/realtek/rtw88/debug.c
@@ -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;
--
2.30.1


2021-04-11 09:31:15

by Kalle Valo

[permalink] [raw]
Subject: Re: [PATCH v2] rtw88: Fix an error code in rtw_debugfs_set_rsvd_page()

Dan Carpenter <[email protected]> wrote:

> 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")
> Signed-off-by: Dan Carpenter <[email protected]>

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

c9eaee0c2ec6 rtw88: Fix an error code in rtw_debugfs_set_rsvd_page()

--
https://patchwork.kernel.org/project/linux-wireless/patch/[email protected]/

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