Commit 3fc94b38 authored by Jamie McCrae's avatar Jamie McCrae Committed by Jamie
Browse files

boot: boot_serial: Fix slot info response on error



Fixes the CBOR response when a flash area is not listed due to
an error

Signed-off-by: default avatarJamie McCrae <jamie.mccrae@nordicsemi.no>
parent e2c97da3
Loading
Loading
Loading
Loading
+7 −2
Original line number Diff line number Diff line
@@ -746,7 +746,13 @@ bs_slot_info(uint8_t op, char *buf, int len)

                if (rc) {
                    ok = zcbor_tstr_put_lit(cbor_state, "rc") &&
                         zcbor_int32_put(cbor_state, rc);
                         zcbor_int32_put(cbor_state, rc) &&
                         zcbor_map_end_encode(cbor_state, CBOR_ENTRIES_SLOT_INFO_SLOTS_MAP);

                    if (ok && slot == (BOOT_NUM_SLOTS - 1)) {
                        ok = zcbor_list_end_encode(cbor_state, BOOT_NUM_SLOTS) &&
                             zcbor_map_end_encode(cbor_state, CBOR_ENTRIES_SLOT_INFO_IMAGE_MAP);
                    }
                } else {
                    if (sizeof(fap->fa_size) == sizeof(uint64_t)) {
                        ok = zcbor_tstr_put_lit(cbor_state, "size") &&
@@ -808,7 +814,6 @@ bs_slot_info(uint8_t op, char *buf, int len)
                        }

                        ok = zcbor_map_end_encode(cbor_state, CBOR_ENTRIES_SLOT_INFO_IMAGE_MAP);

                    }
                }