[PATCH] phy: Reset init count on phy exit failure

Marek Vasut marek.vasut at mailbox.org
Sun Sep 7 18:13:33 CEST 2025


On 9/7/25 9:18 AM, Siddharth Vadapalli wrote:

Hi,

>> diff --git a/drivers/phy/phy-uclass.c b/drivers/phy/phy-uclass.c
>> index 714be123856..f8d4fb3b41b 100644
>> --- a/drivers/phy/phy-uclass.c
>> +++ b/drivers/phy/phy-uclass.c
>> @@ -274,7 +274,7 @@ int generic_phy_exit(struct phy *phy)
>>   {
>>   	struct phy_counts *counts;
>>   	struct phy_ops const *ops;
>> -	int ret;
>> +	int ret = 0;
>>   
>>   	if (!generic_phy_valid(phy))
>>   		return 0;
>> @@ -292,12 +292,11 @@ int generic_phy_exit(struct phy *phy)
>>   		if (ret) {
>>   			dev_err(phy->dev, "PHY: Failed to exit %s: %d.\n",
>>   				phy->dev->name, ret);
>> -			return ret;
> 
> I assume that a generic_phy_reset() may be required for generic_phy_init()
> to succeed after generic_phy_exit() has failed.

Likely, that's up to the driver(s).

> While I understand that
> the current patch allows retrying, this may not be complete in allowing
> users to make use of the change being brought about by this patch.
> Nevertheless, the change being proposed in this patch looks good to me.
This only corrects the inability to retry on failure due to refcount not 
being decremented. Recovery action of the PHY is up to the 
user/driver/consumer .


More information about the U-Boot mailing list