Skip to content
/ linux Public

Commit a9e119d

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 5fd5c07 commit a9e119d

File tree

1 file changed

+2
-4
lines changed

1 file changed

+2
-4
lines changed

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

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

2353-
if (mtd->oops_panic_write)
2353+
if (mtd->oops_panic_write) {
23542354
/* switch to interrupt polling and PIO mode */
23552355
disable_ctrl_irqs(ctrl);
2356-
2357-
if (use_dma(ctrl) && (has_edu(ctrl) || !oob) && flash_dma_buf_ok(buf)) {
2356+
} else if (use_dma(ctrl) && (has_edu(ctrl) || !oob) && flash_dma_buf_ok(buf)) {
23582357
if (ctrl->dma_trans(host, addr, (u32 *)buf, oob, mtd->writesize,
23592358
CMD_PROGRAM_PAGE))
2360-
23612359
ret = -EIO;
23622360

23632361
goto out;

0 commit comments

Comments
 (0)