Skip to content

Commit 2590ab6

Browse files
committed
debug: cpu_load: Fix usage of nrfx error codes
Since nrfx 4, driver APIs return errno values. Comparing against NRFX_SUCCESS is therefore wrong. Unfortunately such cases cannot be found by enabling compiler warnings. Signed-off-by: Rubin Gerritsen <[email protected]>
1 parent 1685011 commit 2590ab6

File tree

2 files changed

+4
-4
lines changed

2 files changed

+4
-4
lines changed

subsys/debug/cpu_load/cpu_load.c

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -99,7 +99,7 @@ static int ppi_setup(uint32_t eep, uint32_t tep)
9999

100100
int cpu_load_init_internal(void)
101101
{
102-
nrfx_err_t err;
102+
int err;
103103
uint32_t base_frequency = NRF_TIMER_BASE_FREQUENCY_GET(timer.p_reg);
104104
nrfx_timer_config_t config = NRFX_TIMER_DEFAULT_CONFIG(base_frequency);
105105
int ret = 0;
@@ -135,7 +135,7 @@ int cpu_load_init_internal(void)
135135
}
136136

137137
err = nrfx_timer_init(&timer, &config, timer_handler);
138-
if (err != NRFX_SUCCESS) {
138+
if (err != 0) {
139139
return -EBUSY;
140140
}
141141

tests/subsys/debug/cpu_load/src/test_cpu_load.c

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -21,7 +21,7 @@ static void timer_handler(nrf_timer_event_t event_type, void *context)
2121

2222
static int dppi_shared_resources_init(void)
2323
{
24-
nrfx_err_t err;
24+
int err;
2525
static nrfx_timer_t timer = NRFX_TIMER_INSTANCE(NRF_TIMER1);
2626
uint32_t base_frequency = NRF_TIMER_BASE_FREQUENCY_GET(timer.p_reg);
2727
nrfx_timer_config_t config = NRFX_TIMER_DEFAULT_CONFIG(base_frequency);
@@ -35,7 +35,7 @@ static int dppi_shared_resources_init(void)
3535
config.bit_width = NRF_TIMER_BIT_WIDTH_32;
3636

3737
err = nrfx_timer_init(&timer, &config, timer_handler);
38-
zassert_equal(err, NRFX_SUCCESS, "Unexpected error:%d", err);
38+
zassert_equal(err, 0, "Unexpected error:%d", err);
3939

4040
rv = nrfx_gppi_conn_alloc(evt, tsk, &handle);
4141
zassert_equal(rv, 0);

0 commit comments

Comments
 (0)