Skip to contentSkip to conversation

mtd: spinand: set request type explicitly in spinand_{is,mark}bad() functions

PATCH Applied Gabor Juhos 2 participants 3 messages Nov 19 – Nov 20

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

PATCH v2 1/1 mtd: spinand: set request type explicitly in spinand_{is,mark}bad() functions

Commit 701981cab016 ("mtd: nand: Add a NAND page I/O request type") added a 'type' member to the 'nand_page_io_req' structure and updated the request iterators to utilize that, but the spinand_{is,mark}bad() functions were not updated by the commit. However in both of these functions the new member is implicitly inititalized to zero which corresponds to NAND_PAGE_READ. This is correct for the spinand_isbad() function since that uses a read request to get the bad block marker bytes, but the spinand_markbad() function does a write request so it should set the request type to NAND_PAGE_WRITE.

Change the spinand_markbad() function to set the request type to the correct NAND_PAGE_WRITE value. For consistency, also update the spinand_isbad() function to set the request type to NAND_PAGE_READ explicitly.

Fixes 701981cab016 ("mtd: nand: Add a NAND page I/O request type")
Link https://sashiko.dev/#/log/192383 # See "**Investigating `req->type` in NAND Write Operations**"

---
Changes in v2:
- add stable tag

---
 drivers/mtd/nand/spi/core.c | 2 ++
 1 file changed, 2 insertions(+)
drivers/mtd/nand/spi/core.c +2 -0
index 18bba02fbd31..35bcb4a8861b 100644
@@ -1105,6 +1105,7 @@ static bool spinand_isbad(struct nand_device *nand, const struct nand_pos *pos)
 	struct spinand_device *spinand = nand_to_spinand(nand);
 	u8 marker[2] = { };
 	struct nand_page_io_req req = {
+		.type = NAND_PAGE_READ,
 		.pos = *pos,
 		.ooblen = sizeof(marker),
 		.ooboffs = 0,
@@ -1148,6 +1149,7 @@ static int spinand_markbad(struct nand_device *nand, const struct nand_pos *pos)
 	struct spinand_device *spinand = nand_to_spinand(nand);
 	u8 marker[2] = { };
 	struct nand_page_io_req req = {
+		.type = NAND_PAGE_WRITE,
 		.pos = *pos,
 		.ooboffs = 0,
 		.ooblen = sizeof(marker),

---
base-commit: 760d2efe91a84363d25c1051a10572242e75fe86
change-id: 20261117-spinand-set-req-type-in-bbm-functions-34775e6c14e0

Best regards,

Signature · 1 line
Gabor Juhos <[email protected]>
maintainer Applied
#1 lore raw
Quoted 11 lines · Gabor Juhos

Commit 701981cab016 ("mtd: nand: Add a NAND page I/O request type") added a 'type' member to the 'nand_page_io_req' structure and updated the request iterators to utilize that, but the spinand_{is,mark}bad() functions were not updated by the commit. However in both of these functions the new member is implicitly inititalized to zero which corresponds to NAND_PAGE_READ. This is correct for the spinand_isbad() function since that uses a read request to get the bad block marker bytes, but the spinand_markbad() function does a write request so it should set the request type to NAND_PAGE_WRITE.

[...]

Applied to nand/next, thanks!

[1/1] mtd: spinand: set request type explicitly in spinand_{is,mark}bad() functions

      commit: eb0ee7a30f3d33c49b8f60b707dd27cb046cdebf

Patche(s) should be available on mtd/linux.git and will be part of the next PR (provided that no robot complains by then).

Kind regards,
Miquèl

maintainer Applied
#2 lore raw
In reply to Gabor Juhos
Quoted 11 lines · Gabor Juhos

Commit 701981cab016 ("mtd: nand: Add a NAND page I/O request type") added a 'type' member to the 'nand_page_io_req' structure and updated the request iterators to utilize that, but the spinand_{is,mark}bad() functions were not updated by the commit. However in both of these functions the new member is implicitly inititalized to zero which corresponds to NAND_PAGE_READ. This is correct for the spinand_isbad() function since that uses a read request to get the bad block marker bytes, but the spinand_markbad() function does a write request so it should set the request type to NAND_PAGE_WRITE.

[...]

Applied to mtd/fixes, thanks!

[1/1] mtd: spinand: set request type explicitly in spinand_{is,mark}bad() functions

      commit: 7ab84dc9c3d91c7cd72abb96ec4e253e44560f95

Patche(s) should be available on mtd/linux.git and will be part of the next PR (provided that no robot complains by then).

Kind regards,
Miquèl