From 8b82c6b91bc5d9c78504b50b537feef424b6043a Mon Sep 17 00:00:00 2001 From: Arthur Heymans Date: Wed, 23 Mar 2022 19:58:44 +0100 Subject: util/ifittool: Fix clearing FIT when setting the pointer MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit When setting the FIT pointer, the FIT table is only known later in the codeflow. Change-Id: I658f4fffa997d1f7beaf6d6ae37d2885ae602e5c Signed-off-by: Arthur Heymans Reviewed-on: https://review.coreboot.org/c/coreboot/+/63035 Reviewed-by: Paul Menzel Reviewed-by: Sean Rhodes Reviewed-by: Michael Niewöhner Tested-by: build bot (Jenkins) --- util/cbfstool/ifittool.c | 22 +++++++++++++++------- 1 file changed, 15 insertions(+), 7 deletions(-) (limited to 'util') diff --git a/util/cbfstool/ifittool.c b/util/cbfstool/ifittool.c index c2a5221f0c..88a973c5af 100644 --- a/util/cbfstool/ifittool.c +++ b/util/cbfstool/ifittool.c @@ -308,13 +308,12 @@ int main(int argc, char *argv[]) ERROR("FIT not found.\n"); return 1; } - } - - if (clear_table) { - if (fit_clear_table(fit)) { - partitioned_file_close(image_file); - ERROR("Failed to clear table.\n"); - return 1; + if (clear_table) { + if (fit_clear_table(fit)) { + partitioned_file_close(image_file); + ERROR("Failed to clear table.\n"); + return 1; + } } } @@ -394,6 +393,15 @@ int main(int argc, char *argv[]) return 1; } fit = fit_get_table(&bootblock, convert_to_from_top_aligned, topswap_size); + + if (clear_table) { + if (fit_clear_table(fit)) { + partitioned_file_close(image_file); + ERROR("Failed to clear table.\n"); + return 1; + } + } + break; } case DEL_OP: -- cgit v1.2.3