diff mbox series

[03/11] spi: atmel: Simplify with dev_err_probe()

Message ID 20200901152713.18629-3-krzk@kernel.org (mailing list archive)
State Accepted
Commit 96189475820835d7176171492640a58c600aca42
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-atmel.c | 5 ++---
 1 file changed, 2 insertions(+), 3 deletions(-)

Comments

Alexandre Belloni Sept. 1, 2020, 7:12 p.m. UTC | #1
On 01/09/2020 17:27:05+0200, 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: Alexandre Belloni <alexandre.belloni@bootlin.com>

> ---
>  drivers/spi/spi-atmel.c | 5 ++---
>  1 file changed, 2 insertions(+), 3 deletions(-)
> 
> diff --git a/drivers/spi/spi-atmel.c b/drivers/spi/spi-atmel.c
> index 2cfe6253a784..7c68d5cdbdc6 100644
> --- a/drivers/spi/spi-atmel.c
> +++ b/drivers/spi/spi-atmel.c
> @@ -513,9 +513,8 @@ static int atmel_spi_configure_dma(struct spi_master *master,
>  
>  	master->dma_tx = dma_request_chan(dev, "tx");
>  	if (IS_ERR(master->dma_tx)) {
> -		err = PTR_ERR(master->dma_tx);
> -		if (err != -EPROBE_DEFER)
> -			dev_err(dev, "No TX DMA channel, DMA is disabled\n");
> +		err = dev_err_probe(dev, PTR_ERR(master->dma_tx),
> +				    "No TX DMA channel, DMA is disabled\n");
>  		goto error_clear;
>  	}
>  
> -- 
> 2.17.1
>
diff mbox series

Patch

diff --git a/drivers/spi/spi-atmel.c b/drivers/spi/spi-atmel.c
index 2cfe6253a784..7c68d5cdbdc6 100644
--- a/drivers/spi/spi-atmel.c
+++ b/drivers/spi/spi-atmel.c
@@ -513,9 +513,8 @@  static int atmel_spi_configure_dma(struct spi_master *master,
 
 	master->dma_tx = dma_request_chan(dev, "tx");
 	if (IS_ERR(master->dma_tx)) {
-		err = PTR_ERR(master->dma_tx);
-		if (err != -EPROBE_DEFER)
-			dev_err(dev, "No TX DMA channel, DMA is disabled\n");
+		err = dev_err_probe(dev, PTR_ERR(master->dma_tx),
+				    "No TX DMA channel, DMA is disabled\n");
 		goto error_clear;
 	}