避免警告,变量可能未初始化就使用 (#5544)
* 避免警告,变量可能未初始化就使用 * 避免警告,变量可能未初始化就使用 * 避免警告,变化可能未初始化就使用。 * Update bsp/stm32/libraries/HAL_Drivers/drv_usart.c Co-authored-by: guo <guozhanxin@rt-thread.com> * Update bsp/stm32/libraries/HAL_Drivers/drv_usart_v2.c Co-authored-by: guo <guozhanxin@rt-thread.com> Co-authored-by: guo <guozhanxin@rt-thread.com>
This commit is contained in:
parent
b5de986122
commit
03f46c6694
|
@ -918,6 +918,7 @@ static void stm32_dma_config(struct rt_serial_device *serial, rt_ubase_t flag)
|
|||
struct stm32_uart *uart;
|
||||
|
||||
RT_ASSERT(serial != RT_NULL);
|
||||
RT_ASSERT(flag == RT_DEVICE_FLAG_DMA_TX || flag == RT_DEVICE_FLAG_DMA_RX);
|
||||
uart = rt_container_of(serial, struct stm32_uart, serial);
|
||||
|
||||
if (RT_DEVICE_FLAG_DMA_RX == flag)
|
||||
|
@ -925,7 +926,7 @@ static void stm32_dma_config(struct rt_serial_device *serial, rt_ubase_t flag)
|
|||
DMA_Handle = &uart->dma_rx.handle;
|
||||
dma_config = uart->config->dma_rx;
|
||||
}
|
||||
else if (RT_DEVICE_FLAG_DMA_TX == flag)
|
||||
else /* RT_DEVICE_FLAG_DMA_TX == flag */
|
||||
{
|
||||
DMA_Handle = &uart->dma_tx.handle;
|
||||
dma_config = uart->config->dma_tx;
|
||||
|
|
|
@ -959,6 +959,7 @@ static void stm32_dma_config(struct rt_serial_device *serial, rt_ubase_t flag)
|
|||
struct stm32_uart *uart;
|
||||
|
||||
RT_ASSERT(serial != RT_NULL);
|
||||
RT_ASSERT(flag == RT_DEVICE_FLAG_DMA_TX || flag == RT_DEVICE_FLAG_DMA_RX);
|
||||
uart = rt_container_of(serial, struct stm32_uart, serial);
|
||||
|
||||
if (RT_DEVICE_FLAG_DMA_RX == flag)
|
||||
|
@ -966,7 +967,7 @@ static void stm32_dma_config(struct rt_serial_device *serial, rt_ubase_t flag)
|
|||
DMA_Handle = &uart->dma_rx.handle;
|
||||
dma_config = uart->config->dma_rx;
|
||||
}
|
||||
else if (RT_DEVICE_FLAG_DMA_TX == flag)
|
||||
else /* RT_DEVICE_FLAG_DMA_TX == flag */
|
||||
{
|
||||
DMA_Handle = &uart->dma_tx.handle;
|
||||
dma_config = uart->config->dma_tx;
|
||||
|
|
Loading…
Reference in New Issue