Skip to content

Commit 2d2a2b8

Browse files
lw-karoBoris Brezillon
authored andcommitted
mtd: nand: complain loudly when chip->bits_per_cell is not correctly initialized
chip->bits_per_cell which is used to determine the NAND cell type (SLC/MLC) should always have a value != 0. Complain loudly if the value is 0 in nand_is_slc() to catch use before correct initialization. Signed-off-by: Lothar Waßmann <LW@KARO-electronics.de> Signed-off-by: Boris Brezillon <boris.brezillon@free-electrons.com>
1 parent 69fc012 commit 2d2a2b8

1 file changed

Lines changed: 2 additions & 0 deletions

File tree

‎include/linux/mtd/rawnand.h‎

Lines changed: 2 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -1234,6 +1234,8 @@ int onfi_init_data_interface(struct nand_chip *chip,
12341234
*/
12351235
static inline bool nand_is_slc(struct nand_chip *chip)
12361236
{
1237+
WARN(chip->bits_per_cell == 0,
1238+
"chip->bits_per_cell is used uninitialized\n");
12371239
return chip->bits_per_cell == 1;
12381240
}
12391241

0 commit comments

Comments
 (0)