[PATCH net-next v2] net: phy: aquantia: fix return value check in aqr107_config_mdi()

Daniel Golle posted 1 patch 1 month, 2 weeks ago
drivers/net/phy/aquantia/aquantia_main.c | 2 +-
1 file changed, 1 insertion(+), 1 deletion(-)
[PATCH net-next v2] net: phy: aquantia: fix return value check in aqr107_config_mdi()
Posted by Daniel Golle 1 month, 2 weeks ago
of_property_read_u32() returns -EINVAL in case the property cannot be
found rather than -ENOENT. Fix the check to not abort probing in case
of the property being missing, and also in case CONFIG_OF is not set
which will result in -ENOSYS.

Fixes: a2e1ba275eae ("net: phy: aquantia: allow forcing order of MDI pairs")
Reported-by: Jon Hunter <jonathanh@nvidia.com>
Closes: https://lore.kernel.org/all/114b4c03-5d16-42ed-945d-cf78eabea12b@nvidia.com/
Suggested-by: Hans-Frieder Vogt <hfdevel@gmx.net>
Signed-off-by: Daniel Golle <daniel@makrotopia.org>
Reviewed-by: Andrew Lunn <andrew@lunn.ch>
---
 drivers/net/phy/aquantia/aquantia_main.c | 2 +-
 1 file changed, 1 insertion(+), 1 deletion(-)

diff --git a/drivers/net/phy/aquantia/aquantia_main.c b/drivers/net/phy/aquantia/aquantia_main.c
index 4fe757cd7dc7..7d27f080a343 100644
--- a/drivers/net/phy/aquantia/aquantia_main.c
+++ b/drivers/net/phy/aquantia/aquantia_main.c
@@ -513,7 +513,7 @@ static int aqr107_config_mdi(struct phy_device *phydev)
 	ret = of_property_read_u32(np, "marvell,mdi-cfg-order", &mdi_conf);
 
 	/* Do nothing in case property "marvell,mdi-cfg-order" is not present */
-	if (ret == -ENOENT)
+	if (ret == -EINVAL || ret == -ENOSYS)
 		return 0;
 
 	if (ret)
-- 
2.47.0
Re: [PATCH net-next v2] net: phy: aquantia: fix return value check in aqr107_config_mdi()
Posted by Jon Hunter 1 month, 1 week ago
On 13/10/2024 14:16, Daniel Golle wrote:
> of_property_read_u32() returns -EINVAL in case the property cannot be
> found rather than -ENOENT. Fix the check to not abort probing in case
> of the property being missing, and also in case CONFIG_OF is not set
> which will result in -ENOSYS.
> 
> Fixes: a2e1ba275eae ("net: phy: aquantia: allow forcing order of MDI pairs")
> Reported-by: Jon Hunter <jonathanh@nvidia.com>
> Closes: https://lore.kernel.org/all/114b4c03-5d16-42ed-945d-cf78eabea12b@nvidia.com/
> Suggested-by: Hans-Frieder Vogt <hfdevel@gmx.net>
> Signed-off-by: Daniel Golle <daniel@makrotopia.org>
> Reviewed-by: Andrew Lunn <andrew@lunn.ch>
> ---
>   drivers/net/phy/aquantia/aquantia_main.c | 2 +-
>   1 file changed, 1 insertion(+), 1 deletion(-)
> 
> diff --git a/drivers/net/phy/aquantia/aquantia_main.c b/drivers/net/phy/aquantia/aquantia_main.c
> index 4fe757cd7dc7..7d27f080a343 100644
> --- a/drivers/net/phy/aquantia/aquantia_main.c
> +++ b/drivers/net/phy/aquantia/aquantia_main.c
> @@ -513,7 +513,7 @@ static int aqr107_config_mdi(struct phy_device *phydev)
>   	ret = of_property_read_u32(np, "marvell,mdi-cfg-order", &mdi_conf);
>   
>   	/* Do nothing in case property "marvell,mdi-cfg-order" is not present */
> -	if (ret == -ENOENT)
> +	if (ret == -EINVAL || ret == -ENOSYS)
>   		return 0;
>   
>   	if (ret)


Works for me!

Reviewed-by: Jon Hunter <jonathanh@nvidia.com>
Tested-by: Jon Hunter <jonathanh@nvidia.com>

Thanks
Jon

-- 
nvpublic