<div data-ntes="ntes_mail_body_root" style="line-height:1.7;color:#000000;font-size:14px;font-family:Arial"><div id="spnEditorContent"><p style="margin: 0;">Hi£¬ Anerdw<br>The following is the logic for calling this function£º </p><p style="margin: 0;"><br></p><p style="margin: 0;">rk_gmac_powerup() {</p><p style="margin: 0;"><span style="white-space: normal;"><span style="white-space:pre">  </span>ret = phy_power_on(bsp_priv, true);      // here.</span></p><p style="margin: 0;"><span style="white-space: normal;"><span style="white-space:pre">     </span>if (ret) {</span></p><p style="margin: 0;"><span style="white-space: normal;"><span style="white-space:pre">           </span>gmac_clk_enable(bsp_priv, false);</span></p><p style="margin: 0;"><span style="white-space: normal;"><span style="white-space:pre">            </span>return ret;</span></p><p style="margin: 0;"><span style="white-space: normal;"><span style="white-space:pre">  </span>}</span></p><p style="margin: 0;">}<br><br>If this function consistently returns 0, is there still a need to validate its return value? <br>The rationale for checking the return value is to disable the clock on mac<br><br><br></p><p style="margin: 0;">_Thanks,<br>Lizhe</p><p style="margin: 0;"><br></p><p style="margin: 0;"><br></p></div><div style="position:relative;zoom:1"></div><div id="divNeteaseMailCard"></div><p style="margin: 0;"><br></p><pre><br>At 2025-05-24 00:20:13, "Andrew Lunn" <andrew@lunn.ch> wrote:
>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
</pre></div><img style="width:1px;height:1px" src="https://count.mail.163.com/beacon/webmail.gif?type=webmail_mailtrace&guid=pre_91eab3b85084278e3e63b9d74fd171b5">