---
name: "nand_check_erased_buf"
section: "9"
platform: "linux"
package: "linux-manual-4.9"
version: "4.9.228-1"
release: "Debian 9 (Stretch)"
platforms: ["linux"]
url: "https://new.carta.tech/nand_check_erased_buf"
---

# nand\_check\_erased\_buf(9)

check if a buffer contains (almost) only 0xff data

## NAME

nand\_check\_erased\_buf - check if a buffer contains (almost) only 0xff data

## SYNOPSIS

**int nand\_check\_erased\_buf(void \*** *buf***, int** *len***, int** *bitflips\_threshold***);**

## ARGUMENTS

*buf*

buffer to test

*len*

buffer length

*bitflips\_threshold*

maximum number of bitflips

## DESCRIPTION

Check if a buffer contains only 0xff, which means the underlying region has been erased and is ready to be programmed. The bitflips\_threshold specify the maximum number of bitflips before considering the region is not erased.

## NOTE

The logic of this function has been extracted from the memweight implementation, except that nand\_check\_erased\_buf function exit before testing the whole buffer if the number of bitflips exceed the bitflips\_threshold value.

Returns a positive number of bitflips less than or equal to bitflips\_threshold, or -ERROR\_CODE for bitflips in excess of the threshold.

## AUTHOR

**Thomas Gleixner** \<tglx@linutronix.de\>

Author.

## COPYRIGHT
