diff mbox series

brcm80211: brcmsmac: phy_cmn: Remove unreachable code

Message ID 20230813212343.245521-1-artem.chernyshev@red-soft.ru (mailing list archive)
State Superseded
Delegated to: Kalle Valo
Headers show
Series brcm80211: brcmsmac: phy_cmn: Remove unreachable code | expand

Commit Message

Artem Chernyshev Aug. 13, 2023, 9:23 p.m. UTC
Since wlc_phy_txpwr_srom_read_nphy() in wlc_phy_attach_nphy()
can not return false it's impossible to get true value in this
if statement

Found by Linux Verification Center (linuxtesting.org) with SVACE.

Signed-off-by: Artem Chernyshev <artem.chernyshev@red-soft.ru>
---
 drivers/net/wireless/broadcom/brcm80211/brcmsmac/phy/phy_cmn.c | 3 +--
 1 file changed, 1 insertion(+), 2 deletions(-)

Comments

Jonas Gorski Aug. 14, 2023, 7:19 a.m. UTC | #1
On Sun, 13 Aug 2023 at 23:31, Artem Chernyshev
<artem.chernyshev@red-soft.ru> wrote:
>
> Since wlc_phy_txpwr_srom_read_nphy() in wlc_phy_attach_nphy()
> can not return false it's impossible to get true value in this
> if statement

If they can only return true, then maybe their return types should be
changed to void as well? No point in returning a value when the only
caller is ignoring it.

>
> Found by Linux Verification Center (linuxtesting.org) with SVACE.
>
> Signed-off-by: Artem Chernyshev <artem.chernyshev@red-soft.ru>

Regards,
Jonas
Artem Chernyshev Aug. 14, 2023, 7:24 a.m. UTC | #2
On Mon, Aug 14, 2023 at 09:19:14AM +0200, Jonas Gorski wrote:
> On Sun, 13 Aug 2023 at 23:31, Artem Chernyshev
> <artem.chernyshev@red-soft.ru> wrote:
> >
> > Since wlc_phy_txpwr_srom_read_nphy() in wlc_phy_attach_nphy()
> > can not return false it's impossible to get true value in this
> > if statement
> 
> If they can only return true, then maybe their return types should be
> changed to void as well? No point in returning a value when the only
> caller is ignoring it.
> 
> >
> > Found by Linux Verification Center (linuxtesting.org) with SVACE.
> >
> > Signed-off-by: Artem Chernyshev <artem.chernyshev@red-soft.ru>
> 
> Regards,
> Jonas

True that. I'll make those changes in v2.

Thank you,
Artem
diff mbox series

Patch

diff --git a/drivers/net/wireless/broadcom/brcm80211/brcmsmac/phy/phy_cmn.c b/drivers/net/wireless/broadcom/brcm80211/brcmsmac/phy/phy_cmn.c
index ccc621b8ed9f..07f83ff5a54a 100644
--- a/drivers/net/wireless/broadcom/brcm80211/brcmsmac/phy/phy_cmn.c
+++ b/drivers/net/wireless/broadcom/brcm80211/brcmsmac/phy/phy_cmn.c
@@ -551,8 +551,7 @@  wlc_phy_attach(struct shared_phy *sh, struct bcma_device *d11core,
 		if (!pi->phycal_timer)
 			goto err;
 
-		if (!wlc_phy_attach_nphy(pi))
-			goto err;
+		wlc_phy_attach_nphy(pi);
 
 	} else if (ISLCNPHY(pi)) {
 		if (!wlc_phy_attach_lcnphy(pi))