Skip to contentSkip to conversation

rtw89: fix return value in hfc_pub_cfg_chk

PATCH In review Kevin Lo 3 participants 3 messages Oct 21, 2021 – Oct 27, 2021 Realtek wireless driver (rtw89)

lore
Share & tools
lore

Kevin Lo

author
#0 lore raw

PATCH 1/1 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.

---

drivers/net/wireless/realtek/rtw89/mac.c +1 -1
index 69384c43c046..afcd07ab1de7 100644
@@ -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;
 }
maintainer Acked-by on v1 1/1
#1 lore raw
Quoted 8 lines

-----Original Message-----
From: Kevin Lo <[email protected]>
Sent: Thursday, October 21, 2021 2:32 PM
To: [email protected]
Cc: Pkshih <[email protected]>
Subject: [PATCH wireless-drivers-next] rtw89: fix return value in hfc_pub_cfg_chk

Quoted 5 lines

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.

drivers/net/wireless/realtek/rtw89/mac.c static int hfc_pub_cfg_chk(struct rtw89_dev *rtwdev) · line 563

Quoted 11 lines

---

drivers/net/wireless/realtek/rtw89/mac.c +1 -1
index 69384c43c046..afcd07ab1de7 100644
@@ -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.

drivers/net/wireless/realtek/rtw89/mac.c static int hfc_pub_cfg_chk(struct rtw89_dev *rtwdev) · line 566

Quoted 3 lines
drivers/net/wireless/realtek/rtw89/mac.c +0 -0
 	return 0;
 }

--
Ping-Ke

#2 lore raw
In reply to Kevin Lo
Quoted 12 lines · Kevin Lo

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.

drivers/net/wireless/realtek/rtw89/mac.c +0 -0
index 69384c43c046..afcd07ab1de7 100644

drivers/net/wireless/realtek/rtw89/mac.c static int hfc_pub_cfg_chk(struct rtw89_dev *rtwdev) · line 566

Quoted 8 lines
drivers/net/wireless/realtek/rtw89/mac.c +1 -1
@@ -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

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

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