diff options
author | Lubomir Rintel <lkundrak@v3.sk> | 2020-04-24 23:50:20 +0200 |
---|---|---|
committer | Vinod Koul <vkoul@kernel.org> | 2020-04-27 21:33:14 +0530 |
commit | c0fca736098cbd5dce27640e625b20c67d5f99f1 (patch) | |
tree | c22ffb907cec1cab1b82238d61e8770536940e58 /drivers/dma | |
parent | 7edfe3df2a9f469d8e80e4e1877a92377b5722ae (diff) | |
download | linux-next-c0fca736098cbd5dce27640e625b20c67d5f99f1.tar.gz |
dmaengine: mmp_tdma: Validate the transfer direction
We only support DMA_DEV_TO_MEM and DMA_MEM_TO_DEV. Let's not do
undefined things with other values and reject them.
Signed-off-by: Lubomir Rintel <lkundrak@v3.sk>
Link: https://lore.kernel.org/r/20200424215020.105281-1-lkundrak@v3.sk
Signed-off-by: Vinod Koul <vkoul@kernel.org>
Diffstat (limited to 'drivers/dma')
-rw-r--r-- | drivers/dma/mmp_tdma.c | 5 |
1 files changed, 5 insertions, 0 deletions
diff --git a/drivers/dma/mmp_tdma.c b/drivers/dma/mmp_tdma.c index 2e318558c644..42f8b2fb7684 100644 --- a/drivers/dma/mmp_tdma.c +++ b/drivers/dma/mmp_tdma.c @@ -427,6 +427,11 @@ static struct dma_async_tx_descriptor *mmp_tdma_prep_dma_cyclic( int num_periods = buf_len / period_len; int i = 0, buf = 0; + if (!is_slave_direction(direction)) { + dev_err(tdmac->dev, "unsupported transfer direction\n"); + return NULL; + } + if (tdmac->status != DMA_COMPLETE) { dev_err(tdmac->dev, "controller busy"); return NULL; |