Skip to content

Commit 175811b

Browse files
committed
Revert "net: mdio_bus: Use devm for getting reset GPIO"
This reverts commit 3b98c93. Russell says: Using devm_*() [here] is completely wrong, because this is called from mdiobus_register_device(). This is not the probe function for the device, and thus there is no code to trigger the release of the resource on unregistration. Moreover, when the mdiodev is eventually probed, if the driver fails or the driver is unbound, the GPIO will be released, but a reference will be left behind. Using devm* with a struct device that is *not* currently being probed is fundamentally wrong - an abuse of devm. Reported-by: Mark Brown <[email protected]> Link: https://lore.kernel.org/[email protected] Suggested-by: Russell King (Oracle) <[email protected]> Fixes: 3b98c93 ("net: mdio_bus: Use devm for getting reset GPIO") Link: https://patch.msgid.link/[email protected] Signed-off-by: Jakub Kicinski <[email protected]>
1 parent 5ef7fdf commit 175811b

File tree

1 file changed

+2
-2
lines changed

1 file changed

+2
-2
lines changed

drivers/net/phy/mdio_bus.c

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -36,8 +36,8 @@
3636
static int mdiobus_register_gpiod(struct mdio_device *mdiodev)
3737
{
3838
/* Deassert the optional reset signal */
39-
mdiodev->reset_gpio = devm_gpiod_get_optional(&mdiodev->dev,
40-
"reset", GPIOD_OUT_LOW);
39+
mdiodev->reset_gpio = gpiod_get_optional(&mdiodev->dev,
40+
"reset", GPIOD_OUT_LOW);
4141
if (IS_ERR(mdiodev->reset_gpio))
4242
return PTR_ERR(mdiodev->reset_gpio);
4343

0 commit comments

Comments
 (0)