Skip to contentSkip to conversation

MTD: nand: mxs_nand_spl: Fix empty function pointer for BBT

PATCH In review Adam Ford 4 participants 4 messages Dec 30, 2018 – Feb 2, 2019

Subsystems (3)
lore
Share & tools
lore

Adam Ford

author
#0 lore raw

PATCH 1/1 MTD: nand: mxs_nand_spl: Fix empty function pointer for BBT

The initialization function calls a nand_chip.scan_bbt(mtd) but scan_bbt is never initialized resulting in an undefined function pointer. This will direct the function pointer to nand_default_bbt defined in the same file.

drivers/mtd/nand/raw/mxs_nand_spl.c +1 -0
index 2d7bbe83cc..c628f3adec 100644
@@ -185,6 +185,7 @@ static int mxs_nand_init(void)
 	mtd = nand_to_mtd(&nand_chip);
 	/* set mtd functions */
 	nand_chip.cmdfunc = mxs_nand_command;
+	nand_chip.scan_bbt = nand_default_bbt;
 	nand_chip.numchips = 1;
 
 	/* identify flash device */
Signature · 1 line
2.17.1
#1 lore raw

PATCH 1/1 MTD: nand: mxs_nand_spl: Fix empty function pointer for BBT

Quoted 6 lines · Adam Ford

The initialization function calls a nand_chip.scan_bbt(mtd) but scan_bbt is never initialized resulting in an undefined function pointer. This will direct the function pointer to nand_default_bbt defined in the same file.

Seems sensible

Quoted 13 lines
drivers/mtd/nand/raw/mxs_nand_spl.c +1 -0
index 2d7bbe83cc..c628f3adec 100644
@@ -185,6 +185,7 @@ static int mxs_nand_init(void)
 	mtd = nand_to_mtd(&nand_chip);
 	/* set mtd functions */
 	nand_chip.cmdfunc = mxs_nand_command;
+	nand_chip.scan_bbt = nand_default_bbt;
 	nand_chip.numchips = 1;
 
 	/* identify flash device */
#2 lore raw

PATCH 1/1 MTD: nand: mxs_nand_spl: Fix empty function pointer for BBT

Quoted 11 lines · Stefan Agner
Quoted 6 lines · Adam Ford

The initialization function calls a nand_chip.scan_bbt(mtd) but scan_bbt is never initialized resulting in an undefined function pointer. This will direct the function pointer to nand_default_bbt defined in the same file.

Seems sensible

Fixes crashing NAND SPL loader on my i.MX6ULL board, which was introduced in commit 5346c31e305a37d39f535cc0d5ae87d8b7e81230 and is present in U-Boot since version 2018.07.

Tested on a custom i.MX6ULL board with a Micron NAND flash.

Quoted 13 lines
Quoted 13 lines
drivers/mtd/nand/raw/mxs_nand_spl.c +1 -0
index 2d7bbe83cc..c628f3adec 100644
@@ -185,6 +185,7 @@ static int mxs_nand_init(void)
 	mtd = nand_to_mtd(&nand_chip);
 	/* set mtd functions */
 	nand_chip.cmdfunc = mxs_nand_command;
+	nand_chip.scan_bbt = nand_default_bbt;
 	nand_chip.numchips = 1;
 
 	/* identify flash device */
#3 lore raw
In reply to Adam Ford
Quoted 11 lines

The initialization function calls a nand_chip.scan_bbt(mtd) but scan_bbt is never initialized resulting in an undefined function pointer. This will direct the function pointer to nand_default_bbt defined in the same file.

drivers/mtd/nand/raw/mxs_nand_spl.c +0 -0
index 2d7bbe83cc..c628f3adec 100644

drivers/mtd/nand/raw/mxs_nand_spl.c static int mxs_nand_init(void) · line 191

Quoted 7 lines
drivers/mtd/nand/raw/mxs_nand_spl.c +1 -0
@@ -185,6 +185,7 @@ static int mxs_nand_init(void)
 	mtd = nand_to_mtd(&nand_chip);
 	/* set mtd functions */
 	nand_chip.cmdfunc = mxs_nand_command;
+	nand_chip.scan_bbt = nand_default_bbt;
 	nand_chip.numchips = 1;
 
 	/* identify flash device */

Applied to u-boot-imx, master, thanks !

Best regards,
Stefano Babic

Signature · 5 lines
=====================================================================
DENX Software Engineering GmbH,      Managing Director: Wolfgang Denk
HRB 165235 Munich, Office: Kirchenstr.5, D-82194 Groebenzell, Germany
Phone: +49-8142-66989-53 Fax: +49-8142-66989-80 Email: sbabic at denx.de
=====================================================================