aboutsummaryrefslogtreecommitdiffstats
path: root/include/linux/mtd
diff options
context:
space:
mode:
authorLothar Waßmann <LW@KARO-electronics.de>2017-08-29 06:17:13 -0400
committerBoris Brezillon <boris.brezillon@free-electrons.com>2017-08-29 12:23:50 -0400
commit2d2a2b8c080ad8feab7ca87769dedb3c7a83a375 (patch)
treebf1eee410798935e7318f878f12be25f4696a729 /include/linux/mtd
parent69fc01296c92814b62dbfba1600fe7ed2ed304f5 (diff)
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>
Diffstat (limited to 'include/linux/mtd')
-rw-r--r--include/linux/mtd/rawnand.h2
1 files changed, 2 insertions, 0 deletions
diff --git a/include/linux/mtd/rawnand.h b/include/linux/mtd/rawnand.h
index 8fb488d586d6..c433f093766a 100644
--- a/include/linux/mtd/rawnand.h
+++ b/include/linux/mtd/rawnand.h
@@ -1234,6 +1234,8 @@ int onfi_init_data_interface(struct nand_chip *chip,
1234 */ 1234 */
1235static inline bool nand_is_slc(struct nand_chip *chip) 1235static inline bool nand_is_slc(struct nand_chip *chip)
1236{ 1236{
1237 WARN(chip->bits_per_cell == 0,
1238 "chip->bits_per_cell is used uninitialized\n");
1237 return chip->bits_per_cell == 1; 1239 return chip->bits_per_cell == 1;
1238} 1240}
1239 1241