]> Git Repo - J-u-boot.git/blobdiff - cmd/gpt.c
cmd/gpt: avoid NULL check before free()
[J-u-boot.git] / cmd / gpt.c
index 964702bad43e91281d4e0a937143babdd5250dd0..b8d11c167df776476a39e64137153e953b6538f8 100644 (file)
--- a/cmd/gpt.c
+++ b/cmd/gpt.c
@@ -20,6 +20,7 @@
 #include <div64.h>
 #include <memalign.h>
 #include <linux/compat.h>
+#include <linux/err.h>
 #include <linux/sizes.h>
 #include <stdlib.h>
 
@@ -244,7 +245,7 @@ static void print_gpt_info(void)
                printf("Block size %lu, name %s\n", curr->gpt_part_info.blksz,
                       curr->gpt_part_info.name);
                printf("Type %s, bootable %d\n", curr->gpt_part_info.type,
-                      curr->gpt_part_info.bootable);
+                      curr->gpt_part_info.bootable & PART_BOOTABLE);
 #ifdef CONFIG_PARTITION_UUIDS
                printf("UUID %s\n", curr->gpt_part_info.uuid);
 #endif
@@ -534,7 +535,7 @@ static int set_gpt_info(struct blk_desc *dev_desc,
 
                /* bootable */
                if (found_key(tok, "bootable"))
-                       parts[i].bootable = 1;
+                       parts[i].bootable = PART_BOOTABLE;
        }
 
        *parts_count = p_count;
@@ -771,11 +772,9 @@ static int do_rename_gpt_parts(struct blk_desc *dev_desc, char *subcomm,
  out:
        del_gpt_info();
 #ifdef CONFIG_RANDOM_UUID
-       if (str_disk_guid)
-               free(str_disk_guid);
+       free(str_disk_guid);
 #endif
-       if (new_partitions)
-               free(new_partitions);
+       free(new_partitions);
        free(partitions_list);
        return ret;
 }
This page took 0.02487 seconds and 4 git commands to generate.