Matt DeVillier has submitted this change. ( https://review.coreboot.org/c/coreboot/+/86567?usp=email )
Change subject: util/cbfstool: Add missing \n and use __func__ in debug messages ......................................................................
util/cbfstool: Add missing \n and use __func__ in debug messages
For adding missing \n, find all potential missings by below script and apply manual checks and fixes.
grep -nE "(DEBUG|ERROR)(".+[^\n]"" util/cbfstool/ -r
For using __func__ in debug message, below script is used with manual checks and fixes.
grep -nE "DEBUG(.+:" util/cbfstool/ -r
Change-Id: I3e2c225dc16a65470f9f94db89d8ec3711e781c8 Signed-off-by: Shuo Liu shuo.liu@intel.com Reviewed-on: https://review.coreboot.org/c/coreboot/+/86567 Reviewed-by: Elyes Haouas ehaouas@noos.fr Tested-by: build bot (Jenkins) no-reply@coreboot.org --- M util/cbfstool/cbfs_image.c M util/cbfstool/fit.c 2 files changed, 18 insertions(+), 18 deletions(-)
Approvals: build bot (Jenkins): Verified Elyes Haouas: Looks good to me, approved
diff --git a/util/cbfstool/cbfs_image.c b/util/cbfstool/cbfs_image.c index e935357..bb7c6f1 100644 --- a/util/cbfstool/cbfs_image.c +++ b/util/cbfstool/cbfs_image.c @@ -257,13 +257,13 @@ void *header_loc; size_t size = image->buffer.size;
- DEBUG("cbfs_image_create: bootblock=0x%x+0x%zx, " - "header=0x%x+0x%zx, entries_offset=0x%x\n", + DEBUG("%s: bootblock=0x%x+0x%zx, " + "header=0x%x+0x%zx, entries_offset=0x%x\n", __func__, bootblock_offset, bootblock->size, header_offset, sizeof(image->header), entries_offset);
- DEBUG("cbfs_create_image: (real offset) bootblock=0x%x, " - "header=0x%x, entries_offset=0x%x\n", + DEBUG("%s: (real offset) bootblock=0x%x, " + "header=0x%x, entries_offset=0x%x\n", __func__, bootblock_offset, header_offset, entries_offset);
// Prepare bootblock @@ -636,7 +636,7 @@ if (header_offset % align) header_offset -= header_offset % align; if (header_offset < addr) { - ERROR("No space to hold cbfs_file header."); + ERROR("No space to hold cbfs_file header.\n"); return -1; }
@@ -771,7 +771,7 @@ entry_size = addr_next - addr; max_null_entry_size = MAX(max_null_entry_size, entry_size);
- DEBUG("cbfs_add_entry: space at 0x%x+0x%x(%d) bytes\n", + DEBUG("%s: space at 0x%x+0x%x(%d) bytes\n", __func__, addr, entry_size, entry_size);
/* Will the file fit? Don't yet worry if we have space for a new @@ -783,10 +783,10 @@ // Test for complicated cases if (content_offset > 0) { if (addr_next < content_offset) { - DEBUG("Not for specified offset yet"); + DEBUG("Not for specified offset yet.\n"); continue; } else if (addr > content_offset) { - DEBUG("Exceed specified content_offset."); + DEBUG("Exceed specified content_offset.\n"); break; } else if (addr + header_size > content_offset) { ERROR("Not enough space for header.\n"); @@ -830,7 +830,7 @@ entry && cbfs_is_valid_entry(image, entry); entry = cbfs_find_next_entry(image, entry)) { if (strcasecmp(entry->filename, name) == 0) { - DEBUG("cbfs_get_entry: found %s\n", name); + DEBUG("%s: found %s\n", __func__, name); return entry; } } @@ -1323,7 +1323,7 @@ ERROR("CBFS file %s not found.\n", name); return -1; } - DEBUG("cbfs_remove_entry: Removed %s @ 0x%x\n", + DEBUG("%s: Removed %s @ 0x%x\n", __func__, entry->filename, cbfs_get_entry_addr(image, entry)); entry->type = htobe32(CBFS_TYPE_DELETED); cbfs_legacy_walk(image, cbfs_merge_empty_entry, NULL); @@ -1879,7 +1879,7 @@ } while (next != NULL); uint32_t header_size = be32toh(header->offset) + size; if (header_size > CBFS_METADATA_MAX_SIZE) { - DEBUG("exceeding allocated space for cbfs_file headers"); + DEBUG("exceeding allocated space for cbfs_file headers.\n"); return NULL; } /* attr points to the last valid attribute now. @@ -2024,14 +2024,14 @@ offset = absolute_align(image, addr + metadata_size, align); if (is_in_same_page(offset, size, page_size) && is_in_range(addr, addr_next, metadata_size, offset, size)) { - DEBUG("cbfs_locate_entry: FIT (PAGE1)."); + DEBUG("%s: FIT (PAGE1).\n", __func__); return offset; }
addr2 = align_up(addr, page_size); offset = absolute_align(image, addr2, align); if (is_in_range(addr, addr_next, metadata_size, offset, size)) { - DEBUG("cbfs_locate_entry: OVERLAP (PAGE2)."); + DEBUG("%s: OVERLAP (PAGE2).\n", __func__); return offset; }
@@ -2041,7 +2041,7 @@ addr3 = addr2 + page_size; offset = absolute_align(image, addr3, align); if (is_in_range(addr, addr_next, metadata_size, offset, size)) { - DEBUG("cbfs_locate_entry: OVERLAP+ (PAGE3)."); + DEBUG("%s: OVERLAP+ (PAGE3).\n", __func__); return offset; } } diff --git a/util/cbfstool/fit.c b/util/cbfstool/fit.c index d4e48f1..ca60720 100644 --- a/util/cbfstool/fit.c +++ b/util/cbfstool/fit.c @@ -719,12 +719,12 @@ struct fit_entry *entry;
if (!fit) { - ERROR("Internal error."); + ERROR("Internal error.\n"); return 1; }
if (fit_free_space(fit, max_fit_entries) < 1) { - ERROR("No space left in FIT."); + ERROR("No space left in FIT.\n"); return 1; }
@@ -781,12 +781,12 @@ const size_t idx) { if (!fit) { - ERROR("Internal error."); + ERROR("Internal error.\n"); return 1; }
if (idx >= fit_table_entries(fit)) { - ERROR("Index out of range."); + ERROR("Index out of range.\n"); return 1; }