[PATCH v2 02/17] mtd: spi-nor: swp: Fix SR2 initialization
From: Miquel Raynal
Date: Sun Oct 04 2026 - 17:32:25 EST
The purpose of the original change was to make sure the SR2 buffer was
returned initialized. One of the goals being to be able to compare
it. While iterating over the implementation of this function, I believe
the return -EINVAL that was initially there has been turned into a
return 0, which does not completely make sense since we already return 0
just below.
Just make sure SR2 is correctly initialized when returning from this
helper.
Fixes: 63489002d397 ("mtd: spi-nor: Refactor Read Status/Write Status support")
Signed-off-by: Miquel Raynal <miquel.raynal@xxxxxxxxxxx>
---
drivers/mtd/spi-nor/swp.c | 2 +-
1 file changed, 1 insertion(+), 1 deletion(-)
diff --git a/drivers/mtd/spi-nor/swp.c b/drivers/mtd/spi-nor/swp.c
index 7e667e4ca84d..6c56fda3913e 100644
--- a/drivers/mtd/spi-nor/swp.c
+++ b/drivers/mtd/spi-nor/swp.c
@@ -223,7 +223,7 @@ static int spi_nor_read_sr2_careful(struct spi_nor *nor, u8 *sr2)
*/
*sr2 = params->qe_mask[1];
} else {
- return 0;
+ *sr2 = 0;
}
return 0;
--
2.55.0