[PATCH 01/11] spi: sprd: Release DMA channel also on probe deferral

Chunyan Zhang zhang.lyra at gmail.com
Tue Sep 8 03:27:10 EDT 2020


On Tue, 1 Sep 2020 at 23:27, Krzysztof Kozlowski <krzk at kernel.org> wrote:
>
> If dma_request_chan() for TX channel fails with EPROBE_DEFER, the RX
> channel would not be released and on next re-probe it would be requested
> second time.
>
> Fixes: 386119bc7be9 ("spi: sprd: spi: sprd: Add DMA mode support")
> Cc: <stable at vger.kernel.org>
> Signed-off-by: Krzysztof Kozlowski <krzk at kernel.org>

Acked-by: Chunyan Zhang <zhang.lyra at gmail.com>

Thanks,
Chunyan

> ---
>  drivers/spi/spi-sprd.c | 2 +-
>  1 file changed, 1 insertion(+), 1 deletion(-)
>
> diff --git a/drivers/spi/spi-sprd.c b/drivers/spi/spi-sprd.c
> index 6678f1cbc566..0443fec3a6ab 100644
> --- a/drivers/spi/spi-sprd.c
> +++ b/drivers/spi/spi-sprd.c
> @@ -563,11 +563,11 @@ static int sprd_spi_dma_request(struct sprd_spi *ss)
>
>         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");
> -               dma_release_channel(ss->dma.dma_chan[SPRD_SPI_RX]);
>                 return PTR_ERR(ss->dma.dma_chan[SPRD_SPI_TX]);
>         }
>
> --
> 2.17.1
>



More information about the linux-arm-kernel mailing list