Skip to content

Commit

Permalink
dmaengine: xilinx: Simplify with dev_err_probe()
Browse files Browse the repository at this point in the history
Common pattern of handling deferred probe can be simplified with
dev_err_probe().  Less code and the error value gets printed.

Signed-off-by: Krzysztof Kozlowski <krzk@kernel.org>
Link: https://lore.kernel.org/r/20200828152637.16903-3-krzk@kernel.org
Signed-off-by: Vinod Koul <vkoul@kernel.org>
  • Loading branch information
Krzysztof Kozlowski authored and Vinod Koul committed Sep 3, 2020
1 parent 1c966e1 commit b0ef489
Showing 1 changed file with 8 additions and 28 deletions.
36 changes: 8 additions & 28 deletions drivers/dma/xilinx/xilinx_dma.c
Original file line number Diff line number Diff line change
Expand Up @@ -2536,13 +2536,8 @@ static int axidma_clk_init(struct platform_device *pdev, struct clk **axi_clk,
*tmp_clk = NULL;

*axi_clk = devm_clk_get(&pdev->dev, "s_axi_lite_aclk");
if (IS_ERR(*axi_clk)) {
err = PTR_ERR(*axi_clk);
if (err != -EPROBE_DEFER)
dev_err(&pdev->dev, "failed to get axi_aclk (%d)\n",
err);
return err;
}
if (IS_ERR(*axi_clk))
return dev_err_probe(&pdev->dev, PTR_ERR(*axi_clk), "failed to get axi_aclk\n");

*tx_clk = devm_clk_get(&pdev->dev, "m_axi_mm2s_aclk");
if (IS_ERR(*tx_clk))
Expand Down Expand Up @@ -2603,22 +2598,12 @@ static int axicdma_clk_init(struct platform_device *pdev, struct clk **axi_clk,
*tmp2_clk = NULL;

*axi_clk = devm_clk_get(&pdev->dev, "s_axi_lite_aclk");
if (IS_ERR(*axi_clk)) {
err = PTR_ERR(*axi_clk);
if (err != -EPROBE_DEFER)
dev_err(&pdev->dev, "failed to get axi_clk (%d)\n",
err);
return err;
}
if (IS_ERR(*axi_clk))
return dev_err_probe(&pdev->dev, PTR_ERR(*axi_clk), "failed to get axi_aclk\n");

*dev_clk = devm_clk_get(&pdev->dev, "m_axi_aclk");
if (IS_ERR(*dev_clk)) {
err = PTR_ERR(*dev_clk);
if (err != -EPROBE_DEFER)
dev_err(&pdev->dev, "failed to get dev_clk (%d)\n",
err);
return err;
}
if (IS_ERR(*dev_clk))
return dev_err_probe(&pdev->dev, PTR_ERR(*dev_clk), "failed to get dev_clk\n");

err = clk_prepare_enable(*axi_clk);
if (err) {
Expand Down Expand Up @@ -2647,13 +2632,8 @@ static int axivdma_clk_init(struct platform_device *pdev, struct clk **axi_clk,
int err;

*axi_clk = devm_clk_get(&pdev->dev, "s_axi_lite_aclk");
if (IS_ERR(*axi_clk)) {
err = PTR_ERR(*axi_clk);
if (err != -EPROBE_DEFER)
dev_err(&pdev->dev, "failed to get axi_aclk (%d)\n",
err);
return err;
}
if (IS_ERR(*axi_clk))
return dev_err_probe(&pdev->dev, PTR_ERR(*axi_clk), "failed to get axi_aclk\n");

*tx_clk = devm_clk_get(&pdev->dev, "m_axi_mm2s_aclk");
if (IS_ERR(*tx_clk))
Expand Down

0 comments on commit b0ef489

Please sign in to comment.