/* Return: true if the block is bad, false otherwise.  */
bool nanddev_isbad(struct nand_device *nand, const struct nand_pos *pos)
/* Return: true if the block is bad, false otherwise.  */
bool nanddev_isbad(struct nand_device *nand, const struct nand_pos *pos)
{
	if (nanddev_bbt_is_initialized(nand)) {
		unsigned int entry;
		int status;
		entry = nanddev_bbt_pos_to_entry(nand, pos);
		status = nanddev_bbt_get_block_status(nand, entry);
		if (status == NAND_BBT_BLOCK_STATUS_UNKNOWN) {
			if (nand->ops->isbad(nand, pos))
				status = NAND_BBT_BLOCK_FACTORY_BAD;
			else
				status = NAND_BBT_BLOCK_GOOD;
			nanddev_bbt_set_block_status(nand, entry, status);
		}
		if (status == NAND_BBT_BLOCK_WORN ||
		    status == NAND_BBT_BLOCK_FACTORY_BAD)
			return true;
		return false;
	}
	return nand->ops->isbad(nand, pos);
}