]> git.ipfire.org Git - thirdparty/kernel/stable.git/commitdiff
mtd: spinand: propagate spinand_wait() errors from spinand_write_page()
authorGabor Juhos <j4g8y7@gmail.com>
Tue, 8 Jul 2025 13:11:00 +0000 (15:11 +0200)
committerGreg Kroah-Hartman <gregkh@linuxfoundation.org>
Thu, 28 Aug 2025 14:26:07 +0000 (16:26 +0200)
commit 091d9e35b85b0f8f7e1c73535299f91364a5c73a upstream.

Since commit 3d1f08b032dc ("mtd: spinand: Use the external ECC engine
logic") the spinand_write_page() function ignores the errors returned
by spinand_wait(). Change the code to propagate those up to the stack
as it was done before the offending change.

Cc: stable@vger.kernel.org
Fixes: 3d1f08b032dc ("mtd: spinand: Use the external ECC engine logic")
Signed-off-by: Gabor Juhos <j4g8y7@gmail.com>
Signed-off-by: Miquel Raynal <miquel.raynal@bootlin.com>
Signed-off-by: Greg Kroah-Hartman <gregkh@linuxfoundation.org>
drivers/mtd/nand/spi/core.c

index 80e9646d2050377d65536f51ac82b66e6b772ade..1ae5364c0c7c4f1a3c9a96c3a847c1f63c56cca2 100644 (file)
@@ -624,7 +624,10 @@ static int spinand_write_page(struct spinand_device *spinand,
                           SPINAND_WRITE_INITIAL_DELAY_US,
                           SPINAND_WRITE_POLL_DELAY_US,
                           &status);
-       if (!ret && (status & STATUS_PROG_FAILED))
+       if (ret)
+               return ret;
+
+       if (status & STATUS_PROG_FAILED)
                return -EIO;
 
        return nand_ecc_finish_io_req(nand, (struct nand_page_io_req *)req);