소스 검색

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>
Lothar Waßmann 8 년 전
부모
커밋
2d2a2b8c08
1개의 변경된 파일2개의 추가작업 그리고 0개의 파일을 삭제
  1. 2 0
      include/linux/mtd/rawnand.h

+ 2 - 0
include/linux/mtd/rawnand.h

@@ -1234,6 +1234,8 @@ int onfi_init_data_interface(struct nand_chip *chip,
  */
  */
 static inline bool nand_is_slc(struct nand_chip *chip)
 static inline bool nand_is_slc(struct nand_chip *chip)
 {
 {
+	WARN(chip->bits_per_cell == 0,
+	     "chip->bits_per_cell is used uninitialized\n");
 	return chip->bits_per_cell == 1;
 	return chip->bits_per_cell == 1;
 }
 }