fs: fat: Shrink the size of a few strings
To save a few bytes, replace Error with ** and try to use the same string
for multiple messages where possible.
Signed-off-by: Simon Glass <sjg@chromium.org>
Reviewed-by: Bin Meng <bmeng.cn@gmail.com>
diff --git a/fs/fat/fat_write.c b/fs/fat/fat_write.c
index 413fc43..e2a9913 100644
--- a/fs/fat/fat_write.c
+++ b/fs/fat/fat_write.c
@@ -1571,8 +1571,9 @@
char *filename_copy, *dirname, *basename;
filename_copy = strdup(filename);
- if (!filename_copy) {
- printf("Error: allocating memory\n");
+ itr = malloc_cache_aligned(sizeof(fat_itr));
+ if (!itr || !filename_copy) {
+ printf("Error: out of memory\n");
ret = -ENOMEM;
goto exit;
}
@@ -1584,13 +1585,6 @@
goto exit;
}
- itr = malloc_cache_aligned(sizeof(fat_itr));
- if (!itr) {
- printf("Error: allocating memory\n");
- ret = -ENOMEM;
- goto exit;
- }
-
ret = fat_itr_root(itr, &fsdata);
if (ret)
goto exit;
@@ -1605,7 +1599,7 @@
}
if (!find_directory_entry(itr, basename)) {
- printf("%s: doesn't exist\n", basename);
+ log_err("%s: doesn't exist (%d)\n", basename, -ENOENT);
ret = -ENOENT;
goto exit;
}