[PATCH net-next v4 4/4] net: phy: mscc: Handle devm_phy_package_join() failure in vsc85xx_probe_common()

Prabhakar posted 4 patches 3 months ago
[PATCH net-next v4 4/4] net: phy: mscc: Handle devm_phy_package_join() failure in vsc85xx_probe_common()
Posted by Prabhakar 3 months ago
From: Lad Prabhakar <prabhakar.mahadev-lad.rj@bp.renesas.com>

devm_phy_package_join() may fail and return a negative error code.
Update vsc85xx_probe_common() to properly handle this failure by
checking the return value and propagating the error to the caller.

Signed-off-by: Lad Prabhakar <prabhakar.mahadev-lad.rj@bp.renesas.com>
---
v3->v4:
- New patch
---
 drivers/net/phy/mscc/mscc_main.c | 7 +++++--
 1 file changed, 5 insertions(+), 2 deletions(-)

diff --git a/drivers/net/phy/mscc/mscc_main.c b/drivers/net/phy/mscc/mscc_main.c
index 21fcaf07bc6d..2b9fb8a675a6 100644
--- a/drivers/net/phy/mscc/mscc_main.c
+++ b/drivers/net/phy/mscc/mscc_main.c
@@ -2264,8 +2264,11 @@ static int vsc85xx_probe_common(struct phy_device *phydev,
 	/* Set up package if needed */
 	if (cfg->use_package) {
 		vsc8584_get_base_addr(phydev);
-		devm_phy_package_join(&phydev->mdio.dev, phydev,
-				      vsc8531->base_addr, cfg->shared_size);
+		ret = devm_phy_package_join(&phydev->mdio.dev, phydev,
+					    vsc8531->base_addr,
+					    cfg->shared_size);
+		if (ret)
+			return ret;
 	}
 
 	/* Configure LED settings */
-- 
2.43.0
Re: [PATCH net-next v4 4/4] net: phy: mscc: Handle devm_phy_package_join() failure in vsc85xx_probe_common()
Posted by Andrew Lunn 2 months, 4 weeks ago
On Wed, Nov 12, 2025 at 01:57:15PM +0000, Prabhakar wrote:
> From: Lad Prabhakar <prabhakar.mahadev-lad.rj@bp.renesas.com>
> 
> devm_phy_package_join() may fail and return a negative error code.
> Update vsc85xx_probe_common() to properly handle this failure by
> checking the return value and propagating the error to the caller.
> 
> Signed-off-by: Lad Prabhakar <prabhakar.mahadev-lad.rj@bp.renesas.com>

Reviewed-by: Andrew Lunn <andrew@lunn.ch>

    Andrew