Skip to content

Commit 92f9cd9

Browse files
nandojvejukkar
authored andcommitted
lib: updatehub: Fix build warnings
Fix all build warnings. Signed-off-by: Gerson Fernando Budke <[email protected]> Signed-off-by: Otavio Salvador <[email protected]>
1 parent ba6dc5b commit 92f9cd9

File tree

2 files changed

+11
-13
lines changed

2 files changed

+11
-13
lines changed

lib/updatehub/updatehub.c

Lines changed: 9 additions & 11 deletions
Original file line numberDiff line numberDiff line change
@@ -1,5 +1,5 @@
11
/*
2-
* Copyright (c) 2018, 2019 O.S.Systems
2+
* Copyright (c) 2018-2020 O.S.Systems
33
*
44
* SPDX-License-Identifier: Apache-2.0
55
*/
@@ -66,6 +66,8 @@ static struct update_info {
6666
int image_size;
6767
} update_info;
6868

69+
static struct k_delayed_work updatehub_work_handle;
70+
6971
static void wait_fds(void)
7072
{
7173
if (poll(ctx.fds, ctx.nfds, NETWORK_TIMEOUT) < 0) {
@@ -76,7 +78,7 @@ static void wait_fds(void)
7678
static void prepare_fds(void)
7779
{
7880
ctx.fds[ctx.nfds].fd = ctx.sock;
79-
ctx.fds[ctx.nfds].events = 1;
81+
ctx.fds[ctx.nfds].events = POLLIN;
8082
ctx.nfds++;
8183
}
8284

@@ -288,7 +290,7 @@ static int send_request(enum coap_msgtype msgtype, enum coap_method method,
288290
}
289291

290292
ret = coap_packet_append_payload(&request_packet,
291-
&ctx.payload,
293+
ctx.payload,
292294
strlen(ctx.payload));
293295
if (ret < 0) {
294296
LOG_ERR("Not able to append payload");
@@ -614,8 +616,6 @@ enum updatehub_response updatehub_probe(void)
614616
goto error;
615617
}
616618

617-
k_sem_init(&ctx.semaphore, 0, 1);
618-
619619
if (!boot_is_img_confirmed()) {
620620
LOG_ERR("The current image is not confirmed");
621621
ctx.code_status = UPDATEHUB_UNCONFIRMED_IMAGE;
@@ -765,7 +765,7 @@ enum updatehub_response updatehub_update(void)
765765
return ctx.code_status;
766766
}
767767

768-
static void autohandler(struct k_delayed_work *work)
768+
static void autohandler(struct k_work *work)
769769
{
770770
switch (updatehub_probe()) {
771771
case UPDATEHUB_UNCONFIRMED_IMAGE:
@@ -794,13 +794,11 @@ static void autohandler(struct k_delayed_work *work)
794794
break;
795795
}
796796

797-
k_delayed_work_submit(work, UPDATEHUB_POLL_INTERVAL);
797+
k_delayed_work_submit(&updatehub_work_handle, UPDATEHUB_POLL_INTERVAL);
798798
}
799799

800800
void updatehub_autohandler(void)
801801
{
802-
static struct k_delayed_work work;
803-
804-
k_delayed_work_init(&work, autohandler);
805-
k_delayed_work_submit(&work, K_NO_WAIT);
802+
k_delayed_work_init(&updatehub_work_handle, autohandler);
803+
k_delayed_work_submit(&updatehub_work_handle, K_NO_WAIT);
806804
}

lib/updatehub/updatehub_device.c

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -1,13 +1,13 @@
11
/*
2-
* Copyright (c) 2018 O.S.Systems
2+
* Copyright (c) 2018-2020 O.S.Systems
33
*
44
* SPDX-License-Identifier: Apache-2.0
55
*/
66
#include "updatehub_device.h"
77

88
bool updatehub_get_device_identity(char *id, int id_max_len)
99
{
10-
int i, id_len = 0, buf_len = 0;
10+
int i, id_len = 0;
1111
char buf[3];
1212
u8_t hwinfo_id[id_max_len];
1313
size_t length;

0 commit comments

Comments
 (0)