summaryrefslogtreecommitdiff
path: root/drivers/net/phy/mdio_bus.c
diff options
context:
space:
mode:
authorFlorian Fainelli <f.fainelli@gmail.com>2020-04-19 06:17:13 +0300
committerDavid S. Miller <davem@davemloft.net>2020-04-20 21:55:13 +0300
commitc290d1ab12d3385da1d7be909e6b09caea3325bb (patch)
tree9ed44bd885a1062854871e0fb4c5c5ff7c97da2b /drivers/net/phy/mdio_bus.c
parentad3df63723a3fab65daaaf2daaa1a196659bb8e3 (diff)
downloadlinux-c290d1ab12d3385da1d7be909e6b09caea3325bb.tar.xz
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: Florian Fainelli <f.fainelli@gmail.com> Reviewed-by: Andrew Lunn <andrew@lunn.ch> Signed-off-by: David S. Miller <davem@davemloft.net>
Diffstat (limited to 'drivers/net/phy/mdio_bus.c')
-rw-r--r--drivers/net/phy/mdio_bus.c9
1 files changed, 6 insertions, 3 deletions
diff --git a/drivers/net/phy/mdio_bus.c b/drivers/net/phy/mdio_bus.c
index 7a4eb3f2cb74..346e88435d29 100644
--- a/drivers/net/phy/mdio_bus.c
+++ b/drivers/net/phy/mdio_bus.c
@@ -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) {
@@ -657,7 +660,7 @@ error:
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);