Skip to contentSkip to conversation

wifi: rtlwifi/rtw89: remove conditional returns with no effect

PATCH Superseded Sang-Heon Jeon 2 participants 7 messages Jul 26 – Jul 30

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

v2 cover wifi: rtlwifi/rtw89: remove conditional returns with no effect

Hello,

This series removes conditional returns where both branches return the same value, so the check has no effect. As suggested by Ping-Ke, the wifi patch of the treewide v1 series [1] is split per driver and posted separately.

Both patches are generated by the Coccinelle script, which you can find in v1.

---
Changes from v1 [1]
- Split the wifi patch per driver
- Change base to rtw/rtw-next
- Filter only rtlwifi and rtw89 changes

[1] https://lore.kernel.org/all/[email protected]/
---

Sang-Heon Jeon (2):
wifi: rtlwifi: rtl8821ae: remove conditional return with no effect
wifi: rtw89: remove conditional return with no effect

 drivers/net/wireless/realtek/rtlwifi/rtl8821ae/hw.c | 7 +------
 drivers/net/wireless/realtek/rtw89/mac.c            | 6 +-----
 drivers/net/wireless/realtek/rtw89/mac_be.c         | 6 +-----
 3 files changed, 3 insertions(+), 16 deletions(-)

--
2.43.0

#1 lore raw

PATCH v2 1/2 wifi: rtlwifi: rtl8821ae: remove conditional return with no effect

Both branches of the check return the same value, so the check has no effect. Remove it and return the value directly.

This is the result of running the Coccinelle script from scripts/coccinelle/misc/cond_return_no_effect.cocci.

---
 drivers/net/wireless/realtek/rtlwifi/rtl8821ae/hw.c | 7 +------
 1 file changed, 1 insertion(+), 6 deletions(-)
drivers/net/wireless/realtek/rtlwifi/rtl8821ae/hw.c +1 -6
index 9b119a51bc30..1ba53e671207 100644
@@ -1462,12 +1462,7 @@ static bool _rtl8821ae_init_llt_table(struct ieee80211_hw *hw, u32 boundary)
 			return status;
 	}
 
-	status = _rtl8821ae_llt_write(hw, last_entry_of_txpktbuf,
-				      txpktbuf_bndy);
-	if (!status)
-		return status;
-
-	return status;
+	return _rtl8821ae_llt_write(hw, last_entry_of_txpktbuf, txpktbuf_bndy);
 }
 
 static bool _rtl8821ae_dynamic_rqpn(struct ieee80211_hw *hw, u32 boundary,
Signature · 1 line
2.43.0
maintainer Acked-by on v2 1/2
#2 lore raw

RE: [PATCH rtw-next v2 1/2] wifi: rtlwifi: rtl8821ae: remove conditional return with no effect

Quoted 7 lines · Sang-Heon Jeon

Both branches of the check return the same value, so the check has no effect. Remove it and return the value directly.

This is the result of running the Coccinelle script from scripts/coccinelle/misc/cond_return_no_effect.cocci.

maintainer
#3 lore raw

RE: [PATCH rtw-next v2 1/2] wifi: rtlwifi: rtl8821ae: remove conditional return with no effect

Quoted 11 lines · Ping-Ke Shih
Quoted 7 lines · Sang-Heon Jeon

Both branches of the check return the same value, so the check has no effect. Remove it and return the value directly.

This is the result of running the Coccinelle script from scripts/coccinelle/misc/cond_return_no_effect.cocci.

For the record, I'd make subject more specific:

wifi: rtlwifi: rtl8821ae: remove conditional return with no effect in _rtl8821ae_llt_write()

maintainer
#4 lore raw

Re: [PATCH rtw-next v2 1/2] wifi: rtlwifi: rtl8821ae: remove conditional return with no effect

In reply to Sang-Heon Jeon
Quoted 8 lines · Sang-Heon Jeon

Both branches of the check return the same value, so the check has no effect. Remove it and return the value directly.

This is the result of running the Coccinelle script from scripts/coccinelle/misc/cond_return_no_effect.cocci.

2 patch(es) applied to rtw-next branch of rtw.git, thanks.

c13ab5bed716 wifi: rtlwifi: rtl8821ae: remove conditional return with no effect in _rtl8821ae_llt_write() bbc18041ad5f wifi: rtw89: remove conditional return with no effect in sys_init_*()

---
https://github.com/pkshih/rtw.git

#5 lore raw

PATCH v2 2/2 wifi: rtw89: remove conditional return with no effect

In reply to Sang-Heon Jeon

Both branches of the check return the same value, so the check has no effect. Remove it and return the value directly.

This is the result of running the Coccinelle script from scripts/coccinelle/misc/cond_return_no_effect.cocci.

---
 drivers/net/wireless/realtek/rtw89/mac.c    | 6 +-----
 drivers/net/wireless/realtek/rtw89/mac_be.c | 6 +-----
 2 files changed, 2 insertions(+), 10 deletions(-)
drivers/net/wireless/realtek/rtw89/mac.c +1 -5
index db9fca828829..2cbff2be9bbb 100644
@@ -1710,11 +1710,7 @@ static int sys_init_ax(struct rtw89_dev *rtwdev)
 	if (ret)
 		return ret;
 
-	ret = chip_func_en_ax(rtwdev);
-	if (ret)
-		return ret;
-
-	return ret;
+	return chip_func_en_ax(rtwdev);
 }
 
 const struct rtw89_mac_size_set rtw89_mac_size = {
drivers/net/wireless/realtek/rtw89/mac_be.c +1 -5
index 8de0fe5a3b1d..dfa0973e367c 100644
@@ -929,11 +929,7 @@ static int sys_init_be(struct rtw89_dev *rtwdev)
 	if (ret)
 		return ret;
 
-	ret = chip_func_en_be(rtwdev);
-	if (ret)
-		return ret;
-
-	return ret;
+	return chip_func_en_be(rtwdev);
 }
 
 static int mac_func_en_be(struct rtw89_dev *rtwdev)
Signature · 1 line
2.43.0
maintainer Acked-by on v2 2/2
#6 lore raw

RE: [PATCH rtw-next v2 2/2] wifi: rtw89: remove conditional return with no effect

Quoted 7 lines · Sang-Heon Jeon

Both branches of the check return the same value, so the check has no effect. Remove it and return the value directly.

This is the result of running the Coccinelle script from scripts/coccinelle/misc/cond_return_no_effect.cocci.

I'd update the subject to be more specific during it gets merged.

"wifi: rtw89: remove conditional return with no effect in sys_init_*()"