[PATCH] phy: Fix generic_setup_phy return value on power on failure

Marek Vasut marex at denx.de
Wed Jul 12 03:48:28 CEST 2023


On 7/12/23 02:06, Jonas Karlman wrote:
> On 2023-07-12 01:59, Marek Vasut wrote:
>> On 7/12/23 01:48, Jonas Karlman wrote:
>>> generic_setup_phy may mask a power on failure due to the return value
>>> from generic_phy_exit, typically 0, is being used as return value.
>>>
>>> Fix this by ignoring the return value of the generic_phy_exit call,
>>> also remove an unnecessary check for -ENOENT.
>>
>> Why is it unnecessary ?
>> If I recall it right, the ENOENT check is to not fail if the PHY is not
>> present in DT, which may not be a failure.
> 
> In the current state ret is returned any way, so this check is currently
> pointless.

I don't think so, the test is:

if (ret && ret != -ENOENT)
   return ret;

i.e. the ENOENT is a special case.

> Looking back at the old originating code for generic_setup_phy the
> return value was 0 for similar ENOENT check.
> 
> Maybe this is something that should be restored or such check be moved
> to caller of generic_setup_phy.




More information about the U-Boot mailing list