net: lwm2m: correct return value in tlv put

The function calculates the number of octets put, but does not return
it.  Call sites check for non-zero values suggesting this is a bug.

See https://habr.com/en/company/pvs-studio/blog/495284/ fragment 12.

Signed-off-by: Peter Bigot <peter.bigot@nordicsemi.no>
This commit is contained in:
Peter Bigot 2020-04-05 11:32:49 -05:00 committed by Anas Nashif
commit abbd53ce1f

View file

@ -337,7 +337,7 @@ static size_t put_end_tlv(struct lwm2m_output_context *out, u16_t mark_pos,
tlv_setup(&tlv, tlv_type, tlv_id, len); tlv_setup(&tlv, tlv_type, tlv_id, len);
len = oma_tlv_put(&tlv, out, NULL, true) - tlv.length; len = oma_tlv_put(&tlv, out, NULL, true) - tlv.length;
return 0; return len;
} }
static size_t put_begin_oi(struct lwm2m_output_context *out, static size_t put_begin_oi(struct lwm2m_output_context *out,