Commit 95b5fc03 authored by Cai Huoqing's avatar Cai Huoqing Committed by David S. Miller

net: arc_emac: Make use of the helper function dev_err_probe()

When possible use dev_err_probe help to properly deal with the
PROBE_DEFER error, the benefit is that DEFER issue will be logged
in the devices_deferred debugfs file.
And using dev_err_probe() can reduce code size, and simplify the code.
Signed-off-by: default avatarCai Huoqing <caihuoqing@baidu.com>
Signed-off-by: default avatarDavid S. Miller <davem@davemloft.net>
parent 5706383b
...@@ -151,10 +151,9 @@ int arc_mdio_probe(struct arc_emac_priv *priv) ...@@ -151,10 +151,9 @@ int arc_mdio_probe(struct arc_emac_priv *priv)
data->reset_gpio = devm_gpiod_get_optional(priv->dev, "phy-reset", data->reset_gpio = devm_gpiod_get_optional(priv->dev, "phy-reset",
GPIOD_OUT_LOW); GPIOD_OUT_LOW);
if (IS_ERR(data->reset_gpio)) { 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); mdiobus_free(bus);
return error; return dev_err_probe(priv->dev, PTR_ERR(data->reset_gpio),
"Failed to request gpio\n");
} }
of_property_read_u32(np, "phy-reset-duration", &data->msec); of_property_read_u32(np, "phy-reset-duration", &data->msec);
...@@ -166,9 +165,9 @@ int arc_mdio_probe(struct arc_emac_priv *priv) ...@@ -166,9 +165,9 @@ int arc_mdio_probe(struct arc_emac_priv *priv)
error = of_mdiobus_register(bus, priv->dev->of_node); error = of_mdiobus_register(bus, priv->dev->of_node);
if (error) { if (error) {
dev_err(priv->dev, "cannot register MDIO bus %s\n", bus->name);
mdiobus_free(bus); mdiobus_free(bus);
return error; return dev_err_probe(priv->dev, error,
"cannot register MDIO bus %s\n", bus->name);
} }
return 0; return 0;
......
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