diff mbox series

[08/11] spi: stm32: Simplify with dev_err_probe()

Message ID 20200901152713.18629-8-krzk@kernel.org (mailing list archive)
State Accepted
Commit a05cec2dc2df1e5d25addb7aba398f3eb451e163
Headers show
Series [01/11] spi: sprd: Release DMA channel also on probe deferral | expand

Commit Message

Krzysztof Kozlowski Sept. 1, 2020, 3:27 p.m. UTC
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>
---
 drivers/spi/spi-stm32.c | 4 +---
 1 file changed, 1 insertion(+), 3 deletions(-)

Comments

Alain Volmat Sept. 8, 2020, 1:53 p.m. UTC | #1
On Tue, Sep 01, 2020 at 03:27:10PM +0000, Krzysztof Kozlowski wrote:
> 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>

Reviewed-by: Alain Volmat <alain.volmat@st.com>

> ---
>  drivers/spi/spi-stm32.c | 4 +---
>  1 file changed, 1 insertion(+), 3 deletions(-)
> 
> diff --git a/drivers/spi/spi-stm32.c b/drivers/spi/spi-stm32.c
> index d4b33b358a31..f0e594b2fee4 100644
> --- a/drivers/spi/spi-stm32.c
> +++ b/drivers/spi/spi-stm32.c
> @@ -1857,9 +1857,7 @@ static int stm32_spi_probe(struct platform_device *pdev)
>  
>  	spi->irq = platform_get_irq(pdev, 0);
>  	if (spi->irq <= 0) {
> -		ret = spi->irq;
> -		if (ret != -EPROBE_DEFER)
> -			dev_err(&pdev->dev, "failed to get irq: %d\n", ret);
> +		ret = dev_err_probe(&pdev->dev, spi->irq, "failed to get irq\n");
>  		goto err_master_put;
>  	}
>  	ret = devm_request_threaded_irq(&pdev->dev, spi->irq,
> -- 
> 2.17.1
>
diff mbox series

Patch

diff --git a/drivers/spi/spi-stm32.c b/drivers/spi/spi-stm32.c
index d4b33b358a31..f0e594b2fee4 100644
--- a/drivers/spi/spi-stm32.c
+++ b/drivers/spi/spi-stm32.c
@@ -1857,9 +1857,7 @@  static int stm32_spi_probe(struct platform_device *pdev)
 
 	spi->irq = platform_get_irq(pdev, 0);
 	if (spi->irq <= 0) {
-		ret = spi->irq;
-		if (ret != -EPROBE_DEFER)
-			dev_err(&pdev->dev, "failed to get irq: %d\n", ret);
+		ret = dev_err_probe(&pdev->dev, spi->irq, "failed to get irq\n");
 		goto err_master_put;
 	}
 	ret = devm_request_threaded_irq(&pdev->dev, spi->irq,