diff mbox series

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

Message ID 20200901152713.18629-1-krzk@kernel.org (mailing list archive)
State Accepted
Commit 687a2e76186dcfa42f22c14b655c3fb159839e79
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
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@vger.kernel.org>
Signed-off-by: Krzysztof Kozlowski <krzk@kernel.org>
---
 drivers/spi/spi-sprd.c | 2 +-
 1 file changed, 1 insertion(+), 1 deletion(-)

Comments

Chunyan Zhang Sept. 8, 2020, 7:27 a.m. UTC | #1
On Tue, 1 Sep 2020 at 23:27, Krzysztof Kozlowski <krzk@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@vger.kernel.org>
> Signed-off-by: Krzysztof Kozlowski <krzk@kernel.org>

Acked-by: Chunyan Zhang <zhang.lyra@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
>
Mark Brown Sept. 8, 2020, 5:21 p.m. UTC | #2
On Tue, 1 Sep 2020 17:27:03 +0200, Krzysztof Kozlowski 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.

Applied to

   https://git.kernel.org/pub/scm/linux/kernel/git/broonie/spi.git for-next

Thanks!

[01/11] spi: sprd: Release DMA channel also on probe deferral
        commit: 687a2e76186dcfa42f22c14b655c3fb159839e79
[02/11] spi: sprd: Simplify with dev_err_probe()
        (no commit info)
[03/11] spi: atmel: Simplify with dev_err_probe()
        commit: 96189475820835d7176171492640a58c600aca42
[04/11] spi: bcm2835: Simplify with dev_err_probe()
        commit: 65acd82c4eb7f08747922ed3afb2d099a1b25d3f
[05/11] spi: cadence-quadspi: Simplify with dev_err_probe()
        commit: 436a5c208037a71f64f35312969e27a05d6d7c53
[06/11] spi: spi-mux: Simplify with dev_err_probe()
        commit: 2d9bdf645584d15ed1d4aae6204cb6ea8b673d48
[07/11] spi: qcom-qspi: Simplify with dev_err_probe()
        commit: 034532681c56cfffaea169a59155fe11e9172d9c
[08/11] spi: stm32: Simplify with dev_err_probe()
        commit: a05cec2dc2df1e5d25addb7aba398f3eb451e163
[09/11] spi: synquacer: Simplify with dev_err_probe()
        commit: 74ee6dc1257edf5fcfba67fd8075b766d11c42a0
[10/11] spi: tegra114: Simplify with dev_err_probe()
        commit: 68fffc191ed19ea5618285b128e6048d1536e680
[11/11] spi: tegra20: Simplify with dev_err_probe()
        commit: 7708aff1e2ebc8fdccdd61cf9ab8576a66989166

All being well this means that it will be integrated into the linux-next
tree (usually sometime in the next 24 hours) and sent to Linus during
the next merge window (or sooner if it is a bug fix), however if
problems are discovered then the patch may be dropped or reverted.

You may get further e-mails resulting from automated or manual testing
and review of the tree, please engage with people reporting problems and
send followup patches addressing any issues that are reported if needed.

If any updates are required or you are submitting further changes they
should be sent as incremental updates against current git, existing
patches will not be replaced.

Please add any relevant lists and maintainers to the CCs when replying
to this mail.

Thanks,
Mark
diff mbox series

Patch

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]);
 	}