diff options
author | Ben Dooks <ben.dooks@sifive.com> | 2022-07-08 20:01:53 +0300 |
---|---|---|
committer | Greg Kroah-Hartman <gregkh@linuxfoundation.org> | 2022-08-25 12:45:45 +0300 |
commit | 3d05aeebbde8c69593d8aa512b7c08b8f0ad25ba (patch) | |
tree | d41e6c4cd8289e1a60091b2b7ba1e48b1cde5cd6 | |
parent | ad764df73ae5eada265fffc0408404703cbb2b8d (diff) | |
download | linux-3d05aeebbde8c69593d8aa512b7c08b8f0ad25ba.tar.xz |
dmaengine: dw-axi-dmac: ignore interrupt if no descriptor
[ Upstream commit 820f5ce999d2f99961e88c16d65cd26764df0590 ]
If the channel has no descriptor and the interrupt is raised then the
kernel will OOPS. Check the result of vchan_next_desc() in the handler
axi_chan_block_xfer_complete() to avoid the error happening.
Signed-off-by: Ben Dooks <ben.dooks@sifive.com>
Link: https://lore.kernel.org/r/20220708170153.269991-4-ben.dooks@sifive.com
Signed-off-by: Vinod Koul <vkoul@kernel.org>
Signed-off-by: Sasha Levin <sashal@kernel.org>
-rw-r--r-- | drivers/dma/dw-axi-dmac/dw-axi-dmac-platform.c | 6 |
1 files changed, 6 insertions, 0 deletions
diff --git a/drivers/dma/dw-axi-dmac/dw-axi-dmac-platform.c b/drivers/dma/dw-axi-dmac/dw-axi-dmac-platform.c index 41583f01a360..a183d93bd7e2 100644 --- a/drivers/dma/dw-axi-dmac/dw-axi-dmac-platform.c +++ b/drivers/dma/dw-axi-dmac/dw-axi-dmac-platform.c @@ -1054,6 +1054,11 @@ static void axi_chan_block_xfer_complete(struct axi_dma_chan *chan) /* The completed descriptor currently is in the head of vc list */ vd = vchan_next_desc(&chan->vc); + if (!vd) { + dev_err(chan2dev(chan), "BUG: %s, IRQ with no descriptors\n", + axi_chan_name(chan)); + goto out; + } if (chan->cyclic) { desc = vd_to_axi_desc(vd); @@ -1083,6 +1088,7 @@ static void axi_chan_block_xfer_complete(struct axi_dma_chan *chan) axi_chan_start_first_queued(chan); } +out: spin_unlock_irqrestore(&chan->vc.lock, flags); } |