/* The value to return to flash_page_foreach() is stored in "bail_value" if the callback should exit early.  */
static bool should_bail(const struct flash_pages_info *info, struct layout_data *data, bool *bail_value)
/* The value to return to flash_page_foreach() is stored in "bail_value" if the callback should exit early.  */
static bool should_bail(const struct flash_pages_info *info, struct layout_data *data, bool *bail_value)
{
	if (info->start_offset < data->area_off) {
		*bail_value = true;
		return true;
	} else if (info->start_offset >= data->area_off + data->area_len) {
		*bail_value = false;
		return true;
	} else if (data->ret_idx >= data->ret_len) {
		data->status = -ENOMEM;
		*bail_value = false;
		return true;
	}
	return false;
}