diff mbox series

[wireless-drivers-next] rtw89: fix return value in hfc_pub_cfg_chk

Message ID YXEJey8lKksAZif4@ns.kevlo.org (mailing list archive)
State Accepted
Commit c6477cb237048725922f6a786f68b5232abb418f
Delegated to: Kalle Valo
Headers show
Series [wireless-drivers-next] rtw89: fix return value in hfc_pub_cfg_chk | expand

Commit Message

Kevin Lo Oct. 21, 2021, 6:32 a.m. UTC
It seems to me when pub_cfg->grp0 + pub_cfg->grp1 != pub_cfg->pub_max is true,
it should return -EFAULT rather than 0.  Otherwise, the function doesn't need 
to exist.

Signed-off-by: Kevin Lo <kevlo@kevlo.org>
---

Comments

Ping-Ke Shih Oct. 22, 2021, 12:26 a.m. UTC | #1
> -----Original Message-----
> From: Kevin Lo <kevlo@kevlo.org>
> Sent: Thursday, October 21, 2021 2:32 PM
> To: linux-wireless@vger.kernel.org
> Cc: Pkshih <pkshih@realtek.com>
> Subject: [PATCH wireless-drivers-next] rtw89: fix return value in hfc_pub_cfg_chk
> 
> It seems to me when pub_cfg->grp0 + pub_cfg->grp1 != pub_cfg->pub_max is true,
> it should return -EFAULT rather than 0.  Otherwise, the function doesn't need
> to exist.
> 
> Signed-off-by: Kevin Lo <kevlo@kevlo.org>

Acked-by: Ping-Ke Shih <pkshih@realtek.com>

> ---
> diff --git a/drivers/net/wireless/realtek/rtw89/mac.c b/drivers/net/wireless/realtek/rtw89/mac.c
> index 69384c43c046..afcd07ab1de7 100644
> --- a/drivers/net/wireless/realtek/rtw89/mac.c
> +++ b/drivers/net/wireless/realtek/rtw89/mac.c
> @@ -560,7 +560,7 @@ static int hfc_pub_cfg_chk(struct rtw89_dev *rtwdev)
>  	const struct rtw89_hfc_pub_cfg *pub_cfg = &param->pub_cfg;
> 
>  	if (pub_cfg->grp0 + pub_cfg->grp1 != pub_cfg->pub_max)
> -		return 0;
> +		return -EFAULT;

Fortunately, current checking is always equal, so it doesn't affect the result.

> 
>  	return 0;
>  }


--
Ping-Ke
Kalle Valo Oct. 27, 2021, 7:37 a.m. UTC | #2
Kevin Lo <kevlo@kevlo.org> wrote:

> It seems to me when pub_cfg->grp0 + pub_cfg->grp1 != pub_cfg->pub_max is true,
> it should return -EFAULT rather than 0.  Otherwise, the function doesn't need 
> to exist.
> 
> Signed-off-by: Kevin Lo <kevlo@kevlo.org>
> Acked-by: Ping-Ke Shih <pkshih@realtek.com>
> 
> diff --git a/drivers/net/wireless/realtek/rtw89/mac.c b/drivers/net/wireless/realtek/rtw89/mac.c
> index 69384c43c046..afcd07ab1de7 100644
> --- a/drivers/net/wireless/realtek/rtw89/mac.c
> +++ b/drivers/net/wireless/realtek/rtw89/mac.c
> @@ -560,7 +560,7 @@ static int hfc_pub_cfg_chk(struct rtw89_dev *rtwdev)
>  	const struct rtw89_hfc_pub_cfg *pub_cfg = &param->pub_cfg;
>  
>  	if (pub_cfg->grp0 + pub_cfg->grp1 != pub_cfg->pub_max)
> -		return 0;
> +		return -EFAULT;
>  
>  	return 0;
>  }

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

c6477cb23704 rtw89: fix return value in hfc_pub_cfg_chk
diff mbox series

Patch

diff --git a/drivers/net/wireless/realtek/rtw89/mac.c b/drivers/net/wireless/realtek/rtw89/mac.c
index 69384c43c046..afcd07ab1de7 100644
--- a/drivers/net/wireless/realtek/rtw89/mac.c
+++ b/drivers/net/wireless/realtek/rtw89/mac.c
@@ -560,7 +560,7 @@  static int hfc_pub_cfg_chk(struct rtw89_dev *rtwdev)
 	const struct rtw89_hfc_pub_cfg *pub_cfg = &param->pub_cfg;
 
 	if (pub_cfg->grp0 + pub_cfg->grp1 != pub_cfg->pub_max)
-		return 0;
+		return -EFAULT;
 
 	return 0;
 }