Commit c290d1ab authored by Florian Fainelli's avatar Florian Fainelli Committed by David S. Miller

net: phy: Propagate error from bus->reset

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: default avatarFlorian Fainelli <f.fainelli@gmail.com>
Reviewed-by: default avatarAndrew Lunn <andrew@lunn.ch>
Signed-off-by: default avatarDavid S. Miller <davem@davemloft.net>
parent ad3df637
...@@ -627,8 +627,11 @@ int __mdiobus_register(struct mii_bus *bus, struct module *owner) ...@@ -627,8 +627,11 @@ int __mdiobus_register(struct mii_bus *bus, struct module *owner)
gpiod_set_value_cansleep(gpiod, 0); gpiod_set_value_cansleep(gpiod, 0);
} }
if (bus->reset) if (bus->reset) {
bus->reset(bus); err = bus->reset(bus);
if (err)
goto error_reset_gpiod;
}
for (i = 0; i < PHY_MAX_ADDR; i++) { for (i = 0; i < PHY_MAX_ADDR; i++) {
if ((bus->phy_mask & (1 << i)) == 0) { if ((bus->phy_mask & (1 << i)) == 0) {
...@@ -657,7 +660,7 @@ int __mdiobus_register(struct mii_bus *bus, struct module *owner) ...@@ -657,7 +660,7 @@ int __mdiobus_register(struct mii_bus *bus, struct module *owner)
mdiodev->device_remove(mdiodev); mdiodev->device_remove(mdiodev);
mdiodev->device_free(mdiodev); mdiodev->device_free(mdiodev);
} }
error_reset_gpiod:
/* Put PHYs in RESET to save power */ /* Put PHYs in RESET to save power */
if (bus->reset_gpiod) if (bus->reset_gpiod)
gpiod_set_value_cansleep(bus->reset_gpiod, 1); gpiod_set_value_cansleep(bus->reset_gpiod, 1);
......
Markdown is supported
0%
or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment