Skip to content

Commit 33d2892

Browse files
kamaldasu-cryptogregkh
authored andcommitted
mtd: rawnand: brcmnand: skip DMA during panic write
[ Upstream commit da9ba4d ] When oops_panic_write is set, the driver disables interrupts and switches to PIO polling mode but still falls through into the DMA path. DMA cannot be used reliably in panic context, so make the DMA path an else branch to ensure only PIO is used during panic writes. Fixes: c1ac2dc ("mtd: rawnand: brcmnand: When oops in progress use pio and interrupt polling") Signed-off-by: Kamal Dasu <kamal.dasu@broadcom.com> Reviewed-by: William Zhang <william.zhang@broadcom.com> Reviewed-by: Florian Fainelli <florian.fainelli@broadcom.com> Signed-off-by: Miquel Raynal <miquel.raynal@bootlin.com> Signed-off-by: Sasha Levin <sashal@kernel.org>
1 parent f71ce0a commit 33d2892

1 file changed

Lines changed: 2 additions & 4 deletions

File tree

drivers/mtd/nand/raw/brcmnand/brcmnand.c

Lines changed: 2 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -2303,14 +2303,12 @@ static int brcmnand_write(struct mtd_info *mtd, struct nand_chip *chip,
23032303
for (i = 0; i < ctrl->max_oob; i += 4)
23042304
oob_reg_write(ctrl, i, 0xffffffff);
23052305

2306-
if (mtd->oops_panic_write)
2306+
if (mtd->oops_panic_write) {
23072307
/* switch to interrupt polling and PIO mode */
23082308
disable_ctrl_irqs(ctrl);
2309-
2310-
if (use_dma(ctrl) && (has_edu(ctrl) || !oob) && flash_dma_buf_ok(buf)) {
2309+
} else if (use_dma(ctrl) && (has_edu(ctrl) || !oob) && flash_dma_buf_ok(buf)) {
23112310
if (ctrl->dma_trans(host, addr, (u32 *)buf, oob, mtd->writesize,
23122311
CMD_PROGRAM_PAGE))
2313-
23142312
ret = -EIO;
23152313

23162314
goto out;

0 commit comments

Comments
 (0)