[PATCH 08/36] net: remove conditional return with no effect
From: Sang-Heon Jeon <hidden>
Date: 2026-07-23 18:46:22
Also in:
cocci, lkml
Subsystem:
ethernet phy library, microchip lan87xx/lan937x t1 phy driver, networking drivers, pse network driver, the rest · Maintainers:
Andrew Lunn, Heiner Kallweit, Arun Ramadoss, "David S. Miller", Eric Dumazet, Jakub Kicinski, Paolo Abeni, Oleksij Rempel, Kory Maincent, Linus Torvalds
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.
Signed-off-by: Sang-Heon Jeon <redacted>
---
drivers/net/phy/microchip_t1.c | 6 +-----
drivers/net/pse-pd/tps23881.c | 6 +-----
2 files changed, 2 insertions(+), 10 deletions(-)
diff --git a/drivers/net/phy/microchip_t1.c b/drivers/net/phy/microchip_t1.c
index 62b36a318100..3292b2235c8f 100644
--- a/drivers/net/phy/microchip_t1.c
+++ b/drivers/net/phy/microchip_t1.c
@@ -1028,11 +1028,7 @@ static int lan87xx_read_status(struct phy_device *phydev)
if (rc < 0)
return rc;
- rc = genphy_read_status_fixed(phydev);
- if (rc < 0)
- return rc;
-
- return rc;
+ return genphy_read_status_fixed(phydev);
}
static int lan87xx_config_aneg(struct phy_device *phydev)
diff --git a/drivers/net/pse-pd/tps23881.c b/drivers/net/pse-pd/tps23881.c
index 49d6389da067..8a3bbd623412 100644
--- a/drivers/net/pse-pd/tps23881.c
+++ b/drivers/net/pse-pd/tps23881.c
@@ -1520,11 +1520,7 @@ static int tps23881_i2c_probe(struct i2c_client *client)
"failed to register PSE controller\n");
}
- ret = tps23881_setup_irq(priv, client->irq);
- if (ret)
- return ret;
-
- return ret;
+ return tps23881_setup_irq(priv, client->irq);
}
static const struct i2c_device_id tps23881_id[] = {--
2.43.0