Skip to contentSkip to conversation

mtd: rawnand: brcmnand: fix status read of brcmnand_waitfunc

PATCH Applied david regan 2 participants 2 messages Nov 26, 2024 – Dec 24, 2024

Subsystems (3)
lore
Share & tools
lore
#0 lore raw

PATCH 1/1 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 f504551b7f15 ("mtd: rawnand: Propagate error and simplify ternary operators for brcmstb_nand_wait_for_completion()")
---
 drivers/mtd/nand/raw/brcmnand/brcmnand.c | 5 +++++
 1 file changed, 5 insertions(+)
drivers/mtd/nand/raw/brcmnand/brcmnand.c +5 -0
index 482c6f093f99..701aa19328ad 100644
@@ -1893,6 +1893,11 @@ static int brcmnand_write(struct mtd_info *mtd, struct nand_chip *chip,
 		brcmnand_send_cmd(host, CMD_PROGRAM_PAGE);
 		status = brcmnand_waitfunc(chip);
 
+		if (status < 0) {
+			ret = status;
+			goto out;
+		}
+
 		if (status & NAND_STATUS_FAIL) {
 			dev_info(ctrl->dev, "program failed at %llx\n",
 				(unsigned long long)addr);
Signature · 1 line
2.37.3
maintainer Applied
#1 lore raw
Quoted 4 lines · david regan

This change fixes an issue where an error return value may be mistakenly used as NAND status.

Applied to nand/next, thanks!

[1/1] mtd: rawnand: brcmnand: fix status read of brcmnand_waitfunc

      commit: 03271ea36ea7a58d30a4bde182eb2a0d46220467

Patche(s) will be available within hours on:
mtd/linux.git

Kind regards,
Miquèl