* [PATCH v2] dmaengine: mmp_tdma: Validate the transfer direction
@ 2020-04-24 21:50 Lubomir Rintel
2020-04-27 16:03 ` Vinod Koul
0 siblings, 1 reply; 2+ messages in thread
From: Lubomir Rintel @ 2020-04-24 21:50 UTC (permalink / raw)
To: Vinod Koul; +Cc: linux-kernel, Lubomir Rintel
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>
---
Changes since v1:
- Replace the extra validation with is_slave_direction() in
_prep_dma_cyclic(), as Vinod Koul suggested.
drivers/dma/mmp_tdma.c | 5 +++++
1 file changed, 5 insertions(+)
diff --git a/drivers/dma/mmp_tdma.c b/drivers/dma/mmp_tdma.c
index 8947e4832ca3..dbc6a48424fa 100644
--- a/drivers/dma/mmp_tdma.c
+++ b/drivers/dma/mmp_tdma.c
@@ -429,6 +429,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;
--
2.26.0
^ permalink raw reply [flat|nested] 2+ messages in thread
* Re: [PATCH v2] dmaengine: mmp_tdma: Validate the transfer direction
2020-04-24 21:50 [PATCH v2] dmaengine: mmp_tdma: Validate the transfer direction Lubomir Rintel
@ 2020-04-27 16:03 ` Vinod Koul
0 siblings, 0 replies; 2+ messages in thread
From: Vinod Koul @ 2020-04-27 16:03 UTC (permalink / raw)
To: Lubomir Rintel; +Cc: linux-kernel
On 24-04-20, 23:50, Lubomir Rintel wrote:
> We only support DMA_DEV_TO_MEM and DMA_MEM_TO_DEV. Let's not do
> undefined things with other values and reject them.
Applied, thanks
--
~Vinod
^ permalink raw reply [flat|nested] 2+ messages in thread
end of thread, other threads:[~2020-04-27 16:03 UTC | newest]
Thread overview: 2+ messages (download: mbox.gz / follow: Atom feed)
-- links below jump to the message on this page --
2020-04-24 21:50 [PATCH v2] dmaengine: mmp_tdma: Validate the transfer direction Lubomir Rintel
2020-04-27 16:03 ` Vinod Koul
This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox
all inboxes | Powered by JetHome®