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>
This commit is contained in:
Michael Tretter 2021-03-17 17:16:09 +01:00 committed by David S. Miller
parent 4cb50d00fe
commit a04be4b6b5
1 changed files with 8 additions and 10 deletions

View File

@ -3758,17 +3758,15 @@ static int macb_clk_init(struct platform_device *pdev, struct clk **pclk,
*hclk = devm_clk_get(&pdev->dev, "hclk"); *hclk = devm_clk_get(&pdev->dev, "hclk");
} }
if (IS_ERR_OR_NULL(*pclk)) { if (IS_ERR_OR_NULL(*pclk))
err = IS_ERR(*pclk) ? PTR_ERR(*pclk) : -ENODEV; return dev_err_probe(&pdev->dev,
dev_err(&pdev->dev, "failed to get macb_clk (%d)\n", err); IS_ERR(*pclk) ? PTR_ERR(*pclk) : -ENODEV,
return err; "failed to get pclk\n");
}
if (IS_ERR_OR_NULL(*hclk)) { if (IS_ERR_OR_NULL(*hclk))
err = IS_ERR(*hclk) ? PTR_ERR(*hclk) : -ENODEV; return dev_err_probe(&pdev->dev,
dev_err(&pdev->dev, "failed to get hclk (%d)\n", err); IS_ERR(*hclk) ? PTR_ERR(*hclk) : -ENODEV,
return err; "failed to get hclk\n");
}
*tx_clk = devm_clk_get_optional(&pdev->dev, "tx_clk"); *tx_clk = devm_clk_get_optional(&pdev->dev, "tx_clk");
if (IS_ERR(*tx_clk)) if (IS_ERR(*tx_clk))