From dfcbadf758987895169181f739b20d3992a4250c Mon Sep 17 00:00:00 2001 From: enriquezgarc Date: Tue, 1 Aug 2023 11:29:03 +0200 Subject: [PATCH] ports/psoc6/modules/machine/machine_adcblock: Fixed NULL prt. Signed-off-by: enriquezgarc --- ports/psoc6/modules/machine/machine_adcblock.c | 6 ++++-- 1 file changed, 4 insertions(+), 2 deletions(-) diff --git a/ports/psoc6/modules/machine/machine_adcblock.c b/ports/psoc6/modules/machine/machine_adcblock.c index 8f41ab6d6bfe..76ece0a9f18a 100644 --- a/ports/psoc6/modules/machine/machine_adcblock.c +++ b/ports/psoc6/modules/machine/machine_adcblock.c @@ -238,8 +238,10 @@ STATIC MP_DEFINE_CONST_FUN_OBJ_KW(machine_adcblock_connect_obj, 2, machine_adcbl void adcblock_deinit(void) { for (uint8_t i = 0; i < MAX_BLOCKS; i++) { - cyhal_adc_free(&adc_block[i]->adc_block_obj); - adc_block[i] = NULL; + if (adc_block[i] != NULL) { + cyhal_adc_free(&adc_block[i]->adc_block_obj); + adc_block[i] = NULL; + } } }