target/linux/generic/files/drivers/mtd/nand/mtk_bmt_nmbm.c
static void nmbm_erase_range(struct nmbm_instance *ni, uint32_t ba,
			     uint32_t limit)
{
	bool success;

	while (ba < limit) {
		if (nmbm_get_block_state(ni, ba) != BLOCK_ST_GOOD)
			goto next_block;

		/* Insurance to detect unexpected bad block marked by user */
		if (nmbm_check_bad_phys_block(ni, ba)) {
			nmbm_set_block_state(ni, ba, BLOCK_ST_BAD);
			goto next_block;
		}

		success = nmbm_erase_block_and_check(ni, ba);
		if (success)
			goto next_block;

		nmbm_mark_phys_bad_block(ni, ba);
		nmbm_set_block_state(ni, ba, BLOCK_ST_BAD);

	next_block:
		ba++;
	}
}
/*
 * nmbm_erase_range - Erase a range of blocks
 * @ni: NMBM instance structure
 * @ba: block address where the erasure will start
 * @limit: top block address allowed for erasure
 *
 * Erase blocks within the specific range. Newly-found bad blocks will be
 * marked.
 *
 * @limit is not counted into the allowed erasure address.
 */
Erase a range of blocks
@ni: NMBM instance structure
@ba: block address where the erasure will start
@limit: top block address allowed for erasure

Erase blocks within the specific range. Newly-found bad blocks will be
marked.

@limit is not counted into the allowed erasure address.
Erase a range of blocks @ni : NMBM instance structure @ba : block address where the erasure will start @limit : top block address allowed for erasure Erase blocks within the specific range . Newly - found bad blocks will be marked . @limit is not counted into the allowed erasure address .
static void nmbm_erase_range(struct nmbm_instance *ni, uint32_t ba,
			     uint32_t limit)
{
	bool success;
	while (ba < limit) {
		if (nmbm_get_block_state(ni, ba) != BLOCK_ST_GOOD)
			goto next_block;
		if (nmbm_check_bad_phys_block(ni, ba)) {
			nmbm_set_block_state(ni, ba, BLOCK_ST_BAD);
			goto next_block;
		}
		success = nmbm_erase_block_and_check(ni, ba);
		if (success)
			goto next_block;
		nmbm_mark_phys_bad_block(ni, ba);
		nmbm_set_block_state(ni, ba, BLOCK_ST_BAD);
	next_block:
		ba++;
	}
}
static void nmbm_erase_range ( struct nmbm_instance * ni , uint32_t ba , uint32_t limit ) { bool success ; while ( ba < limit ) { if ( nmbm_get_block_state ( ni , ba ) != BLOCK_ST_GOOD ) goto next_block ; if ( nmbm_check_bad_phys_block ( ni , ba ) ) { nmbm_set_block_state ( ni , ba , BLOCK_ST_BAD ) ; goto next_block ; } success = nmbm_erase_block_and_check ( ni , ba ) ; if ( success ) goto next_block ; nmbm_mark_phys_bad_block ( ni , ba ) ; nmbm_set_block_state ( ni , ba , BLOCK_ST_BAD ) ; next_block : ba ++ ; } }
nmbm_erase_range - Erase a range of blocks
 @ni: NMBM instance structure
 @ba: block address where the erasure will start
 @limit: top block address allowed for erasure
nmbm_erase_range - Erase a range of blocks @ni : NMBM instance structure @ba : block address where the erasure will start @limit : top block address allowed for erasure
/* Insurance to detect unexpected bad block marked by user */