fw: Remove unneeded variable

Instead of assigning error to a variable, just include the function
returning the error in the if case.
This commit is contained in:
Michael Cardell Widerkrantz 2025-04-28 17:46:28 +02:00
parent 0692dddbae
commit 9d1bbffbaa
No known key found for this signature in database
GPG key ID: D3DB3DDF57E704E5

View file

@ -93,8 +93,8 @@ int storage_allocate_area(struct partition_table_storage *part_table_storage)
} }
uint32_t start_address = 0; 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; return -3;
} }
@ -134,8 +134,7 @@ int storage_deallocate_area(struct partition_table_storage *part_table_storage)
} }
uint32_t start_address = 0; uint32_t start_address = 0;
int err = index_to_address(index, &start_address); if (index_to_address(index, &start_address) != 0) {
if (err) {
return -1; return -1;
} }
@ -180,8 +179,7 @@ int storage_erase_sector(struct partition_table *part_table, uint32_t offset,
} }
uint32_t start_address = 0; uint32_t start_address = 0;
int err = index_to_address(index, &start_address); if (index_to_address(index, &start_address) != 0) {
if (err) {
return -1; return -1;
} }
@ -241,8 +239,7 @@ int storage_write_data(struct partition_table *part_table, uint32_t offset,
} }
uint32_t start_address = 0; uint32_t start_address = 0;
int err = index_to_address(index, &start_address); if (index_to_address(index, &start_address) != 0) {
if (err) {
return -1; return -1;
} }
@ -291,8 +288,8 @@ int storage_read_data(struct partition_table *part_table, uint32_t offset,
} }
uint32_t start_address = 0; 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; return -1;
} }