/* This function returns zero if the physical eraseblock is good, %-EINVAL if it is bad and a negative error code if an error occurred.  */
static int self_check_not_bad(const struct ubi_device *ubi, int pnum)
/* This function returns zero if the physical eraseblock is good, %-EINVAL if it is bad and a negative error code if an error occurred.  */
static int self_check_not_bad(const struct ubi_device *ubi, int pnum)
{
	int err;
	if (!ubi_dbg_chk_io(ubi))
		return 0;
	err = ubi_io_is_bad(ubi, pnum);
	if (!err)
		return err;
	ubi_err(ubi, "self-check failed for PEB %d", pnum);
	dump_stack();
	return err > 0 ? -EINVAL : err;
}