From 314f4c665f746ebec3be69a8e26f0a671cfdcb46 Mon Sep 17 00:00:00 2001 From: Antonio Borneo Date: Sun, 9 Apr 2023 00:33:38 +0200 Subject: [PATCH] rtos: with pointers, use NULL instead of 0 Don't compare pointers with 0, use NULL when needed. Don't assign pointer to 0, use NULL. Detected through 'sparse' tool. Change-Id: Ifa81ba961c0d490cc74880b4a46b620e6358f779 Signed-off-by: Antonio Borneo Reviewed-on: https://review.openocd.org/c/openocd/+/7598 Tested-by: jenkins --- src/rtos/chibios.c | 8 ++++---- 1 file changed, 4 insertions(+), 4 deletions(-) diff --git a/src/rtos/chibios.c b/src/rtos/chibios.c index 68fe8a14c..20378274e 100644 --- a/src/rtos/chibios.c +++ b/src/rtos/chibios.c @@ -80,12 +80,12 @@ struct chibios_params { static struct chibios_params chibios_params_list[] = { { "cortex_m", /* target_name */ - 0, + NULL, NULL, /* stacking_info */ }, { "hla_target", /* target_name */ - 0, + NULL, NULL, /* stacking_info */ } }; @@ -198,7 +198,7 @@ static int chibios_update_memory_signature(struct rtos *rtos) errfree: /* Error reading the ChibiOS memory structure */ free(signature); - param->signature = 0; + param->signature = NULL; return -1; } @@ -468,7 +468,7 @@ static int chibios_get_thread_reg_list(struct rtos *rtos, int64_t thread_id, return -1; /* Update stacking if it can only be determined from runtime information */ - if ((param->stacking_info == 0) && + if (!param->stacking_info && (chibios_update_stacking(rtos) != ERROR_OK)) { LOG_ERROR("Failed to determine exact stacking for the target type %s", rtos->target->type->name); return -1;