Commit c6cb3815 authored by Serge Semin's avatar Serge Semin Committed by Mark Brown

spi: dw: Discard chip enabling on DMA setup error

It's pointless to enable the chip back if the DMA setup procedure fails,
since we'll disable it on the next transfer anyway. For the same reason We
don't do that in case of a failure detected in any other methods called
from the transfer_one() method.

While at it consider any non-zero value returned from the dma_setup
callback to be erroneous as it's supposed to be in the kernel.
Signed-off-by: default avatarSerge Semin <Sergey.Semin@baikalelectronics.ru>
Link: https://lore.kernel.org/r/20201007235511.4935-13-Sergey.Semin@baikalelectronics.ruSigned-off-by: default avatarMark Brown <broonie@kernel.org>
parent da8f5890
...@@ -372,11 +372,9 @@ static int dw_spi_transfer_one(struct spi_controller *master, ...@@ -372,11 +372,9 @@ static int dw_spi_transfer_one(struct spi_controller *master,
if (dws->dma_mapped) { if (dws->dma_mapped) {
ret = dws->dma_ops->dma_setup(dws, transfer); ret = dws->dma_ops->dma_setup(dws, transfer);
if (ret < 0) { if (ret)
spi_enable_chip(dws, 1);
return ret; return ret;
} }
}
spi_enable_chip(dws, 1); spi_enable_chip(dws, 1);
......
Markdown is supported
0%
or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment