net: stmmac: fix reset gpio free missing [Linux 5.2]

net: stmmac: fix reset gpio free missing [Linux 5.2]

This Linux kernel change "net: stmmac: fix reset gpio free missing" is included in the Linux 5.2 release. This change is authored by Jisheng Zhang <Jisheng.Zhang [at] synaptics.com> on Wed May 22 10:05:09 2019 +0000. The commit for this change in Linux stable tree is 49ce881 (patch).

net: stmmac: fix reset gpio free missing

Commit 984203ceff27 ("net: stmmac: mdio: remove reset gpio free")
removed the reset gpio free, when the driver is unbinded or rmmod,
we miss the gpio free.

This patch uses managed API to request the reset gpio, so that the
gpio could be freed properly.

Fixes: 984203ceff27 ("net: stmmac: mdio: remove reset gpio free")
Signed-off-by: Jisheng Zhang <[email protected]>
Signed-off-by: David S. Miller <[email protected]>

There are 3 lines of Linux source code added/deleted in this change. Code changes to Linux kernel are as follows.

 drivers/net/ethernet/stmicro/stmmac/stmmac_mdio.c | 3 ++-
 1 file changed, 2 insertions(+), 1 deletion(-)

diff --git a/drivers/net/ethernet/stmicro/stmmac/stmmac_mdio.c b/drivers/net/ethernet/stmicro/stmmac/stmmac_mdio.c
index bdd3515..093a223 100644
--- a/drivers/net/ethernet/stmicro/stmmac/stmmac_mdio.c
+++ b/drivers/net/ethernet/stmicro/stmmac/stmmac_mdio.c
@@ -267,7 +267,8 @@ int stmmac_mdio_reset(struct mii_bus *bus)
            of_property_read_u32_array(np,
                "snps,reset-delays-us", data->delays, 3);

-           if (gpio_request(data->reset_gpio, "mdio-reset"))
+           if (devm_gpio_request(priv->device, data->reset_gpio,
+                         "mdio-reset"))
                return 0;
        }

Leave a Reply

Your email address will not be published. Required fields are marked *