[<prev] [next>] [day] [month] [year] [list]
Message-Id: <20241126023916.197635-1-dregan@broadcom.com>
Date: Mon, 25 Nov 2024 18:39:16 -0800
From: david regan <dregan@...adcom.com>
To: Brian Norris <computersforpeace@...il.com>,
Kamal Dasu <kdasu.kdev@...il.com>,
Boris Brezillon <bbrezillon@...nel.org>,
Miquel Raynal <miquel.raynal@...tlin.com>,
Richard Weinberger <richard@....at>,
David Woodhouse <dwmw2@...radead.org>,
Marek Vasut <marek.vasut@...il.com>,
linux-mtd@...ts.infradead.org,
bcm-kernel-feedback-list@...adcom.com,
linux-kernel@...r.kernel.org,
Ruan Jinjie <ruanjinjie@...wei.com>,
William Zhang <william.zhang@...adcom.com>,
dregan@...l.com,
dregan@...adcom.com
Subject: [PATCH] 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()")
Signed-off-by: david regan <dregan@...adcom.com>
Reviewed-by: William Zhang <william.zhang@...adcom.com>
---
drivers/mtd/nand/raw/brcmnand/brcmnand.c | 5 +++++
1 file changed, 5 insertions(+)
diff --git a/drivers/mtd/nand/raw/brcmnand/brcmnand.c b/drivers/mtd/nand/raw/brcmnand/brcmnand.c
index 482c6f093f99..701aa19328ad 100644
--- a/drivers/mtd/nand/raw/brcmnand/brcmnand.c
+++ b/drivers/mtd/nand/raw/brcmnand/brcmnand.c
@@ -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);
--
2.37.3
Powered by blists - more mailing lists