diff options
author | Dinghao Liu <dinghao.liu@zju.edu.cn> | 2020-08-23 11:56:47 +0300 |
---|---|---|
committer | Greg Kroah-Hartman <gregkh@linuxfoundation.org> | 2020-09-09 20:12:25 +0300 |
commit | 719f92de3ffff613f7ba66e4f9edd58116a46f62 (patch) | |
tree | a3c17489d628db4ba4deea2b44f0934737d63116 /drivers/net/ethernet/arc | |
parent | 268fe5a4c040a2cd0e04b70601e96b406a2c4736 (diff) | |
download | linux-719f92de3ffff613f7ba66e4f9edd58116a46f62.tar.xz |
net: arc_emac: Fix memleak in arc_mdio_probe
[ Upstream commit e2d79cd8875fa8c3cc7defa98a8cc99a1ed0c62f ]
When devm_gpiod_get_optional() fails, bus should be
freed just like when of_mdiobus_register() fails.
Fixes: 1bddd96cba03d ("net: arc_emac: support the phy reset for emac driver")
Signed-off-by: Dinghao Liu <dinghao.liu@zju.edu.cn>
Reviewed-by: Andrew Lunn <andrew@lunn.ch>
Signed-off-by: David S. Miller <davem@davemloft.net>
Signed-off-by: Sasha Levin <sashal@kernel.org>
Diffstat (limited to 'drivers/net/ethernet/arc')
-rw-r--r-- | drivers/net/ethernet/arc/emac_mdio.c | 1 |
1 files changed, 1 insertions, 0 deletions
diff --git a/drivers/net/ethernet/arc/emac_mdio.c b/drivers/net/ethernet/arc/emac_mdio.c index 0187dbf3b87d..54cdafdd067d 100644 --- a/drivers/net/ethernet/arc/emac_mdio.c +++ b/drivers/net/ethernet/arc/emac_mdio.c @@ -153,6 +153,7 @@ int arc_mdio_probe(struct arc_emac_priv *priv) if (IS_ERR(data->reset_gpio)) { error = PTR_ERR(data->reset_gpio); dev_err(priv->dev, "Failed to request gpio: %d\n", error); + mdiobus_free(bus); return error; } |