[PATCH] net: dwmac-rk: No need to check the return value of the phy_power_on()
李哲
sensor1010 at 163.com
Fri May 30 09:20:17 PDT 2025
phy_power_on() is a local scope one within the driver, since the return
value of the phy_power_on() function is always 0, checking its return
value is redundant.
Signed-off-by: 李哲 <sensor1010 at 163.com>
---
drivers/net/ethernet/stmicro/stmmac/dwmac-rk.c | 17 ++++-------------
1 file changed, 4 insertions(+), 13 deletions(-)
diff --git a/drivers/net/ethernet/stmicro/stmmac/dwmac-rk.c b/drivers/net/ethernet/stmicro/stmmac/dwmac-rk.c
index 700858ff6f7c..f7c32934f8a4 100644
--- a/drivers/net/ethernet/stmicro/stmmac/dwmac-rk.c
+++ b/drivers/net/ethernet/stmicro/stmmac/dwmac-rk.c
@@ -1645,23 +1645,18 @@ static int gmac_clk_enable(struct rk_priv_data *bsp_priv, bool enable)
return 0;
}
-static int phy_power_on(struct rk_priv_data *bsp_priv, bool enable)
+static void phy_power_on(struct rk_priv_data *bsp_priv, bool enable)
{
struct regulator *ldo = bsp_priv->regulator;
- int ret;
struct device *dev = &bsp_priv->pdev->dev;
if (enable) {
- ret = regulator_enable(ldo);
- if (ret)
+ if (regulator_enable(ldo))
dev_err(dev, "fail to enable phy-supply\n");
} else {
- ret = regulator_disable(ldo);
- if (ret)
+ if (regulator_disable(ldo))
dev_err(dev, "fail to disable phy-supply\n");
}
-
- return 0;
}
static struct rk_priv_data *rk_gmac_setup(struct platform_device *pdev,
@@ -1839,11 +1834,7 @@ static int rk_gmac_powerup(struct rk_priv_data *bsp_priv)
dev_err(dev, "NO interface defined!\n");
}
- ret = phy_power_on(bsp_priv, true);
- if (ret) {
- gmac_clk_enable(bsp_priv, false);
- return ret;
- }
+ phy_power_on(bsp_priv, true);
pm_runtime_get_sync(dev);
--
2.17.1
More information about the linux-arm-kernel
mailing list