linux-mtd.lists.infradead.org archive mirror
 help / color / mirror / Atom feed
* [PATCH] mtd: spinand: micron: fix division by zero
@ 2024-12-28 15:41 Micha Ober
  2024-12-30  8:58 ` Miquel Raynal
  0 siblings, 1 reply; 2+ messages in thread
From: Micha Ober @ 2024-12-28 15:41 UTC (permalink / raw)
  To: linux-mtd; +Cc: miquel.raynal, richard, vigneshr

The `ecc_step_size` field ist not set at this point
in the call tree, leading to a division by zero.

Read the step size from the mtd device ecc config instead.

Signed-off-by: Micha Ober <git@ober-mail.de>
---
 drivers/mtd/nand/spi/micron.c | 3 ++-
 1 file changed, 2 insertions(+), 1 deletion(-)

diff --git a/drivers/mtd/nand/spi/micron.c b/drivers/mtd/nand/spi/micron.c
index 12601bc4227a..7973996519d3 100644
--- a/drivers/mtd/nand/spi/micron.c
+++ b/drivers/mtd/nand/spi/micron.c
@@ -106,9 +106,10 @@ static int micron_4_ooblayout_free(struct mtd_info *mtd, int section,
 				   struct mtd_oob_region *region)
 {
 	struct spinand_device *spinand = mtd_to_spinand(mtd);
+	struct nand_device *nand = mtd_to_nanddev(mtd);
 
 	if (section >= spinand->base.memorg.pagesize /
-			mtd->ecc_step_size)
+			nanddev_get_ecc_conf(nand)->step_size)
 		return -ERANGE;
 
 	if (section) {
-- 
2.39.5 (Apple Git-154)


______________________________________________________
Linux MTD discussion mailing list
http://lists.infradead.org/mailman/listinfo/linux-mtd/

^ permalink raw reply related	[flat|nested] 2+ messages in thread

end of thread, other threads:[~2024-12-30  8:58 UTC | newest]

Thread overview: 2+ messages (download: mbox.gz follow: Atom feed
-- links below jump to the message on this page --
2024-12-28 15:41 [PATCH] mtd: spinand: micron: fix division by zero Micha Ober
2024-12-30  8:58 ` Miquel Raynal

This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox;
as well as URLs for NNTP newsgroup(s).