Skip to content
Merged
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
17 changes: 11 additions & 6 deletions subsys/mgmt/mcumgr/grp/stat_mgmt/src/stat_mgmt.c
Original file line number Diff line number Diff line change
Expand Up @@ -190,7 +190,7 @@
{
const struct stats_hdr *cur = NULL;
zcbor_state_t *zse = ctxt->writer->zs;
bool ok;
bool ok = true;
size_t counter = 0;

do {
Expand All @@ -200,10 +200,15 @@
}
} while (cur != NULL);

ok = zcbor_tstr_put_lit(zse, "rc") &&
zcbor_int32_put(zse, MGMT_ERR_EOK) &&
zcbor_tstr_put_lit(zse, "stat_list") &&
zcbor_list_start_encode(zse, counter);
if (IS_ENABLED(CONFIG_MCUMGR_SMP_LEGACY_RC_BEHAVIOUR)) {
ok = zcbor_tstr_put_lit(zse, "rc") &&
zcbor_int32_put(zse, MGMT_ERR_EOK);
}

if (ok) {
ok = zcbor_tstr_put_lit(zse, "stat_list") &&
zcbor_list_start_encode(zse, counter);
}

Check notice on line 211 in subsys/mgmt/mcumgr/grp/stat_mgmt/src/stat_mgmt.c

View workflow job for this annotation

GitHub Actions / Run compliance checks on patch series (PR)

You may want to run clang-format on this change

subsys/mgmt/mcumgr/grp/stat_mgmt/src/stat_mgmt.c:211 - ok = zcbor_tstr_put_lit(zse, "rc") && - zcbor_int32_put(zse, MGMT_ERR_EOK); + ok = zcbor_tstr_put_lit(zse, "rc") && zcbor_int32_put(zse, MGMT_ERR_EOK); } if (ok) { - ok = zcbor_tstr_put_lit(zse, "stat_list") && - zcbor_list_start_encode(zse, counter); + ok = zcbor_tstr_put_lit(zse, "stat_list") && zcbor_list_start_encode(zse, counter);

Check notice on line 211 in subsys/mgmt/mcumgr/grp/stat_mgmt/src/stat_mgmt.c

View workflow job for this annotation

GitHub Actions / Run compliance checks on patch series (PR)

You may want to run clang-format on this change

subsys/mgmt/mcumgr/grp/stat_mgmt/src/stat_mgmt.c:211 - ok = zcbor_tstr_put_lit(zse, "rc") && - zcbor_int32_put(zse, MGMT_ERR_EOK); + ok = zcbor_tstr_put_lit(zse, "rc") && zcbor_int32_put(zse, MGMT_ERR_EOK); } if (ok) { - ok = zcbor_tstr_put_lit(zse, "stat_list") && - zcbor_list_start_encode(zse, counter); + ok = zcbor_tstr_put_lit(zse, "stat_list") && zcbor_list_start_encode(zse, counter);

Check notice on line 211 in subsys/mgmt/mcumgr/grp/stat_mgmt/src/stat_mgmt.c

View workflow job for this annotation

GitHub Actions / Run compliance checks on patch series (PR)

You may want to run clang-format on this change

subsys/mgmt/mcumgr/grp/stat_mgmt/src/stat_mgmt.c:211 - ok = zcbor_tstr_put_lit(zse, "rc") && - zcbor_int32_put(zse, MGMT_ERR_EOK); + ok = zcbor_tstr_put_lit(zse, "rc") && zcbor_int32_put(zse, MGMT_ERR_EOK); } if (ok) { - ok = zcbor_tstr_put_lit(zse, "stat_list") && - zcbor_list_start_encode(zse, counter); + ok = zcbor_tstr_put_lit(zse, "stat_list") && zcbor_list_start_encode(zse, counter);

if (!ok) {
return MGMT_ERR_EMSGSIZE;
Expand All @@ -224,7 +229,7 @@
return MGMT_ERR_EMSGSIZE;
}

return 0;
return MGMT_ERR_EOK;
}

#ifdef CONFIG_MCUMGR_SMP_SUPPORT_ORIGINAL_PROTOCOL
Expand Down
Loading