Skip to content

Commit

Permalink
net: phy: Propagate error from bus->reset
Browse files Browse the repository at this point in the history
If a bus->reset() call for the mii_bus structure returns an error (e.g.:
-EPROE_DEFER) we should propagate it accordingly.

Signed-off-by: Florian Fainelli <f.fainelli@gmail.com>
Reviewed-by: Andrew Lunn <andrew@lunn.ch>
Signed-off-by: David S. Miller <davem@davemloft.net>
  • Loading branch information
Florian Fainelli authored and David S. Miller committed Apr 20, 2020
1 parent ad3df63 commit c290d1a
Showing 1 changed file with 6 additions and 3 deletions.
9 changes: 6 additions & 3 deletions drivers/net/phy/mdio_bus.c
Original file line number Diff line number Diff line change
Expand Up @@ -627,8 +627,11 @@ int __mdiobus_register(struct mii_bus *bus, struct module *owner)
gpiod_set_value_cansleep(gpiod, 0);
}

if (bus->reset)
bus->reset(bus);
if (bus->reset) {
err = bus->reset(bus);
if (err)
goto error_reset_gpiod;
}

for (i = 0; i < PHY_MAX_ADDR; i++) {
if ((bus->phy_mask & (1 << i)) == 0) {
Expand Down Expand Up @@ -657,7 +660,7 @@ int __mdiobus_register(struct mii_bus *bus, struct module *owner)
mdiodev->device_remove(mdiodev);
mdiodev->device_free(mdiodev);
}

error_reset_gpiod:
/* Put PHYs in RESET to save power */
if (bus->reset_gpiod)
gpiod_set_value_cansleep(bus->reset_gpiod, 1);
Expand Down

0 comments on commit c290d1a

Please sign in to comment.