From: Lothar Waßmann Date: Tue, 29 Aug 2017 10:17:13 +0000 (+0200) Subject: mtd: nand: complain loudly when chip->bits_per_cell is not correctly initialized X-Git-Url: https://git.stricted.de/?a=commitdiff_plain;h=2d2a2b8c080ad8feab7ca87769dedb3c7a83a375;p=GitHub%2Fmoto-9609%2Fandroid_kernel_motorola_exynos9610.git 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 Signed-off-by: Boris Brezillon --- 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, */ 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; }