[PATCH] net: dwmac-rk: MAC clock should be truned off

李哲 posted 1 patch 6 months, 3 weeks ago
drivers/net/ethernet/stmicro/stmmac/dwmac-rk.c | 4 ++--
1 file changed, 2 insertions(+), 2 deletions(-)
[PATCH] net: dwmac-rk: MAC clock should be truned off
Posted by 李哲 6 months, 3 weeks ago
if PHY power-on fails, clockassociated the MAC should
be disabled during the MAC initialization process

Signed-off-by: 李哲 <sensor1010@163.com>
---
 drivers/net/ethernet/stmicro/stmmac/dwmac-rk.c | 4 ++--
 1 file changed, 2 insertions(+), 2 deletions(-)

diff --git a/drivers/net/ethernet/stmicro/stmmac/dwmac-rk.c b/drivers/net/ethernet/stmicro/stmmac/dwmac-rk.c
index 700858ff6f7c..036e45be5828 100644
--- a/drivers/net/ethernet/stmicro/stmmac/dwmac-rk.c
+++ b/drivers/net/ethernet/stmicro/stmmac/dwmac-rk.c
@@ -1648,7 +1648,7 @@ static int gmac_clk_enable(struct rk_priv_data *bsp_priv, bool enable)
 static int phy_power_on(struct rk_priv_data *bsp_priv, bool enable)
 {
 	struct regulator *ldo = bsp_priv->regulator;
-	int ret;
+	int ret = 0;
 	struct device *dev = &bsp_priv->pdev->dev;
 
 	if (enable) {
@@ -1661,7 +1661,7 @@ static int phy_power_on(struct rk_priv_data *bsp_priv, bool enable)
 			dev_err(dev, "fail to disable phy-supply\n");
 	}
 
-	return 0;
+	return ret;
 }
 
 static struct rk_priv_data *rk_gmac_setup(struct platform_device *pdev,
-- 
2.17.1

Re: [PATCH] net: dwmac-rk: MAC clock should be truned off
Posted by Andrew Lunn 6 months, 3 weeks ago
On Fri, May 23, 2025 at 08:15:21AM -0700, 李哲 wrote:
> if PHY power-on fails, clockassociated the MAC should
> be disabled during the MAC initialization process

The Subject: line has a typo.

> Signed-off-by: 李哲 <sensor1010@163.com>
> ---
>  drivers/net/ethernet/stmicro/stmmac/dwmac-rk.c | 4 ++--
>  1 file changed, 2 insertions(+), 2 deletions(-)
> 
> diff --git a/drivers/net/ethernet/stmicro/stmmac/dwmac-rk.c b/drivers/net/ethernet/stmicro/stmmac/dwmac-rk.c
> index 700858ff6f7c..036e45be5828 100644
> --- a/drivers/net/ethernet/stmicro/stmmac/dwmac-rk.c
> +++ b/drivers/net/ethernet/stmicro/stmmac/dwmac-rk.c
> @@ -1648,7 +1648,7 @@ static int gmac_clk_enable(struct rk_priv_data *bsp_priv, bool enable)
>  static int phy_power_on(struct rk_priv_data *bsp_priv, bool enable)
>  {
>  	struct regulator *ldo = bsp_priv->regulator;
> -	int ret;
> +	int ret = 0;
>  	struct device *dev = &bsp_priv->pdev->dev;
>  
>  	if (enable) {
> @@ -1661,7 +1661,7 @@ static int phy_power_on(struct rk_priv_data *bsp_priv, bool enable)
>  			dev_err(dev, "fail to disable phy-supply\n");
>  	}
>  
> -	return 0;
> +	return ret;

This does not make much sense to me. How do you get here with ret not
being 0?

    Andrew

---
pw-bot: cr