Thanks to visit codestin.com
Credit goes to github.com

Skip to content

Commit b9f9035

Browse files
Buday Csabagregkh
authored andcommitted
net: mdiobus: release reset_gpio in mdiobus_unregister_device()
commit 8ea2527 upstream. reset_gpio is claimed in mdiobus_register_device(), but it is not released in mdiobus_unregister_device(). It is instead only released when the whole MDIO bus is unregistered. When a device uses the reset_gpio property, it becomes impossible to unregister it and register it again, because the GPIO remains claimed. This patch resolves that issue. Fixes: bafbdd5 ("phylib: Add device reset GPIO support") # see notes Reviewed-by: Andrew Lunn <[email protected]> Cc: Csókás Bence <[email protected]> [ csokas.bence: Resolve rebase conflict and clarify msg ] Signed-off-by: Buday Csaba <[email protected]> Link: https://patch.msgid.link/[email protected] Signed-off-by: Paolo Abeni <[email protected]> [ csokas.bence: Use the v1 patch on top of 6.12, as specified in notes ] Signed-off-by: Bence Csókás <[email protected]> Signed-off-by: Greg Kroah-Hartman <[email protected]>
1 parent 01e528e commit b9f9035

File tree

1 file changed

+1
-3
lines changed

1 file changed

+1
-3
lines changed

drivers/net/phy/mdio_bus.c

Lines changed: 1 addition & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -97,6 +97,7 @@ int mdiobus_unregister_device(struct mdio_device *mdiodev)
9797
if (mdiodev->bus->mdio_map[mdiodev->addr] != mdiodev)
9898
return -EINVAL;
9999

100+
gpiod_put(mdiodev->reset_gpio);
100101
reset_control_put(mdiodev->reset_ctrl);
101102

102103
mdiodev->bus->mdio_map[mdiodev->addr] = NULL;
@@ -814,9 +815,6 @@ void mdiobus_unregister(struct mii_bus *bus)
814815
if (!mdiodev)
815816
continue;
816817

817-
if (mdiodev->reset_gpio)
818-
gpiod_put(mdiodev->reset_gpio);
819-
820818
mdiodev->device_remove(mdiodev);
821819
mdiodev->device_free(mdiodev);
822820
}

0 commit comments

Comments
 (0)