net: lwm2m: fix error code in read and write handlers

When a data pointer or data length is not set, the read and write
handlers should return ENOENT to generate the correct LwM2M error
code (COAP_RESPONSE_CODE_NOT_FOUND).

Signed-off-by: Michael Scott <michael@opensourcefoundries.com>
This commit is contained in:
Michael Scott 2018-04-30 15:20:19 -07:00 committed by Jukka Rissanen
commit cf55b70b4c

View file

@ -1870,7 +1870,7 @@ static int lwm2m_read_handler(struct lwm2m_engine_obj_inst *obj_inst,
}
if (!data_ptr || data_len == 0) {
return -EINVAL;
return -ENOENT;
}
if (res->multi_count_var != NULL) {
@ -2180,6 +2180,8 @@ int lwm2m_write_handler(struct lwm2m_engine_obj_inst *obj_inst,
return -EINVAL;
}
} else {
return -ENOENT;
}
if (res->post_write_cb &&