Skip to content

Commit

Permalink
mgmt: updatehub: Fix variable type
Browse files Browse the repository at this point in the history
hwinfo_get_define_id returns and ssize_t. Positive value with the
size of the copied id in success or a negative value in case
of error.

Signed-off-by: Flavio Ceolin <[email protected]>
  • Loading branch information
Flavio Ceolin authored and nashif committed Mar 26, 2021
1 parent 53862e7 commit d665b06
Showing 1 changed file with 2 additions and 2 deletions.
4 changes: 2 additions & 2 deletions subsys/mgmt/updatehub/updatehub_device.c
Original file line number Diff line number Diff line change
Expand Up @@ -10,15 +10,15 @@
bool updatehub_get_device_identity(char *id, int id_max_len)
{
uint8_t hwinfo_id[DEVICE_ID_BIN_MAX_SIZE];
size_t length;
ssize_t length;

length = hwinfo_get_device_id(hwinfo_id, DEVICE_ID_BIN_MAX_SIZE);
if (length <= 0) {
return false;
}

memset(id, 0, id_max_len);
length = bin2hex(hwinfo_id, length, id, id_max_len - 1);
length = bin2hex(hwinfo_id, (size_t)length, id, id_max_len - 1);

return length > 0;
}

0 comments on commit d665b06

Please sign in to comment.