From 9d1bbffbaa4d47628a53dd33c9ce3fba4a2dc47f Mon Sep 17 00:00:00 2001 From: Michael Cardell Widerkrantz Date: Mon, 28 Apr 2025 17:46:28 +0200 Subject: [PATCH] fw: Remove unneeded variable Instead of assigning error to a variable, just include the function returning the error in the if case. --- hw/application_fpga/fw/tk1/storage.c | 17 +++++++---------- 1 file changed, 7 insertions(+), 10 deletions(-) diff --git a/hw/application_fpga/fw/tk1/storage.c b/hw/application_fpga/fw/tk1/storage.c index e12503a..f59c6e1 100644 --- a/hw/application_fpga/fw/tk1/storage.c +++ b/hw/application_fpga/fw/tk1/storage.c @@ -93,8 +93,8 @@ int storage_allocate_area(struct partition_table_storage *part_table_storage) } uint32_t start_address = 0; - int err = index_to_address(index, &start_address); - if (err) { + + if (index_to_address(index, &start_address) != 0) { return -3; } @@ -134,8 +134,7 @@ int storage_deallocate_area(struct partition_table_storage *part_table_storage) } uint32_t start_address = 0; - int err = index_to_address(index, &start_address); - if (err) { + if (index_to_address(index, &start_address) != 0) { return -1; } @@ -180,8 +179,7 @@ int storage_erase_sector(struct partition_table *part_table, uint32_t offset, } uint32_t start_address = 0; - int err = index_to_address(index, &start_address); - if (err) { + if (index_to_address(index, &start_address) != 0) { return -1; } @@ -241,8 +239,7 @@ int storage_write_data(struct partition_table *part_table, uint32_t offset, } uint32_t start_address = 0; - int err = index_to_address(index, &start_address); - if (err) { + if (index_to_address(index, &start_address) != 0) { return -1; } @@ -291,8 +288,8 @@ int storage_read_data(struct partition_table *part_table, uint32_t offset, } uint32_t start_address = 0; - int err = index_to_address(index, &start_address); - if (err) { + + if (index_to_address(index, &start_address) != 0) { return -1; }