1
0
mirror of https://github.com/RIOT-OS/RIOT.git synced 2025-12-27 07:21:18 +01:00

Merge pull request #15729 from aabadie/pr/ci/coccinelle_fixes

ci: fix all coccinelle recommendations
This commit is contained in:
Alexandre Abadie 2021-01-08 15:33:32 +01:00 committed by GitHub
commit a6420a1fe1
No known key found for this signature in database
GPG Key ID: 4AEE18F83AFDEB23
12 changed files with 19 additions and 18 deletions

View File

@ -30,7 +30,7 @@
#include "vendor/drivers/fsl_clock.h"
#define ENABLE_DEBUG (0)
#define ENABLE_DEBUG 0
#include "debug.h"

View File

@ -32,7 +32,7 @@
#include "vendor/drivers/fsl_clock.h"
#define ENABLE_DEBUG (0)
#define ENABLE_DEBUG 0
#include "debug.h"
/**

View File

@ -33,7 +33,7 @@
#include "vendor/drivers/fsl_clock.h"
#define ENABLE_DEBUG (0)
#define ENABLE_DEBUG 0
#include "debug.h"
/**

View File

@ -27,7 +27,7 @@
#include "sam0_eth_netdev.h"
#define ENABLE_DEBUG (0)
#define ENABLE_DEBUG 0
#include "debug.h"
#include "log.h"

View File

@ -30,7 +30,7 @@
#include "sam0_eth_netdev.h"
#define ENABLE_DEBUG (0)
#define ENABLE_DEBUG 0
#include "debug.h"
#include "log.h"

View File

@ -28,7 +28,7 @@
#include "periph_conf.h"
#include "periph_cpu.h"
#define ENABLE_DEBUG (0)
#define ENABLE_DEBUG 0
#include "debug.h"
void stm32_eth_common_init(void)

View File

@ -29,7 +29,7 @@
#include "periph_cpu.h"
#include "timex.h"
#define ENABLE_DEBUG (0)
#define ENABLE_DEBUG 0
#include "debug.h"
/* Workaround for typos in vendor files; drop when fixed upstream */

View File

@ -20,7 +20,7 @@
#include "at86rf215.h"
#include "at86rf215_internal.h"
#define ENABLE_DEBUG (0)
#define ENABLE_DEBUG 0
#include "debug.h"
/* symbol time is always 20 µs for MR-FSK (table 0, pg. 7) */

View File

@ -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;
}

View File

@ -20,6 +20,7 @@
#include <stdlib.h>
#include <string.h>
#include "kernel_defines.h"
#include "liblwm2m.h"
#include "objects/device.h"
#include "lwm2m_client_config.h"
@ -77,7 +78,7 @@ static uint8_t prv_device_discover(uint16_t instance_id, int *num_dataP,
LWM2M_RES_BINDINGS, LWM2M_RES_TYPE, LWM2M_RES_HW_VERSION,
LWM2M_RES_SW_VERSION,
};
int len = sizeof(res) / sizeof(uint16_t);
int len = ARRAY_SIZE(res);
*data_arrayP = lwm2m_data_new(len);
if (*data_arrayP == NULL) {
@ -136,7 +137,7 @@ static uint8_t prv_device_read(uint16_t instance_id, int *num_dataP,
LWM2M_RES_FW_VER, LWM2M_RES_HW_VERSION, LWM2M_RES_SW_VERSION,
LWM2M_RES_BINDINGS, LWM2M_RES_TYPE, LWM2M_RES_ERROR_CODE,
};
int cnt = sizeof(resList) / sizeof(uint16_t);
int cnt = ARRAY_SIZE(resList);
*data_arrayP = lwm2m_data_new(cnt);
if (*data_arrayP == NULL) {
result = COAP_500_INTERNAL_SERVER_ERROR;

View File

@ -441,7 +441,7 @@ int _nimble_netif_handler(int argc, char **argv)
if (!fmt_is_number(argv[2])) {
unsigned duration = DEFAULT_SCAN_DURATION;
if (argc > 3) {
duration = (unsigned)atoi(argv[3]);
duration = atoi(argv[3]);
}
_cmd_connect_name(argv[2], duration * 1000);
return 0;

View File

@ -101,7 +101,7 @@ static void test_clif_encode_links(void)
res = clif_encode_link(&links[0], NULL, 0);
pos += res;
for (unsigned i = 1; i < sizeof(links) / sizeof(links[0]); i++) {
for (unsigned i = 1; i < ARRAY_SIZE(links); i++) {
res = clif_add_link_separator(NULL, 0);
if (res <= 0) {
break;
@ -122,7 +122,7 @@ static void test_clif_encode_links(void)
res = clif_encode_link(&links[0], output, sizeof(output));
pos += res;
for (unsigned i = 1; i < sizeof(links) / sizeof(links[0]); i++) {
for (unsigned i = 1; i < ARRAY_SIZE(links); i++) {
res = clif_add_link_separator(&output[pos], sizeof(output) - pos);
if (res <= 0) {
break;
@ -195,8 +195,8 @@ static void test_clif_decode_links(void)
"http://www.example.com/sensors/t123", "/t", "/riot/board", "/riot/info"
};
const unsigned exp_links_numof = sizeof(exp_targets) / sizeof(exp_targets[0]);
const unsigned exp_attrs_numof = sizeof(exp_attrs) / sizeof(exp_attrs[0]);
const unsigned exp_links_numof = ARRAY_SIZE(exp_targets);
const unsigned exp_attrs_numof = ARRAY_SIZE(exp_attrs);
const size_t input_len = sizeof(input_string) - 1;
clif_t out_link;
@ -229,7 +229,7 @@ static void test_clif_decode_links(void)
TEST_ASSERT(exp_links_numof == links_numof);
/* now decode again but saving the attributes */
clif_attr_t out_attrs[sizeof(exp_attrs) / sizeof(exp_attrs[0])];
clif_attr_t out_attrs[ARRAY_SIZE(exp_attrs)];
pos = input_string;
unsigned attrs_numof = 0;
do {