summaryrefslogtreecommitdiff
path: root/drivers/net/ethernet/cadence
diff options
context:
space:
mode:
authorMichael Tretter <m.tretter@pengutronix.de>2021-03-17 17:16:09 +0100
committerDavid S. Miller <davem@davemloft.net>2021-03-17 15:10:05 -0700
commita04be4b6b539cfce52181f6f8f15a823d99f520c (patch)
treef56b3bcf81e447bfb5c5c166b43fc7eebc08509c /drivers/net/ethernet/cadence
parent4cb50d00fe96ea13b97caddb89cfc301571cbc63 (diff)
net: macb: simplify clk_init with dev_err_probe
On some platforms, e.g., the ZynqMP, devm_clk_get can return -EPROBE_DEFER if the clock controller, which is implemented in firmware, has not been probed yet. As clk_init is only called during probe, use dev_err_probe to simplify the error message and hide it for -EPROBE_DEFER. Signed-off-by: Michael Tretter <m.tretter@pengutronix.de> Acked-by: Nicolas Ferre <nicolas.ferre@microchip.com> Signed-off-by: David S. Miller <davem@davemloft.net>
Diffstat (limited to 'drivers/net/ethernet/cadence')
-rw-r--r--drivers/net/ethernet/cadence/macb_main.c20
1 files changed, 9 insertions, 11 deletions
diff --git a/drivers/net/ethernet/cadence/macb_main.c b/drivers/net/ethernet/cadence/macb_main.c
index e7c123aadf56..f56f3dbbc015 100644
--- a/drivers/net/ethernet/cadence/macb_main.c
+++ b/drivers/net/ethernet/cadence/macb_main.c
@@ -3758,17 +3758,15 @@ static int macb_clk_init(struct platform_device *pdev, struct clk **pclk,
*hclk = devm_clk_get(&pdev->dev, "hclk");
}
- if (IS_ERR_OR_NULL(*pclk)) {
- err = IS_ERR(*pclk) ? PTR_ERR(*pclk) : -ENODEV;
- dev_err(&pdev->dev, "failed to get macb_clk (%d)\n", err);
- return err;
- }
-
- if (IS_ERR_OR_NULL(*hclk)) {
- err = IS_ERR(*hclk) ? PTR_ERR(*hclk) : -ENODEV;
- dev_err(&pdev->dev, "failed to get hclk (%d)\n", err);
- return err;
- }
+ if (IS_ERR_OR_NULL(*pclk))
+ return dev_err_probe(&pdev->dev,
+ IS_ERR(*pclk) ? PTR_ERR(*pclk) : -ENODEV,
+ "failed to get pclk\n");
+
+ if (IS_ERR_OR_NULL(*hclk))
+ return dev_err_probe(&pdev->dev,
+ IS_ERR(*hclk) ? PTR_ERR(*hclk) : -ENODEV,
+ "failed to get hclk\n");
*tx_clk = devm_clk_get_optional(&pdev->dev, "tx_clk");
if (IS_ERR(*tx_clk))