In case of AND chips(NAND_IS_AND) (struct nand_chip *)chip->badblock_pattern stay uninitialized, see nand_default_bbt(). It seems badblock_pattern is used only in nand_scan_bbt(), but it's better to initialize badblock_pattern before calling nand_scan_bbt(), like it's done for other chips.