Message ID | tencent_1BEE491CDD88D78E6D0583D57B7C2844A00A@qq.com |
---|---|
State | Superseded |
Headers | show |
Series | [v3] wifi: rtw89: debug: fix error code in | expand |
On 7/15/2023 5:51 AM, Zhang Shurong wrote: > 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. nit: s/driectly/directly/ > > Fix this bug with the following changes: > - Return an error code instead of a count after a failed call > of the function "kstrtobool_from_user". > - Omit the label "out" with this source code correction. > > 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 > Changes in v3: > - Improved change description > > 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; > } >
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; }
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 with the following changes: - Return an error code instead of a count after a failed call of the function "kstrtobool_from_user". - Omit the label "out" with this source code correction. 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 Changes in v3: - Improved change description drivers/net/wireless/realtek/rtw89/debug.c | 8 +++++--- 1 file changed, 5 insertions(+), 3 deletions(-)