STMicroelectronics / stm32-mw-fatfs

Provides the FatFS library part of the STM32Cube MCU Component "middleware" for all STM32xx series.
BSD 3-Clause "New" or "Revised" License
16 stars 8 forks source link

Incorrect usage of osMessageQueuePut #4

Closed armandas closed 11 months ago

armandas commented 2 years ago

This issue is present in code generated by CubeMX 6.6.1.

The following lines all pass NULL to the uint8_t msg_prio parameter, causing a compiler warning:

warning: passing argument 3 of 'osMessageQueuePut' makes integer from pointer without a cast [-Wint-conversion]

https://github.com/STMicroelectronics/stm32_mw_fatfs/blob/5042a94556d1c4477642fc6b09450725d18ab5e8/src/drivers/sd_diskio_dma_rtos_template_bspv2.c#L615

https://github.com/STMicroelectronics/stm32_mw_fatfs/blob/5042a94556d1c4477642fc6b09450725d18ab5e8/src/drivers/sd_diskio_dma_rtos_template_bspv2.c#L637

https://github.com/STMicroelectronics/stm32_mw_fatfs/blob/5042a94556d1c4477642fc6b09450725d18ab5e8/src/drivers/sd_diskio_dma_rtos_template_bspv2.c#L650

The issue may be due to some copy-paste programming. The osMessageQueueGet API does take a pointer:

osStatus_t osMessageQueueGet (osMessageQueueId_t mq_id, void *msg_ptr, uint8_t *msg_prio, uint32_t timeout)

but osMessageQueuePut takes the msg_prio by value:

osStatus_t osMessageQueuePut (osMessageQueueId_t mq_id, const void *msg_ptr, uint8_t msg_prio, uint32_t timeout)
HBOSTM commented 1 year ago

ST Internal Reference: 97597