From 1c966e1d948ba1abf646966ff5f0e57634ae70b7 Mon Sep 17 00:00:00 2001 From: Krzysztof Kozlowski Date: Fri, 28 Aug 2020 17:26:36 +0200 Subject: [PATCH] dmaengine: stm32: Simplify with dev_err_probe() 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 Link: https://lore.kernel.org/r/20200828152637.16903-2-krzk@kernel.org Signed-off-by: Vinod Koul --- drivers/dma/stm32-dma.c | 8 ++------ drivers/dma/stm32-dmamux.c | 9 +++------ drivers/dma/stm32-mdma.c | 9 +++------ 3 files changed, 8 insertions(+), 18 deletions(-) diff --git a/drivers/dma/stm32-dma.c b/drivers/dma/stm32-dma.c index 96ad1b3..d0055d2 100644 --- a/drivers/dma/stm32-dma.c +++ b/drivers/dma/stm32-dma.c @@ -1311,12 +1311,8 @@ static int stm32_dma_probe(struct platform_device *pdev) return PTR_ERR(dmadev->base); dmadev->clk = devm_clk_get(&pdev->dev, NULL); - if (IS_ERR(dmadev->clk)) { - ret = PTR_ERR(dmadev->clk); - if (ret != -EPROBE_DEFER) - dev_err(&pdev->dev, "Can't get clock\n"); - return ret; - } + if (IS_ERR(dmadev->clk)) + return dev_err_probe(&pdev->dev, PTR_ERR(dmadev->clk), "Can't get clock\n"); ret = clk_prepare_enable(dmadev->clk); if (ret < 0) { diff --git a/drivers/dma/stm32-dmamux.c b/drivers/dma/stm32-dmamux.c index 12f7637..a10ccd9 100644 --- a/drivers/dma/stm32-dmamux.c +++ b/drivers/dma/stm32-dmamux.c @@ -252,12 +252,9 @@ static int stm32_dmamux_probe(struct platform_device *pdev) spin_lock_init(&stm32_dmamux->lock); stm32_dmamux->clk = devm_clk_get(&pdev->dev, NULL); - if (IS_ERR(stm32_dmamux->clk)) { - ret = PTR_ERR(stm32_dmamux->clk); - if (ret != -EPROBE_DEFER) - dev_err(&pdev->dev, "Missing clock controller\n"); - return ret; - } + if (IS_ERR(stm32_dmamux->clk)) + return dev_err_probe(&pdev->dev, PTR_ERR(stm32_dmamux->clk), + "Missing clock controller\n"); ret = clk_prepare_enable(stm32_dmamux->clk); if (ret < 0) { diff --git a/drivers/dma/stm32-mdma.c b/drivers/dma/stm32-mdma.c index 5469563..08cfbfa 100644 --- a/drivers/dma/stm32-mdma.c +++ b/drivers/dma/stm32-mdma.c @@ -1580,12 +1580,9 @@ static int stm32_mdma_probe(struct platform_device *pdev) return PTR_ERR(dmadev->base); dmadev->clk = devm_clk_get(&pdev->dev, NULL); - if (IS_ERR(dmadev->clk)) { - ret = PTR_ERR(dmadev->clk); - if (ret != -EPROBE_DEFER) - dev_err(&pdev->dev, "Missing clock controller\n"); - return ret; - } + if (IS_ERR(dmadev->clk)) + return dev_err_probe(&pdev->dev, PTR_ERR(dmadev->clk), + "Missing clock controller\n"); ret = clk_prepare_enable(dmadev->clk); if (ret < 0) { -- 2.7.4