From: Ben Dooks <ben.dooks@sifive.com>
To: dmaengine@vger.kernel.org, Eugeniy.Paltsev@synopsys.com
Cc: linux-kernel@vger.kernel.org, vkoul@kernel.org,
Sudip Mukherjee <sudip.mukherjee@sifive.com>,
Jude Onyenegecha <jude.onyenegecha@sifive.com>,
Ben Dooks <ben.dooks@sifive.com>
Subject: [PATCH 3/3] dmaengine: dw-axi-dmac: ignore interrupt if no descriptor
Date: Fri, 8 Jul 2022 18:01:53 +0100 [thread overview]
Message-ID: <20220708170153.269991-4-ben.dooks@sifive.com> (raw)
In-Reply-To: <20220708170153.269991-1-ben.dooks@sifive.com>
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>
---
drivers/dma/dw-axi-dmac/dw-axi-dmac-platform.c | 6 ++++++
1 file changed, 6 insertions(+)
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 d6ef5f49f281..1fedf4376678 100644
--- a/drivers/dma/dw-axi-dmac/dw-axi-dmac-platform.c
+++ b/drivers/dma/dw-axi-dmac/dw-axi-dmac-platform.c
@@ -1082,6 +1082,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);
@@ -1111,6 +1116,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);
}
--
2.35.1
next prev parent reply other threads:[~2022-07-08 17:02 UTC|newest]
Thread overview: 8+ messages / expand[flat|nested] mbox.gz Atom feed top
2022-07-08 17:01 dw-axi-dmac updates (debug, minor bugfixes) Ben Dooks
2022-07-08 17:01 ` [PATCH 1/3] dmaengine: dw-axi-dmac: dump channel registers on error Ben Dooks
2022-07-21 12:30 ` Vinod Koul
2022-07-21 22:16 ` Ben Dooks
2022-07-08 17:01 ` [PATCH 2/3] dmaengine: dw-axi-dmac: do not print NULL LLI during error Ben Dooks
2022-07-21 12:33 ` Vinod Koul
2022-07-08 17:01 ` Ben Dooks [this message]
2022-07-21 12:33 ` [PATCH 3/3] dmaengine: dw-axi-dmac: ignore interrupt if no descriptor Vinod Koul
Reply instructions:
You may reply publicly to this message via plain-text email
using any one of the following methods:
* Save the following mbox file, import it into your mail client,
and reply-to-all from there: mbox
Avoid top-posting and favor interleaved quoting:
https://en.wikipedia.org/wiki/Posting_style#Interleaved_style
* Reply using the --to, --cc, and --in-reply-to
switches of git-send-email(1):
git send-email \
--in-reply-to=20220708170153.269991-4-ben.dooks@sifive.com \
--to=ben.dooks@sifive.com \
--cc=Eugeniy.Paltsev@synopsys.com \
--cc=dmaengine@vger.kernel.org \
--cc=jude.onyenegecha@sifive.com \
--cc=linux-kernel@vger.kernel.org \
--cc=sudip.mukherjee@sifive.com \
--cc=vkoul@kernel.org \
/path/to/YOUR_REPLY
https://kernel.org/pub/software/scm/git/docs/git-send-email.html
* If your mail client supports setting the In-Reply-To header
via mailto: links, try the mailto: link
Be sure your reply has a Subject: header at the top and a blank line
before the message body.
This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox