From 212843c0807b8366bf5eade4e1d0385e17b565a6 Mon Sep 17 00:00:00 2001 From: Alexandre Abadie Date: Fri, 8 Jan 2021 11:52:38 +0100 Subject: [PATCH] examples/asymcute_mqttsn: fix issues reported coccinelle no need to cast atoi return value, _topic_init returns a pointer, so check against NULL --- examples/asymcute_mqttsn/main.c | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/examples/asymcute_mqttsn/main.c b/examples/asymcute_mqttsn/main.c index a5c42f3d6f..b1c980ef6e 100644 --- a/examples/asymcute_mqttsn/main.c +++ b/examples/asymcute_mqttsn/main.c @@ -89,7 +89,7 @@ static uint16_t _parse_predef_id(const char *name) { uint16_t id = 0; if ((strlen(name) > 4) && (strncmp(name, "pre_", 4) == 0)) { - id = (uint16_t)atoi(&name[4]); + id = atoi(&name[4]); } return id; } @@ -438,7 +438,7 @@ static int _cmd_sub(int argc, char **argv) puts("error: no free topic memory"); return 1; } - if (_topic_init(t, argv[1]) == 0) { + if (_topic_init(t, argv[1]) == NULL) { puts("error: unable to initialize topic"); return 1; }