Skip to content

Commit e6afcf6

Browse files
Fabrice Gasnierjic23
authored andcommitted
iio: adc: stm32-adc: fix stopping dma
There maybe a race when using dmaengine_terminate_all(). The predisable routine may call iio_triggered_buffer_predisable() prior to a pending DMA callback. Adopt dmaengine_terminate_sync() to ensure there's no pending DMA request before calling iio_triggered_buffer_predisable(). Fixes: 2763ea0 ("iio: adc: stm32: add optional dma support") Signed-off-by: Fabrice Gasnier <[email protected]> Cc: <[email protected]> Signed-off-by: Jonathan Cameron <[email protected]>
1 parent 6e82ae6 commit e6afcf6

File tree

1 file changed

+2
-2
lines changed

1 file changed

+2
-2
lines changed

drivers/iio/adc/stm32-adc.c

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -1399,7 +1399,7 @@ static int stm32_adc_dma_start(struct iio_dev *indio_dev)
13991399
cookie = dmaengine_submit(desc);
14001400
ret = dma_submit_error(cookie);
14011401
if (ret) {
1402-
dmaengine_terminate_all(adc->dma_chan);
1402+
dmaengine_terminate_sync(adc->dma_chan);
14031403
return ret;
14041404
}
14051405

@@ -1477,7 +1477,7 @@ static void __stm32_adc_buffer_predisable(struct iio_dev *indio_dev)
14771477
stm32_adc_conv_irq_disable(adc);
14781478

14791479
if (adc->dma_chan)
1480-
dmaengine_terminate_all(adc->dma_chan);
1480+
dmaengine_terminate_sync(adc->dma_chan);
14811481

14821482
if (stm32_adc_set_trig(indio_dev, NULL))
14831483
dev_err(&indio_dev->dev, "Can't clear trigger\n");

0 commit comments

Comments
 (0)