Skip to content

Commit

Permalink
spi: dw: Discard chip enabling on DMA setup error
Browse files Browse the repository at this point in the history
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>
  • Loading branch information
Serge Semin authored and Mark Brown committed Oct 8, 2020
1 parent da8f589 commit c6cb381
Showing 1 changed file with 1 addition and 3 deletions.
4 changes: 1 addition & 3 deletions drivers/spi/spi-dw-core.c
Original file line number Diff line number Diff line change
Expand Up @@ -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);
Expand Down

0 comments on commit c6cb381

Please sign in to comment.