From c03395df9c3825feec9e4ad5179df891166d69cf Mon Sep 17 00:00:00 2001 From: Huibin Hong Date: Mon, 29 Jan 2018 10:02:35 +0800 Subject: [PATCH] dmaengine: pl330: fix bug that chan descdone is null The pl330 irq may come after terminal chan, and desc is set null. It can't be avoided by disabling irq, because other chans use the common irq. If the chan is terminaled, we needn't call its callback or restart it. Change-Id: I73201eaa4dbdd09c765129f9f3f41573c73faf73 Signed-off-by: Huibin Hong --- drivers/dma/pl330.c | 17 +++++++++-------- 1 file changed, 9 insertions(+), 8 deletions(-) diff --git a/drivers/dma/pl330.c b/drivers/dma/pl330.c index dfca623f42fd..08a8cd22b2e1 100644 --- a/drivers/dma/pl330.c +++ b/drivers/dma/pl330.c @@ -1787,16 +1787,17 @@ static int pl330_update(struct pl330_dmac *pl330) /* Detach the req */ descdone = thrd->req[active].desc; + if (descdone) { + if (!descdone->cyclic) { + thrd->req[active].desc = NULL; + thrd->req_running = -1; + /* Get going again ASAP */ + _start(thrd); + } - if (!descdone->cyclic) { - thrd->req[active].desc = NULL; - thrd->req_running = -1; - /* Get going again ASAP */ - _start(thrd); + /* For now, just make a list of callbacks to be done */ + list_add_tail(&descdone->rqd, &pl330->req_done); } - - /* For now, just make a list of callbacks to be done */ - list_add_tail(&descdone->rqd, &pl330->req_done); } }