bsps/stm32u5: Fix warnings in HAL

The HAL has a few comparisons of a pointer with 0U instead of NULL. This
patch fixes that.

Fixes #5289
This commit is contained in:
Christian Mauderer
2025-07-07 10:51:35 +02:00
committed by Amar Takhar
parent 3ac0e3c77e
commit 317cfa50d0
5 changed files with 42 additions and 0 deletions

View File

@@ -424,7 +424,11 @@ HAL_StatusTypeDef HAL_DCMI_Start_DMA(DCMI_HandleTypeDef *hdcmi, uint32_t DCMI_Mo
/* Enable the DMA Stream */ /* Enable the DMA Stream */
if ((hdcmi->DMA_Handle->Mode & DMA_LINKEDLIST) == DMA_LINKEDLIST) if ((hdcmi->DMA_Handle->Mode & DMA_LINKEDLIST) == DMA_LINKEDLIST)
{ {
#ifndef __rtems__
if ((hdcmi->DMA_Handle->LinkedListQueue != 0U) && (hdcmi->DMA_Handle->LinkedListQueue->Head != 0U)) if ((hdcmi->DMA_Handle->LinkedListQueue != 0U) && (hdcmi->DMA_Handle->LinkedListQueue->Head != 0U))
#else /* __rtems__ */
if ((hdcmi->DMA_Handle->LinkedListQueue != NULL) && (hdcmi->DMA_Handle->LinkedListQueue->Head != NULL))
#endif /* __rtems__ */
{ {
/* Set Source , Destination , Length for DMA Xfer */ /* Set Source , Destination , Length for DMA Xfer */
@@ -478,7 +482,11 @@ HAL_StatusTypeDef HAL_DCMI_Start_DMA(DCMI_HandleTypeDef *hdcmi, uint32_t DCMI_Mo
if ((hdcmi->DMA_Handle->Mode & DMA_LINKEDLIST) == DMA_LINKEDLIST) if ((hdcmi->DMA_Handle->Mode & DMA_LINKEDLIST) == DMA_LINKEDLIST)
{ {
#ifndef __rtems__
if ((hdcmi->DMA_Handle->LinkedListQueue != 0U) && (hdcmi->DMA_Handle->LinkedListQueue->Head != 0U)) if ((hdcmi->DMA_Handle->LinkedListQueue != 0U) && (hdcmi->DMA_Handle->LinkedListQueue->Head != 0U))
#else /* __rtems__ */
if ((hdcmi->DMA_Handle->LinkedListQueue != NULL) && (hdcmi->DMA_Handle->LinkedListQueue->Head != NULL))
#endif /* __rtems__ */
{ {
/* Update first node */ /* Update first node */

View File

@@ -2961,7 +2961,11 @@ HAL_StatusTypeDef HAL_DMAEx_List_ConvertQToDynamic(DMA_QListTypeDef *const pQLis
DMA_List_GetCLLRNodeInfo(pQList->Head, NULL, &cllr_offset); DMA_List_GetCLLRNodeInfo(pQList->Head, NULL, &cllr_offset);
/* Check queue circularity */ /* Check queue circularity */
#ifndef __rtems__
if (pQList->FirstCircularNode != 0U) if (pQList->FirstCircularNode != 0U)
#else /* __rtems__ */
if (pQList->FirstCircularNode != NULL)
#endif /* __rtems__ */
{ {
/* Find the last queue node and get its position in selected queue */ /* Find the last queue node and get its position in selected queue */
node_info.cllr_offset = cllr_offset; node_info.cllr_offset = cllr_offset;
@@ -4591,7 +4595,11 @@ static void DMA_List_UpdateDynamicQueueNodesCLLR(DMA_QListTypeDef const *const p
} }
/* Check queue circularity */ /* Check queue circularity */
#ifndef __rtems__
if (pQList->FirstCircularNode != 0U) if (pQList->FirstCircularNode != 0U)
#else /* __rtems__ */
if (pQList->FirstCircularNode != NULL)
#endif /* __rtems__ */
{ {
/* First circular queue is not last queue node */ /* First circular queue is not last queue node */
if (LastNode_IsCircular == 0U) if (LastNode_IsCircular == 0U)

View File

@@ -3709,7 +3709,11 @@ HAL_StatusTypeDef LPTIM_DMA_Start_IT(DMA_HandleTypeDef *hdma, uint32_t src, uint
/* Enable the DMA channel */ /* Enable the DMA channel */
if ((hdma->Mode & DMA_LINKEDLIST) == DMA_LINKEDLIST) if ((hdma->Mode & DMA_LINKEDLIST) == DMA_LINKEDLIST)
{ {
#ifndef __rtems__
if ((hdma->LinkedListQueue != 0U) && (hdma->LinkedListQueue->Head != 0U)) if ((hdma->LinkedListQueue != 0U) && (hdma->LinkedListQueue->Head != 0U))
#else /* __rtems__ */
if ((hdma->LinkedListQueue != NULL) && (hdma->LinkedListQueue->Head != NULL))
#endif /* __rtems__ */
{ {
/* Enable the DMA channel */ /* Enable the DMA channel */
hdma->LinkedListQueue->Head->LinkRegisters[NODE_CBR1_DEFAULT_OFFSET] = length; hdma->LinkedListQueue->Head->LinkRegisters[NODE_CBR1_DEFAULT_OFFSET] = length;

View File

@@ -686,7 +686,11 @@ HAL_StatusTypeDef HAL_SRAM_Read_DMA(SRAM_HandleTypeDef *hsram, uint32_t *pAddres
if ((hsram->hdma->Mode & DMA_LINKEDLIST) == DMA_LINKEDLIST) if ((hsram->hdma->Mode & DMA_LINKEDLIST) == DMA_LINKEDLIST)
{ {
#ifndef __rtems__
if ((hsram->hdma->LinkedListQueue != 0U) && (hsram->hdma->LinkedListQueue->Head != 0U)) if ((hsram->hdma->LinkedListQueue != 0U) && (hsram->hdma->LinkedListQueue->Head != 0U))
#else /* __rtems__ */
if ((hsram->hdma->LinkedListQueue != NULL) && (hsram->hdma->LinkedListQueue->Head != NULL))
#endif /* __rtems__ */
{ {
/* Check destination data width and set the size to be transferred */ /* Check destination data width and set the size to be transferred */
data_width = hsram->hdma->LinkedListQueue->Head->LinkRegisters[NODE_CTR1_DEFAULT_OFFSET] & DMA_CTR1_DDW_LOG2; data_width = hsram->hdma->LinkedListQueue->Head->LinkRegisters[NODE_CTR1_DEFAULT_OFFSET] & DMA_CTR1_DDW_LOG2;
@@ -788,7 +792,11 @@ HAL_StatusTypeDef HAL_SRAM_Write_DMA(SRAM_HandleTypeDef *hsram, uint32_t *pAddre
if ((hsram->hdma->Mode & DMA_LINKEDLIST) == DMA_LINKEDLIST) if ((hsram->hdma->Mode & DMA_LINKEDLIST) == DMA_LINKEDLIST)
{ {
#ifndef __rtems__
if ((hsram->hdma->LinkedListQueue != 0U) && (hsram->hdma->LinkedListQueue->Head != 0U)) if ((hsram->hdma->LinkedListQueue != 0U) && (hsram->hdma->LinkedListQueue->Head != 0U))
#else /* __rtems__ */
if ((hsram->hdma->LinkedListQueue != NULL) && (hsram->hdma->LinkedListQueue->Head != NULL))
#endif /* __rtems__ */
{ {
/* Check destination data width and set the size to be transferred */ /* Check destination data width and set the size to be transferred */
data_width = hsram->hdma->LinkedListQueue->Head->LinkRegisters[NODE_CTR1_DEFAULT_OFFSET] & DMA_CTR1_DDW_LOG2; data_width = hsram->hdma->LinkedListQueue->Head->LinkRegisters[NODE_CTR1_DEFAULT_OFFSET] & DMA_CTR1_DDW_LOG2;

View File

@@ -4690,8 +4690,13 @@ HAL_StatusTypeDef HAL_TIM_DMABurst_WriteStart(TIM_HandleTypeDef *htim, uint32_t
if (hdma != NULL) if (hdma != NULL)
{ {
#ifndef __rtems__
if (((hdma->Mode & DMA_LINKEDLIST) == DMA_LINKEDLIST) && (hdma->LinkedListQueue != 0U) if (((hdma->Mode & DMA_LINKEDLIST) == DMA_LINKEDLIST) && (hdma->LinkedListQueue != 0U)
&& (hdma->LinkedListQueue->Head != 0U)) && (hdma->LinkedListQueue->Head != 0U))
#else /* __rtems__ */
if (((hdma->Mode & DMA_LINKEDLIST) == DMA_LINKEDLIST) && (hdma->LinkedListQueue != NULL)
&& (hdma->LinkedListQueue->Head != NULL))
#endif /* __rtems__ */
{ {
data_width = hdma->LinkedListQueue->Head->LinkRegisters[0] & DMA_CTR1_SDW_LOG2; data_width = hdma->LinkedListQueue->Head->LinkRegisters[0] & DMA_CTR1_SDW_LOG2;
} }
@@ -5145,8 +5150,13 @@ HAL_StatusTypeDef HAL_TIM_DMABurst_ReadStart(TIM_HandleTypeDef *htim, uint32_t B
if (hdma != NULL) if (hdma != NULL)
{ {
#ifndef __rtems__
if (((hdma->Mode & DMA_LINKEDLIST) == DMA_LINKEDLIST) && (hdma->LinkedListQueue != 0U) if (((hdma->Mode & DMA_LINKEDLIST) == DMA_LINKEDLIST) && (hdma->LinkedListQueue != 0U)
&& (hdma->LinkedListQueue->Head != 0U)) && (hdma->LinkedListQueue->Head != 0U))
#else /* __rtems__ */
if (((hdma->Mode & DMA_LINKEDLIST) == DMA_LINKEDLIST) && (hdma->LinkedListQueue != NULL)
&& (hdma->LinkedListQueue->Head != NULL))
#endif /* __rtems__ */
{ {
data_width = hdma->LinkedListQueue->Head->LinkRegisters[0] & DMA_CTR1_SDW_LOG2; data_width = hdma->LinkedListQueue->Head->LinkRegisters[0] & DMA_CTR1_SDW_LOG2;
} }
@@ -6082,7 +6092,11 @@ HAL_StatusTypeDef TIM_DMA_Start_IT(DMA_HandleTypeDef *hdma, uint32_t src, uint32
/* Enable the DMA channel */ /* Enable the DMA channel */
if ((hdma->Mode & DMA_LINKEDLIST) == DMA_LINKEDLIST) if ((hdma->Mode & DMA_LINKEDLIST) == DMA_LINKEDLIST)
{ {
#ifndef __rtems__
if ((hdma->LinkedListQueue != 0U) && (hdma->LinkedListQueue->Head != 0U)) if ((hdma->LinkedListQueue != 0U) && (hdma->LinkedListQueue->Head != 0U))
#else /* __rtems__ */
if ((hdma->LinkedListQueue != NULL) && (hdma->LinkedListQueue->Head != NULL))
#endif /* __rtems__ */
{ {
/* Enable the DMA channel */ /* Enable the DMA channel */
hdma->LinkedListQueue->Head->LinkRegisters[NODE_CBR1_DEFAULT_OFFSET] = length; hdma->LinkedListQueue->Head->LinkRegisters[NODE_CBR1_DEFAULT_OFFSET] = length;