Skip to content

Commit c1910f0

Browse files
committed
boot: boot_serial: Fix indent
There was a faulty indent in some code Signed-off-by: Jamie McCrae <jamie.mccrae@nordicsemi.no>
1 parent d905a69 commit c1910f0

File tree

1 file changed

+71
-71
lines changed

1 file changed

+71
-71
lines changed

boot/boot_serial/src/boot_serial.c

Lines changed: 71 additions & 71 deletions
Original file line numberDiff line numberDiff line change
@@ -722,109 +722,109 @@ bs_slot_info(uint8_t op, char *buf, int len)
722722
IMAGES_ITER(image_index) {
723723
for (slot = 0; slot < BOOT_NUM_SLOTS; slot++) {
724724
if (slot == 0) {
725-
ok = zcbor_map_start_encode(cbor_state, CBOR_ENTRIES_SLOT_INFO_IMAGE_MAP) &&
726-
zcbor_tstr_put_lit(cbor_state, "image") &&
727-
zcbor_uint32_put(cbor_state, (uint32_t)image_index) &&
728-
zcbor_tstr_put_lit(cbor_state, "slots") &&
729-
zcbor_list_start_encode(cbor_state, BOOT_NUM_SLOTS);
725+
ok = zcbor_map_start_encode(cbor_state, CBOR_ENTRIES_SLOT_INFO_IMAGE_MAP) &&
726+
zcbor_tstr_put_lit(cbor_state, "image") &&
727+
zcbor_uint32_put(cbor_state, (uint32_t)image_index) &&
728+
zcbor_tstr_put_lit(cbor_state, "slots") &&
729+
zcbor_list_start_encode(cbor_state, BOOT_NUM_SLOTS);
730730

731-
if (!ok) {
732-
goto finish;
733-
}
731+
if (!ok) {
732+
goto finish;
734733
}
734+
}
735735

736-
ok = zcbor_map_start_encode(cbor_state, CBOR_ENTRIES_SLOT_INFO_SLOTS_MAP) &&
737-
zcbor_tstr_put_lit(cbor_state, "slot") &&
738-
zcbor_uint32_put(cbor_state, slot);
736+
ok = zcbor_map_start_encode(cbor_state, CBOR_ENTRIES_SLOT_INFO_SLOTS_MAP) &&
737+
zcbor_tstr_put_lit(cbor_state, "slot") &&
738+
zcbor_uint32_put(cbor_state, slot);
739739

740-
if (!ok) {
741-
goto finish;
742-
}
740+
if (!ok) {
741+
goto finish;
742+
}
743743

744-
area_id = flash_area_id_from_multi_image_slot(image_index, slot);
745-
rc = flash_area_open(area_id, &fap);
744+
area_id = flash_area_id_from_multi_image_slot(image_index, slot);
745+
rc = flash_area_open(area_id, &fap);
746746

747-
if (rc) {
748-
ok = zcbor_tstr_put_lit(cbor_state, "rc") &&
749-
zcbor_int32_put(cbor_state, rc) &&
750-
zcbor_map_end_encode(cbor_state, CBOR_ENTRIES_SLOT_INFO_SLOTS_MAP);
747+
if (rc) {
748+
ok = zcbor_tstr_put_lit(cbor_state, "rc") &&
749+
zcbor_int32_put(cbor_state, rc) &&
750+
zcbor_map_end_encode(cbor_state, CBOR_ENTRIES_SLOT_INFO_SLOTS_MAP);
751751

752-
if (ok && slot == (BOOT_NUM_SLOTS - 1)) {
753-
ok = zcbor_list_end_encode(cbor_state, BOOT_NUM_SLOTS) &&
754-
zcbor_map_end_encode(cbor_state, CBOR_ENTRIES_SLOT_INFO_IMAGE_MAP);
755-
}
752+
if (ok && slot == (BOOT_NUM_SLOTS - 1)) {
753+
ok = zcbor_list_end_encode(cbor_state, BOOT_NUM_SLOTS) &&
754+
zcbor_map_end_encode(cbor_state, CBOR_ENTRIES_SLOT_INFO_IMAGE_MAP);
755+
}
756+
} else {
757+
if (sizeof(fap->fa_size) == sizeof(uint64_t)) {
758+
ok = zcbor_tstr_put_lit(cbor_state, "size") &&
759+
zcbor_uint64_put(cbor_state, fap->fa_size);
756760
} else {
757-
if (sizeof(fap->fa_size) == sizeof(uint64_t)) {
758-
ok = zcbor_tstr_put_lit(cbor_state, "size") &&
759-
zcbor_uint64_put(cbor_state, fap->fa_size);
760-
} else {
761-
ok = zcbor_tstr_put_lit(cbor_state, "size") &&
762-
zcbor_uint32_put(cbor_state, fap->fa_size);
763-
}
761+
ok = zcbor_tstr_put_lit(cbor_state, "size") &&
762+
zcbor_uint32_put(cbor_state, fap->fa_size);
763+
}
764764

765-
if (!ok) {
766-
flash_area_close(fap);
767-
goto finish;
768-
}
765+
if (!ok) {
766+
flash_area_close(fap);
767+
goto finish;
768+
}
769769

770-
/*
771-
* Check if we support uploading to this slot and if so, return the
772-
* image ID
773-
*/
770+
/*
771+
* Check if we support uploading to this slot and if so, return the
772+
* image ID
773+
*/
774774
#if defined(MCUBOOT_SINGLE_APPLICATION_SLOT)
775-
ok = zcbor_tstr_put_lit(cbor_state, "upload_image_id") &&
776-
zcbor_uint32_put(cbor_state, (image_index + 1));
775+
ok = zcbor_tstr_put_lit(cbor_state, "upload_image_id") &&
776+
zcbor_uint32_put(cbor_state, (image_index + 1));
777777
#elif defined(MCUBOOT_SERIAL_DIRECT_IMAGE_UPLOAD)
778-
ok = zcbor_tstr_put_lit(cbor_state, "upload_image_id") &&
779-
zcbor_uint32_put(cbor_state, (image_index * 2 + slot + 1));
778+
ok = zcbor_tstr_put_lit(cbor_state, "upload_image_id") &&
779+
zcbor_uint32_put(cbor_state, (image_index * 2 + slot + 1));
780780
#else
781-
if (slot == 1) {
782-
ok = zcbor_tstr_put_lit(cbor_state, "upload_image_id") &&
783-
zcbor_uint32_put(cbor_state, (image_index * 2 + 1));
784-
}
781+
if (slot == 1) {
782+
ok = zcbor_tstr_put_lit(cbor_state, "upload_image_id") &&
783+
zcbor_uint32_put(cbor_state, (image_index * 2 + 1));
784+
}
785785
#endif
786786

787-
flash_area_close(fap);
787+
flash_area_close(fap);
788788

789-
if (!ok) {
789+
if (!ok) {
790+
goto finish;
791+
}
792+
793+
ok = zcbor_map_end_encode(cbor_state, CBOR_ENTRIES_SLOT_INFO_SLOTS_MAP);
794+
795+
if (!ok) {
790796
goto finish;
791-
}
797+
}
792798

793-
ok = zcbor_map_end_encode(cbor_state, CBOR_ENTRIES_SLOT_INFO_SLOTS_MAP);
799+
if (slot == (BOOT_NUM_SLOTS - 1)) {
800+
ok = zcbor_list_end_encode(cbor_state, BOOT_NUM_SLOTS);
794801

795802
if (!ok) {
796-
goto finish;
803+
goto finish;
797804
}
798805

799-
if (slot == (BOOT_NUM_SLOTS - 1)) {
800-
ok = zcbor_list_end_encode(cbor_state, BOOT_NUM_SLOTS);
806+
if (image_max_sizes[image_index].calculated == true) {
807+
ok = zcbor_tstr_put_lit(cbor_state, "max_image_size") &&
808+
zcbor_uint32_put(cbor_state,
809+
image_max_sizes[image_index].max_size);
801810

802811
if (!ok) {
803812
goto finish;
804813
}
805-
806-
if (image_max_sizes[image_index].calculated == true) {
807-
ok = zcbor_tstr_put_lit(cbor_state, "max_image_size") &&
808-
zcbor_uint32_put(cbor_state,
809-
image_max_sizes[image_index].max_size);
810-
811-
if (!ok) {
812-
goto finish;
813-
}
814-
}
815-
816-
ok = zcbor_map_end_encode(cbor_state, CBOR_ENTRIES_SLOT_INFO_IMAGE_MAP);
817814
}
818-
}
819815

820-
if (!ok) {
821-
goto finish;
816+
ok = zcbor_map_end_encode(cbor_state, CBOR_ENTRIES_SLOT_INFO_IMAGE_MAP);
822817
}
823818
}
819+
820+
if (!ok) {
821+
goto finish;
822+
}
824823
}
824+
}
825825

826-
ok = zcbor_list_end_encode(cbor_state, MCUBOOT_IMAGE_NUMBER) &&
827-
zcbor_map_end_encode(cbor_state, 1);
826+
ok = zcbor_list_end_encode(cbor_state, MCUBOOT_IMAGE_NUMBER) &&
827+
zcbor_map_end_encode(cbor_state, 1);
828828

829829
finish:
830830
if (!ok) {

0 commit comments

Comments
 (0)