diff mbox series

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

Message ID CAKKbWA4YJZPuC+b8+ud-PW=ttfR_rmVG6bEtuYfkkmi1a6EtQA@mail.gmail.com
State New
Headers show
Series net: nuvoton: emc: Fix: some failed phy functions did not return error | expand

Commit Message

Avi Fishman May 10, 2021, 12:09 p.m. UTC
Fix: before this fix when mdiobus_register() or phy_find_first()
failed the function did not return error.

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

Patch

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;
  }