[PATCH] net: nuvoton: emc: Fix: some failed phy functions did not return error

Avi Fishman avifishman70 at gmail.com
Mon May 10 22:09:00 AEST 2021


Fix: before this fix when mdiobus_register() or phy_find_first()
failed the function did not return error.

Signed-off-by: Avi Fishman <AviFishman70 at gmail.com>
---
 drivers/net/ethernet/nuvoton/npcm7xx_emc.c | 4 +++-
 1 file changed, 3 insertions(+), 1 deletion(-)

diff --git a/drivers/net/ethernet/nuvoton/npcm7xx_emc.c
b/drivers/net/ethernet/nuvoton/npcm7xx_emc.c
index f07449e2f68d6d..4d9fdb6088a1ac 100644
--- a/drivers/net/ethernet/nuvoton/npcm7xx_emc.c
+++ b/drivers/net/ethernet/nuvoton/npcm7xx_emc.c
@@ -1801,7 +1801,8 @@ static int npcm7xx_mii_setup(struct net_device *dev)
  writel(readl((ether->reg + REG_MCMDR)) | MCMDR_ENMDC,
        (ether->reg + REG_MCMDR));

- if (mdiobus_register(ether->mii_bus)) {
+ err = mdiobus_register(ether->mii_bus);
+ if (err) {
  dev_err(&pdev->dev, "mdiobus_register() failed\n");
  goto out2;
  }
@@ -1809,6 +1810,7 @@ static int npcm7xx_mii_setup(struct net_device *dev)
  phydev = phy_find_first(ether->mii_bus);
  if (!phydev) {
  dev_err(&pdev->dev, "phy_find_first() failed\n");
+ err = -ENODEV;
  goto out3;
  }


More information about the openbmc mailing list