Commit 01bf246a authored by David S. Miller's avatar David S. Miller

Merge branch 'net-dev_err_probe'

Yang Yingliang says:

====================
net: drivers: Switch to use dev_err_probe() helper

In the probe path, dev_err() can be replace with dev_err_probe()
which will check if error code is -EPROBE_DEFER. It will print
error code in a human readable way and simplify the code.
====================
Signed-off-by: default avatarDavid S. Miller <davem@davemloft.net>
parents 63b7c2eb 75ae8c28
...@@ -1989,11 +1989,9 @@ static int gswip_gphy_fw_probe(struct gswip_priv *priv, ...@@ -1989,11 +1989,9 @@ static int gswip_gphy_fw_probe(struct gswip_priv *priv,
} }
gphy_fw->reset = of_reset_control_array_get_exclusive(gphy_fw_np); gphy_fw->reset = of_reset_control_array_get_exclusive(gphy_fw_np);
if (IS_ERR(gphy_fw->reset)) { if (IS_ERR(gphy_fw->reset))
if (PTR_ERR(gphy_fw->reset) != -EPROBE_DEFER) return dev_err_probe(dev, PTR_ERR(gphy_fw->reset),
dev_err(dev, "Failed to lookup gphy reset\n"); "Failed to lookup gphy reset\n");
return PTR_ERR(gphy_fw->reset);
}
return gswip_gphy_fw_load(priv, gphy_fw); return gswip_gphy_fw_load(priv, gphy_fw);
} }
......
...@@ -2979,11 +2979,9 @@ static int emac_init_config(struct emac_instance *dev) ...@@ -2979,11 +2979,9 @@ static int emac_init_config(struct emac_instance *dev)
/* Read MAC-address */ /* Read MAC-address */
err = of_get_ethdev_address(np, dev->ndev); err = of_get_ethdev_address(np, dev->ndev);
if (err) { if (err)
if (err != -EPROBE_DEFER) return dev_err_probe(&dev->ofdev->dev, err,
dev_err(&dev->ofdev->dev, "Can't get valid [local-]mac-address from OF !\n"); "Can't get valid [local-]mac-address from OF !\n");
return err;
}
/* IAHT and GAHT filter parameterization */ /* IAHT and GAHT filter parameterization */
if (emac_has_feature(dev, EMAC_FTR_EMAC4SYNC)) { if (emac_has_feature(dev, EMAC_FTR_EMAC4SYNC)) {
......
...@@ -445,9 +445,7 @@ static int dwc_eth_dwmac_probe(struct platform_device *pdev) ...@@ -445,9 +445,7 @@ static int dwc_eth_dwmac_probe(struct platform_device *pdev)
ret = data->probe(pdev, plat_dat, &stmmac_res); ret = data->probe(pdev, plat_dat, &stmmac_res);
if (ret < 0) { if (ret < 0) {
if (ret != -EPROBE_DEFER) dev_err_probe(&pdev->dev, ret, "failed to probe subdriver\n");
dev_err(&pdev->dev, "failed to probe subdriver: %d\n",
ret);
goto remove_config; goto remove_config;
} }
......
...@@ -943,9 +943,7 @@ struct am65_cpts *am65_cpts_create(struct device *dev, void __iomem *regs, ...@@ -943,9 +943,7 @@ struct am65_cpts *am65_cpts_create(struct device *dev, void __iomem *regs,
cpts->irq = of_irq_get_byname(node, "cpts"); cpts->irq = of_irq_get_byname(node, "cpts");
if (cpts->irq <= 0) { if (cpts->irq <= 0) {
ret = cpts->irq ?: -ENXIO; ret = cpts->irq ?: -ENXIO;
if (ret != -EPROBE_DEFER) dev_err_probe(dev, ret, "Failed to get IRQ number\n");
dev_err(dev, "Failed to get IRQ number (err = %d)\n",
ret);
return ERR_PTR(ret); return ERR_PTR(ret);
} }
...@@ -965,8 +963,7 @@ struct am65_cpts *am65_cpts_create(struct device *dev, void __iomem *regs, ...@@ -965,8 +963,7 @@ struct am65_cpts *am65_cpts_create(struct device *dev, void __iomem *regs,
cpts->refclk = devm_get_clk_from_child(dev, node, "cpts"); cpts->refclk = devm_get_clk_from_child(dev, node, "cpts");
if (IS_ERR(cpts->refclk)) { if (IS_ERR(cpts->refclk)) {
ret = PTR_ERR(cpts->refclk); ret = PTR_ERR(cpts->refclk);
if (ret != -EPROBE_DEFER) dev_err_probe(dev, ret, "Failed to get refclk\n");
dev_err(dev, "Failed to get refclk %d\n", ret);
return ERR_PTR(ret); return ERR_PTR(ret);
} }
......
...@@ -1319,8 +1319,7 @@ static int cpsw_probe_dt(struct cpsw_platform_data *data, ...@@ -1319,8 +1319,7 @@ static int cpsw_probe_dt(struct cpsw_platform_data *data,
*/ */
ret = of_phy_register_fixed_link(slave_node); ret = of_phy_register_fixed_link(slave_node);
if (ret) { if (ret) {
if (ret != -EPROBE_DEFER) dev_err_probe(&pdev->dev, ret, "failed to register fixed-link phy\n");
dev_err(&pdev->dev, "failed to register fixed-link phy: %d\n", ret);
goto err_node_put; goto err_node_put;
} }
slave_data->phy_node = of_node_get(slave_node); slave_data->phy_node = of_node_get(slave_node);
......
...@@ -1288,9 +1288,8 @@ static int cpsw_probe_dt(struct cpsw_common *cpsw) ...@@ -1288,9 +1288,8 @@ static int cpsw_probe_dt(struct cpsw_common *cpsw)
if (of_phy_is_fixed_link(port_np)) { if (of_phy_is_fixed_link(port_np)) {
ret = of_phy_register_fixed_link(port_np); ret = of_phy_register_fixed_link(port_np);
if (ret) { if (ret) {
if (ret != -EPROBE_DEFER) dev_err_probe(dev, ret, "%pOF failed to register fixed-link phy\n",
dev_err(dev, "%pOF failed to register fixed-link phy: %d\n", port_np);
port_np, ret);
goto err_node_put; goto err_node_put;
} }
slave_data->phy_node = of_node_get(port_np); slave_data->phy_node = of_node_get(port_np);
......
...@@ -1563,16 +1563,12 @@ static int temac_probe(struct platform_device *pdev) ...@@ -1563,16 +1563,12 @@ static int temac_probe(struct platform_device *pdev)
} }
/* Error handle returned DMA RX and TX interrupts */ /* Error handle returned DMA RX and TX interrupts */
if (lp->rx_irq < 0) { if (lp->rx_irq < 0)
if (lp->rx_irq != -EPROBE_DEFER) return dev_err_probe(&pdev->dev, lp->rx_irq,
dev_err(&pdev->dev, "could not get DMA RX irq\n"); "could not get DMA RX irq\n");
return lp->rx_irq; if (lp->tx_irq < 0)
} return dev_err_probe(&pdev->dev, lp->tx_irq,
if (lp->tx_irq < 0) { "could not get DMA TX irq\n");
if (lp->tx_irq != -EPROBE_DEFER)
dev_err(&pdev->dev, "could not get DMA TX irq\n");
return lp->tx_irq;
}
if (temac_np) { if (temac_np) {
/* Retrieve the MAC address */ /* Retrieve the MAC address */
......
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