The struct uimage_handle only stores the file name if header->ih_name
if empty. To make it possible to always get a descriptive name for when
bootm-uimage is switched over to loadables, let's store the filename
in the uimage_handle.

Signed-off-by: Ahmad Fatoum <[email protected]>
---
 common/uimage.c | 2 ++
 include/image.h | 1 +
 2 files changed, 3 insertions(+)

diff --git a/common/uimage.c b/common/uimage.c
index 5f7087475709..d34205572510 100644
--- a/common/uimage.c
+++ b/common/uimage.c
@@ -183,6 +183,7 @@ struct uimage_handle *uimage_open(const char *filename)
         * fd is now at the first data word
         */
        handle->fd = fd;
+       handle->filename = xstrdup(filename);
 
        return handle;
 err_out:
@@ -212,6 +213,7 @@ void uimage_close(struct uimage_handle *handle)
        }
 
        free(handle->name);
+       free(handle->filename);
        free(handle);
 }
 EXPORT_SYMBOL(uimage_close);
diff --git a/include/image.h b/include/image.h
index d9a1b8f3ee02..769523d6fcaf 100644
--- a/include/image.h
+++ b/include/image.h
@@ -312,6 +312,7 @@ void *uimage_load_to_buf(struct uimage_handle *handle, int 
image_no,
 struct uimage_handle {
        struct image_header header;
        char *name;
+       char *filename;
        char *copy;
        struct uimage_handle_data ihd[MAX_MULTI_IMAGE_COUNT];
        int nb_data_entries;
-- 
2.47.3


Reply via email to