From ae5655b88bdcb17abf1f988e3e8e7ed2771fc9f3 Mon Sep 17 00:00:00 2001 From: Joel Sherrill Date: Tue, 22 Apr 2025 17:19:08 -0500 Subject: [PATCH] bsps/arm/stm32h7/hal/*: Fix pointer and integer comparison warnings The HAL code would compare to "0U" instead of NULL. Updates &20 --- bsps/arm/stm32h7/hal/stm32h7xx_hal_dma.c | 24 +++++++++++++++++++++ bsps/arm/stm32h7/hal/stm32h7xx_hal_dma_ex.c | 24 +++++++++++++++++++++ 2 files changed, 48 insertions(+) diff --git a/bsps/arm/stm32h7/hal/stm32h7xx_hal_dma.c b/bsps/arm/stm32h7/hal/stm32h7xx_hal_dma.c index 7bfc087228..6e335a017e 100644 --- a/bsps/arm/stm32h7/hal/stm32h7xx_hal_dma.c +++ b/bsps/arm/stm32h7/hal/stm32h7xx_hal_dma.c @@ -543,7 +543,11 @@ HAL_StatusTypeDef HAL_DMA_DeInit(DMA_HandleTypeDef *hdma) DMAmuxChannel, DMAmuxChannelStatus and DMAmuxChannelStatusMask */ DMA_CalcDMAMUXChannelBaseAndMask(hdma); +#if defined(__rtems__) + if(hdma->DMAmuxChannel != NULL) +#else if(hdma->DMAmuxChannel != 0U) +#endif { /* Resett he DMAMUX channel that corresponds to the DMA stream */ hdma->DMAmuxChannel->CCR = 0U; @@ -741,7 +745,11 @@ HAL_StatusTypeDef HAL_DMA_Start_IT(DMA_HandleTypeDef *hdma, uint32_t SrcAddress, hdma->DMAmuxChannel->CCR |= DMAMUX_CxCR_SOIE; } +#if defined(__rtems__) + if(hdma->DMAmuxRequestGen != NULL) +#else if(hdma->DMAmuxRequestGen != 0U) +#endif { /* if using DMAMUX request generator, enable the DMAMUX request generator overrun IT*/ /* enable the request gen overrun IT */ @@ -868,7 +876,11 @@ HAL_StatusTypeDef HAL_DMA_Abort(DMA_HandleTypeDef *hdma) /* Clear the DMAMUX synchro overrun flag */ hdma->DMAmuxChannelStatus->CFR = hdma->DMAmuxChannelStatusMask; +#if defined(__rtems__) + if(hdma->DMAmuxRequestGen != NULL) +#else if(hdma->DMAmuxRequestGen != 0U) +#endif { /* if using DMAMUX request generator, disable the DMAMUX request generator overrun IT */ /* disable the request gen overrun IT */ @@ -940,7 +952,11 @@ HAL_StatusTypeDef HAL_DMA_Abort_IT(DMA_HandleTypeDef *hdma) /* Clear the DMAMUX synchro overrun flag */ hdma->DMAmuxChannelStatus->CFR = hdma->DMAmuxChannelStatusMask; +#if defined(__rtems__) + if(hdma->DMAmuxRequestGen != NULL) +#else if(hdma->DMAmuxRequestGen != 0U) +#endif { /* if using DMAMUX request generator, disable the DMAMUX request generator overrun IT*/ /* disable the request gen overrun IT */ @@ -1140,7 +1156,11 @@ HAL_StatusTypeDef HAL_DMA_PollForTransfer(DMA_HandleTypeDef *hdma, HAL_DMA_Level if(IS_DMA_DMAMUX_ALL_INSTANCE(hdma->Instance) != 0U) /* No DMAMUX available for BDMA1 */ { /* Check for DMAMUX Request generator (if used) overrun status */ +#if defined(__rtems__) + if(hdma->DMAmuxRequestGen != NULL) +#else if(hdma->DMAmuxRequestGen != 0U) +#endif { /* if using DMAMUX request generator Check for DMAMUX request generator overrun */ if((hdma->DMAmuxRequestGenStatus->RGSR & hdma->DMAmuxRequestGenStatusMask) != 0U) @@ -1782,7 +1802,11 @@ static void DMA_SetConfig(DMA_HandleTypeDef *hdma, uint32_t SrcAddress, uint32_t /* Clear the DMAMUX synchro overrun flag */ hdma->DMAmuxChannelStatus->CFR = hdma->DMAmuxChannelStatusMask; +#if defined(__rtems__) + if(hdma->DMAmuxRequestGen != NULL) +#else if(hdma->DMAmuxRequestGen != 0U) +#endif { /* Clear the DMAMUX request generator overrun flag */ hdma->DMAmuxRequestGenStatus->RGCFR = hdma->DMAmuxRequestGenStatusMask; diff --git a/bsps/arm/stm32h7/hal/stm32h7xx_hal_dma_ex.c b/bsps/arm/stm32h7/hal/stm32h7xx_hal_dma_ex.c index 7c2b680b19..e0cf178e82 100644 --- a/bsps/arm/stm32h7/hal/stm32h7xx_hal_dma_ex.c +++ b/bsps/arm/stm32h7/hal/stm32h7xx_hal_dma_ex.c @@ -183,7 +183,11 @@ HAL_StatusTypeDef HAL_DMAEx_MultiBufferStart(DMA_HandleTypeDef *hdma, uint32_t S /* Clear the DMAMUX synchro overrun flag */ hdma->DMAmuxChannelStatus->CFR = hdma->DMAmuxChannelStatusMask; +#if defined(__rtems__) + if(hdma->DMAmuxRequestGen != NULL) +#else if(hdma->DMAmuxRequestGen != 0U) +#endif { /* Clear the DMAMUX request generator overrun flag */ hdma->DMAmuxRequestGenStatus->RGCFR = hdma->DMAmuxRequestGenStatusMask; @@ -279,7 +283,11 @@ HAL_StatusTypeDef HAL_DMAEx_MultiBufferStart_IT(DMA_HandleTypeDef *hdma, uint32_ /* Clear the DMAMUX synchro overrun flag */ hdma->DMAmuxChannelStatus->CFR = hdma->DMAmuxChannelStatusMask; +#if defined(__rtems__) + if(hdma->DMAmuxRequestGen != NULL) +#else if(hdma->DMAmuxRequestGen != 0U) +#endif { /* Clear the DMAMUX request generator overrun flag */ hdma->DMAmuxRequestGenStatus->RGCFR = hdma->DMAmuxRequestGenStatusMask; @@ -319,7 +327,11 @@ HAL_StatusTypeDef HAL_DMAEx_MultiBufferStart_IT(DMA_HandleTypeDef *hdma, uint32_ hdma->DMAmuxChannel->CCR |= DMAMUX_CxCR_SOIE; } +#if defined(__rtems__) + if(hdma->DMAmuxRequestGen != NULL) +#else if(hdma->DMAmuxRequestGen != 0U) +#endif { /* if using DMAMUX request generator, enable the DMAMUX request generator overrun IT*/ /* enable the request gen overrun IT*/ @@ -486,7 +498,11 @@ HAL_StatusTypeDef HAL_DMAEx_ConfigMuxRequestGenerator (DMA_HandleTypeDef *hdma, /* check if the DMA state is ready and DMA is using a DMAMUX request generator block */ +#if defined(__rtems__) + if(hdma->DMAmuxRequestGen == NULL) +#else if(hdma->DMAmuxRequestGen == 0U) +#endif { /* Set the error code to busy */ hdma->ErrorCode = HAL_DMA_ERROR_PARAM; @@ -535,7 +551,11 @@ HAL_StatusTypeDef HAL_DMAEx_EnableMuxRequestGenerator (DMA_HandleTypeDef *hdma) /* check if the DMA state is ready and DMA is using a DMAMUX request generator block */ +#if defined(__rtems__) + if((hdma->State != HAL_DMA_STATE_RESET) && (hdma->DMAmuxRequestGen != NULL)) +#else if((hdma->State != HAL_DMA_STATE_RESET) && (hdma->DMAmuxRequestGen != 0U)) +#endif { /* Enable the request generator*/ hdma->DMAmuxRequestGen->RGCR |= DMAMUX_RGxCR_GE; @@ -561,7 +581,11 @@ HAL_StatusTypeDef HAL_DMAEx_DisableMuxRequestGenerator (DMA_HandleTypeDef *hdma) /* check if the DMA state is ready and DMA is using a DMAMUX request generator block */ +#if defined(__rtems__) + if((hdma->State != HAL_DMA_STATE_RESET) && (hdma->DMAmuxRequestGen != NULL)) +#else if((hdma->State != HAL_DMA_STATE_RESET) && (hdma->DMAmuxRequestGen != 0U)) +#endif { /* Disable the request generator*/ hdma->DMAmuxRequestGen->RGCR &= ~DMAMUX_RGxCR_GE;