/* Description: Returns ptes on success, NULL on error. Allocates space for PTEs based on information found in @gpt. Notes: remember to free pte when you're done!  */
static gpt_entry* alloc_read_gpt_entries(struct block_device *bdev, gpt_header *gpt)
/* Description: Returns ptes on success, NULL on error. Allocates space for PTEs based on information found in @gpt. Notes: remember to free pte when you're done!  */
static gpt_entry* alloc_read_gpt_entries(struct block_device *bdev, gpt_header *gpt)
{
	size_t count;
	gpt_entry *pte;
	if (!bdev || !gpt)
		return NULL;
	count = le32_to_cpu(gpt->num_partition_entries) *
                le32_to_cpu(gpt->sizeof_partition_entry);
	if (!count)
		return NULL;
	pte = kzalloc(count, GFP_KERNEL);
	if (!pte)
		return NULL;
	if (read_lba(bdev, le64_to_cpu(gpt->partition_entry_lba),
                     (u8 *) pte,
		     count) < count) {
		kfree(pte);
                pte=NULL;
		return NULL;
	}
	return pte;
}