]> git.karo-electronics.de Git - karo-tx-uboot.git/blobdiff - disk/part_efi.c
mmc: sdhci: fix mmc busy timeout handling
[karo-tx-uboot.git] / disk / part_efi.c
index 77bdfcbce5eafa694f15e67f1bda009597d579c7..8d67c09a43a22669af9e702114dc90f4a0d51fad 100644 (file)
@@ -184,10 +184,6 @@ void part_print_efi(struct blk_desc *dev_desc)
        char uuid[37];
        unsigned char *uuid_bin;
 
-       if (!dev_desc) {
-               printf("%s: Invalid Argument(s)\n", __func__);
-               return;
-       }
        /* This function validates AND fills in the GPT header and PTE */
        if (is_gpt_valid(dev_desc, GPT_PRIMARY_PARTITION_TABLE_LBA,
                         gpt_head, &gpt_pte) != 1) {
@@ -244,7 +240,7 @@ int part_get_info_efi(struct blk_desc *dev_desc, int part,
        gpt_entry *gpt_pte = NULL;
 
        /* "part" argument must be at least 1 */
-       if (!dev_desc || !info || part < 1) {
+       if (part < 1) {
                printf("%s: Invalid Argument(s)\n", __func__);
                return -1;
        }
@@ -443,7 +439,7 @@ int gpt_fill_pte(gpt_header *gpt_h, gpt_entry *gpt_e,
                        gpt_e[i].starting_lba = cpu_to_le64(offset);
                        offset += partitions[i].size;
                }
-               if (offset >= last_usable_lba) {
+               if (offset > (last_usable_lba + 1)) {
                        printf("Partitions layout exceds disk size\n");
                        return -1;
                }
@@ -659,6 +655,10 @@ int gpt_verify_partitions(struct blk_desc *dev_desc,
                      (unsigned long long)partitions[i].size);
 
                if (le64_to_cpu(gpt_part_size) != partitions[i].size) {
+                       /* We do not check the extend partition size */
+                       if ((i == parts - 1) && (partitions[i].size == 0))
+                               continue;
+
                        error("Partition %s size: %llu does not match %llu!\n",
                              efi_str, (unsigned long long)gpt_part_size,
                              (unsigned long long)partitions[i].size);
@@ -890,9 +890,10 @@ static gpt_entry *alloc_read_gpt_entries(struct blk_desc *dev_desc,
        count = le32_to_cpu(pgpt_head->num_partition_entries) *
                le32_to_cpu(pgpt_head->sizeof_partition_entry);
 
-       debug("%s: count = %u * %u = %zu\n", __func__,
+       debug("%s: count = %u * %u = %lu\n", __func__,
              (u32) le32_to_cpu(pgpt_head->num_partition_entries),
-             (u32) le32_to_cpu(pgpt_head->sizeof_partition_entry), count);
+             (u32) le32_to_cpu(pgpt_head->sizeof_partition_entry),
+             (ulong)count);
 
        /* Allocate memory for PTE, remember to FREE */
        if (count != 0) {
@@ -901,9 +902,8 @@ static gpt_entry *alloc_read_gpt_entries(struct blk_desc *dev_desc,
        }
 
        if (count == 0 || pte == NULL) {
-               printf("%s: ERROR: Can't allocate 0x%zX "
-                      "bytes for GPT Entries\n",
-                       __func__, count);
+               printf("%s: ERROR: Can't allocate %#lX bytes for GPT Entries\n",
+                      __func__, (ulong)count);
                return NULL;
        }