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>
This commit is contained in:
Lubomir Rintel 2020-04-24 23:50:20 +02:00 коммит произвёл Vinod Koul
Родитель 7edfe3df2a
Коммит c0fca73609
1 изменённых файлов: 5 добавлений и 0 удалений

Просмотреть файл

@ -427,6 +427,11 @@ static struct dma_async_tx_descriptor *mmp_tdma_prep_dma_cyclic(
int num_periods = buf_len / period_len; int num_periods = buf_len / period_len;
int i = 0, buf = 0; 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) { if (tdmac->status != DMA_COMPLETE) {
dev_err(tdmac->dev, "controller busy"); dev_err(tdmac->dev, "controller busy");
return NULL; return NULL;