drivers/tpm/tpm_tis_sandbox.c: Fix uninitialized variable use
[platform/kernel/u-boot.git] / common / image.c
index 12102ab..26d6c9a 100644 (file)
@@ -29,7 +29,7 @@
 #include <image.h>
 #include <mapmem.h>
 
-#if IMAGE_ENABLE_FIT || defined(CONFIG_OF_LIBFDT)
+#if IMAGE_ENABLE_FIT || IMAGE_ENABLE_OF_LIBFDT
 #include <libfdt.h>
 #include <fdt_support.h>
 #endif
@@ -608,11 +608,9 @@ const char *genimg_get_type_name(uint8_t type)
        return (get_table_entry_name(uimage_type, "Unknown Image", type));
 }
 
-const char *genimg_get_type_short_name(uint8_t type)
+static const char *genimg_get_short_name(const table_entry_t *table, int val)
 {
-       const table_entry_t *table;
-
-       table = get_table_entry(uimage_type, type);
+       table = get_table_entry(table, val);
        if (!table)
                return "unknown";
 #if defined(USE_HOSTCC) || !defined(CONFIG_NEEDS_MANUAL_RELOC)
@@ -622,12 +620,32 @@ const char *genimg_get_type_short_name(uint8_t type)
 #endif
 }
 
+const char *genimg_get_type_short_name(uint8_t type)
+{
+       return genimg_get_short_name(uimage_type, type);
+}
+
 const char *genimg_get_comp_name(uint8_t comp)
 {
        return (get_table_entry_name(uimage_comp, "Unknown Compression",
                                        comp));
 }
 
+const char *genimg_get_comp_short_name(uint8_t comp)
+{
+       return genimg_get_short_name(uimage_comp, comp);
+}
+
+const char *genimg_get_os_short_name(uint8_t os)
+{
+       return genimg_get_short_name(uimage_os, os);
+}
+
+const char *genimg_get_arch_short_name(uint8_t arch)
+{
+       return genimg_get_short_name(uimage_arch, arch);
+}
+
 /**
  * get_table_entry_id - translate short entry name to id
  * @table: pointer to a translation table for entries of a specific type
@@ -762,7 +780,7 @@ int genimg_get_format(const void *img_addr)
        if (image_check_magic(hdr))
                return IMAGE_FORMAT_LEGACY;
 #endif
-#if IMAGE_ENABLE_FIT || defined(CONFIG_OF_LIBFDT)
+#if IMAGE_ENABLE_FIT || IMAGE_ENABLE_OF_LIBFDT
        if (fdt_check_header(img_addr) == 0)
                return IMAGE_FORMAT_FIT;
 #endif