[PATCH 09/10] dmaengine: mcf-edma: fix wrong error handling

From: Angelo Dureghello

Date: Tue Dec 01 2026 - 17:40:40 EST


Fix wrong error handling on error interrupt.

Reported-by: Sashiko AI Review <sashiko-bot@xxxxxxxxxx>
Link: https://sashiko.dev/#/patchset/20260907134037.1855408-4-gerg@xxxxxxxxxxxxxx?part=1
Fixes: e7a3ff92eaf1 ("dmaengine: fsl-edma: add ColdFire mcf5441x edma support")
Signed-off-by: Angelo Dureghello <angelo@xxxxxxxxxxxxxxxx>
---
drivers/dma/mcf-edma-main.c | 23 +++++++----------------
1 file changed, 7 insertions(+), 16 deletions(-)

diff --git a/drivers/dma/mcf-edma-main.c b/drivers/dma/mcf-edma-main.c
index 281919f59612..60940c891409 100644
--- a/drivers/dma/mcf-edma-main.c
+++ b/drivers/dma/mcf-edma-main.c
@@ -42,29 +42,20 @@ static irqreturn_t mcf_edma_err_handler(int irq, void *dev_id)
{
struct fsl_edma_engine *mcf_edma = dev_id;
struct edma_regs *regs = &mcf_edma->regs;
- unsigned int err, ch;
-
- err = ioread32be(regs->errl);
- if (!err)
- return IRQ_NONE;
-
- for (ch = 0; ch < (EDMA_CHANNELS / 2); ch++) {
- if (err & BIT(ch)) {
- fsl_edma_disable_request(&mcf_edma->chans[ch]);
- iowrite8(EDMA_CERR_CERR(ch), regs->cerr);
- fsl_edma_err_chan_handler(&mcf_edma->chans[ch]);
- }
- }
+ unsigned int ch;
+ u64 err;

err = ioread32be(regs->errh);
+ err <<= 32;
+ err |= ioread32be(regs->errl);
if (!err)
return IRQ_NONE;

- for (ch = (EDMA_CHANNELS / 2); ch < EDMA_CHANNELS; ch++) {
- if (err & (BIT(ch - (EDMA_CHANNELS / 2)))) {
+ for (ch = 0; ch < EDMA_CHANNELS; ch++) {
+ if (err & BIT_U64(ch)) {
fsl_edma_disable_request(&mcf_edma->chans[ch]);
iowrite8(EDMA_CERR_CERR(ch), regs->cerr);
- mcf_edma->chans[ch].status = DMA_ERROR;
+ fsl_edma_err_chan_handler(&mcf_edma->chans[ch]);
}
}


--
2.56.1