2
0
mirror of https://github.com/edk2-porting/linux-next.git synced 2024-12-27 14:43:58 +08:00

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: Serge Semin <Sergey.Semin@baikalelectronics.ru>
Link: https://lore.kernel.org/r/20201007235511.4935-13-Sergey.Semin@baikalelectronics.ru
Signed-off-by: Mark Brown <broonie@kernel.org>
This commit is contained in:
Serge Semin 2020-10-08 02:55:01 +03:00 committed by Mark Brown
parent da8f58909e
commit c6cb3815f7
No known key found for this signature in database
GPG Key ID: 24D68B725D5487D0

View File

@ -372,10 +372,8 @@ static int dw_spi_transfer_one(struct spi_controller *master,
if (dws->dma_mapped) {
ret = dws->dma_ops->dma_setup(dws, transfer);
if (ret < 0) {
spi_enable_chip(dws, 1);
if (ret)
return ret;
}
}
spi_enable_chip(dws, 1);