Skip to content

Commit 03271ea

Browse files
david reganmiquelraynal
authored andcommitted
mtd: rawnand: brcmnand: fix status read of brcmnand_waitfunc
This change fixes an issue where an error return value may be mistakenly used as NAND status. Fixes: f504551 ("mtd: rawnand: Propagate error and simplify ternary operators for brcmstb_nand_wait_for_completion()") Signed-off-by: david regan <[email protected]> Reviewed-by: William Zhang <[email protected]> Signed-off-by: Miquel Raynal <[email protected]>
1 parent 1a50e36 commit 03271ea

File tree

1 file changed

+5
-0
lines changed

1 file changed

+5
-0
lines changed

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

Lines changed: 5 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -2342,6 +2342,11 @@ static int brcmnand_write(struct mtd_info *mtd, struct nand_chip *chip,
23422342
brcmnand_send_cmd(host, CMD_PROGRAM_PAGE);
23432343
status = brcmnand_waitfunc(chip);
23442344

2345+
if (status < 0) {
2346+
ret = status;
2347+
goto out;
2348+
}
2349+
23452350
if (status & NAND_STATUS_FAIL) {
23462351
dev_info(ctrl->dev, "program failed at %llx\n",
23472352
(unsigned long long)addr);

0 commit comments

Comments
 (0)