Commit e2d79cd8 authored by Dinghao Liu's avatar Dinghao Liu Committed by David S. Miller

net: arc_emac: Fix memleak in arc_mdio_probe

When devm_gpiod_get_optional() fails, bus should be
freed just like when of_mdiobus_register() fails.

Fixes: 1bddd96c ("net: arc_emac: support the phy reset for emac driver")
Signed-off-by: default avatarDinghao Liu <dinghao.liu@zju.edu.cn>
Reviewed-by: default avatarAndrew Lunn <andrew@lunn.ch>
Signed-off-by: default avatarDavid S. Miller <davem@davemloft.net>
parent f97c04c3
...@@ -153,6 +153,7 @@ int arc_mdio_probe(struct arc_emac_priv *priv) ...@@ -153,6 +153,7 @@ int arc_mdio_probe(struct arc_emac_priv *priv)
if (IS_ERR(data->reset_gpio)) { if (IS_ERR(data->reset_gpio)) {
error = PTR_ERR(data->reset_gpio); error = PTR_ERR(data->reset_gpio);
dev_err(priv->dev, "Failed to request gpio: %d\n", error); dev_err(priv->dev, "Failed to request gpio: %d\n", error);
mdiobus_free(bus);
return error; return error;
} }
......
Markdown is supported
0%
or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment