]> git.baikalelectronics.ru Git - kernel.git/commit
spi: rspi: Fix leaking of unused DMA descriptors
authorGeert Uytterhoeven <geert+renesas@glider.be>
Wed, 6 Aug 2014 12:58:58 +0000 (14:58 +0200)
committerMark Brown <broonie@linaro.org>
Sat, 16 Aug 2014 22:13:53 +0000 (17:13 -0500)
commit055323c5ceec94dc421c6ea6c731047f9861987d
treec3276922453c341ebe0ca35cf48f2d3c959d7bf2
parentf45f9587f1dd1e89dd1c89561c9572f777c5bcb7
spi: rspi: Fix leaking of unused DMA descriptors

If dmaengine_prep_slave_sg() or dmaengine_submit() fail, we may leak
unused DMA descriptors.

As per Documentation/dmaengine.txt, once a DMA descriptor has been
obtained, it must be submitted. Hence:
  - First prepare and submit all DMA descriptors,
  - Prepare the SPI controller for DMA,
  - Start DMA by calling dma_async_issue_pending(),
  - Make sure to call dmaengine_terminate_all() on all descriptors that
    haven't completed.

Reported-by: Laurent Pinchart <laurent.pinchart@ideasonboard.com>
Signed-off-by: Geert Uytterhoeven <geert+renesas@glider.be>
Signed-off-by: Mark Brown <broonie@linaro.org>
drivers/spi/spi-rspi.c