diff options
author | Krzysztof Kozlowski <krzk@kernel.org> | 2020-09-10 18:07:06 +0200 |
---|---|---|
committer | Mark Brown <broonie@kernel.org> | 2020-09-14 15:50:17 +0100 |
commit | 9d99e55833dddf76dd6470e7ce97201abb612c03 (patch) | |
tree | 10e40108c6905a53ddc64092a9569951e04f3e79 /drivers/spi/spi-sprd.c | |
parent | 6d66507d9b5507e26c5350d5a014b82c704124b8 (diff) | |
download | linux-9d99e55833dddf76dd6470e7ce97201abb612c03.tar.bz2 |
spi: sprd: 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 <krzk@kernel.org>
Acked-by: Chunyan Zhang <zhang.lyra@gmail.com>
Link: https://lore.kernel.org/r/20200910160706.5883-1-krzk@kernel.org
Signed-off-by: Mark Brown <broonie@kernel.org>
Diffstat (limited to 'drivers/spi/spi-sprd.c')
-rw-r--r-- | drivers/spi/spi-sprd.c | 17 |
1 files changed, 5 insertions, 12 deletions
diff --git a/drivers/spi/spi-sprd.c b/drivers/spi/spi-sprd.c index 0443fec3a6ab..635738f54c73 100644 --- a/drivers/spi/spi-sprd.c +++ b/drivers/spi/spi-sprd.c @@ -553,22 +553,15 @@ static int sprd_spi_dma_tx_config(struct sprd_spi *ss, struct spi_transfer *t) static int sprd_spi_dma_request(struct sprd_spi *ss) { ss->dma.dma_chan[SPRD_SPI_RX] = dma_request_chan(ss->dev, "rx_chn"); - if (IS_ERR_OR_NULL(ss->dma.dma_chan[SPRD_SPI_RX])) { - if (PTR_ERR(ss->dma.dma_chan[SPRD_SPI_RX]) == -EPROBE_DEFER) - return PTR_ERR(ss->dma.dma_chan[SPRD_SPI_RX]); - - dev_err(ss->dev, "request RX DMA channel failed!\n"); - return PTR_ERR(ss->dma.dma_chan[SPRD_SPI_RX]); - } + if (IS_ERR_OR_NULL(ss->dma.dma_chan[SPRD_SPI_RX])) + return dev_err_probe(ss->dev, PTR_ERR(ss->dma.dma_chan[SPRD_SPI_RX]), + "request RX DMA channel failed!\n"); ss->dma.dma_chan[SPRD_SPI_TX] = dma_request_chan(ss->dev, "tx_chn"); if (IS_ERR_OR_NULL(ss->dma.dma_chan[SPRD_SPI_TX])) { dma_release_channel(ss->dma.dma_chan[SPRD_SPI_RX]); - if (PTR_ERR(ss->dma.dma_chan[SPRD_SPI_TX]) == -EPROBE_DEFER) - return PTR_ERR(ss->dma.dma_chan[SPRD_SPI_TX]); - - dev_err(ss->dev, "request TX DMA channel failed!\n"); - return PTR_ERR(ss->dma.dma_chan[SPRD_SPI_TX]); + return dev_err_probe(ss->dev, PTR_ERR(ss->dma.dma_chan[SPRD_SPI_TX]), + "request TX DMA channel failed!\n"); } return 0; |