Skip to content

Commit

Permalink
ext/hal: stm32f2xx: Fix warnings for extraneous parentheses
Browse files Browse the repository at this point in the history
Building with clang reports the following warnings:

stm32f2xx_hal_tim.c: error: equality comparison with extraneous
parentheses [-Werror,-Wparentheses-equality]
  else if((htim->State == HAL_TIM_STATE_READY))
           ~~~~~~~~~~~~^~~~~~~~~~~~~~~~~~~~~~

Removing the extra () fixes the warning

Signed-off-by: Kumar Gala <kumar.gala@linaro.org>
  • Loading branch information
galak committed Apr 17, 2019
1 parent a51bfc8 commit 198387d
Show file tree
Hide file tree
Showing 3 changed files with 28 additions and 20 deletions.
8 changes: 8 additions & 0 deletions ext/hal/st/stm32cube/stm32f2xx/README
Original file line number Diff line number Diff line change
Expand Up @@ -55,3 +55,11 @@ Patch List:
Impacted files:
drivers/include/stm32f2xx_ll_usb.c
ST Bug tracker ID: 61324

*Fix warnings for extraneous parentheses
Using clang 7.0.1, if ((htim->State == HAL_TIM_STATE_BUSY))
generates warnings. Remove the extra parentheses
Impacted files:
drivers/src/stm32f2xx_hal_tim.c
drivers/src/stm32f2xx_hal_tim_ex.c
ST Bug tracker ID: 63615
28 changes: 14 additions & 14 deletions ext/hal/st/stm32cube/stm32f2xx/drivers/src/stm32f2xx_hal_tim.c
Original file line number Diff line number Diff line change
Expand Up @@ -397,11 +397,11 @@ HAL_StatusTypeDef HAL_TIM_Base_Start_DMA(TIM_HandleTypeDef *htim, uint32_t *pDat
/* Check the parameters */
assert_param(IS_TIM_DMA_INSTANCE(htim->Instance));

if((htim->State == HAL_TIM_STATE_BUSY))
if(htim->State == HAL_TIM_STATE_BUSY)
{
return HAL_BUSY;
}
else if((htim->State == HAL_TIM_STATE_READY))
else if(htim->State == HAL_TIM_STATE_READY)
{
if((pData == 0U ) && (Length > 0))
{
Expand Down Expand Up @@ -797,11 +797,11 @@ HAL_StatusTypeDef HAL_TIM_OC_Start_DMA(TIM_HandleTypeDef *htim, uint32_t Channel
/* Check the parameters */
assert_param(IS_TIM_CCX_INSTANCE(htim->Instance, Channel));

if((htim->State == HAL_TIM_STATE_BUSY))
if(htim->State == HAL_TIM_STATE_BUSY)
{
return HAL_BUSY;
}
else if((htim->State == HAL_TIM_STATE_READY))
else if(htim->State == HAL_TIM_STATE_READY)
{
if(((uint32_t)pData == 0U ) && (Length > 0))
{
Expand Down Expand Up @@ -1313,11 +1313,11 @@ HAL_StatusTypeDef HAL_TIM_PWM_Start_DMA(TIM_HandleTypeDef *htim, uint32_t Channe
/* Check the parameters */
assert_param(IS_TIM_CCX_INSTANCE(htim->Instance, Channel));

if((htim->State == HAL_TIM_STATE_BUSY))
if(htim->State == HAL_TIM_STATE_BUSY)
{
return HAL_BUSY;
}
else if((htim->State == HAL_TIM_STATE_READY))
else if(htim->State == HAL_TIM_STATE_READY)
{
if(((uint32_t)pData == 0U ) && (Length > 0))
{
Expand Down Expand Up @@ -1802,11 +1802,11 @@ HAL_StatusTypeDef HAL_TIM_IC_Start_DMA(TIM_HandleTypeDef *htim, uint32_t Channel
assert_param(IS_TIM_CCX_INSTANCE(htim->Instance, Channel));
assert_param(IS_TIM_DMA_CC_INSTANCE(htim->Instance));

if((htim->State == HAL_TIM_STATE_BUSY))
if(htim->State == HAL_TIM_STATE_BUSY)
{
return HAL_BUSY;
}
else if((htim->State == HAL_TIM_STATE_READY))
else if(htim->State == HAL_TIM_STATE_READY)
{
if((pData == 0U ) && (Length > 0))
{
Expand Down Expand Up @@ -2638,11 +2638,11 @@ HAL_StatusTypeDef HAL_TIM_Encoder_Start_DMA(TIM_HandleTypeDef *htim, uint32_t Ch
/* Check the parameters */
assert_param(IS_TIM_DMA_CC_INSTANCE(htim->Instance));

if((htim->State == HAL_TIM_STATE_BUSY))
if(htim->State == HAL_TIM_STATE_BUSY)
{
return HAL_BUSY;
}
else if((htim->State == HAL_TIM_STATE_READY))
else if(htim->State == HAL_TIM_STATE_READY)
{
if((((pData1 == 0U) || (pData2 == 0U) )) && (Length > 0))
{
Expand Down Expand Up @@ -3391,11 +3391,11 @@ HAL_StatusTypeDef HAL_TIM_DMABurst_WriteStart(TIM_HandleTypeDef *htim, uint32_t
assert_param(IS_TIM_DMA_SOURCE(BurstRequestSrc));
assert_param(IS_TIM_DMA_LENGTH(BurstLength));

if((htim->State == HAL_TIM_STATE_BUSY))
if(htim->State == HAL_TIM_STATE_BUSY)
{
return HAL_BUSY;
}
else if((htim->State == HAL_TIM_STATE_READY))
else if(htim->State == HAL_TIM_STATE_READY)
{
if((BurstBuffer == 0U ) && (BurstLength > 0U))
{
Expand Down Expand Up @@ -3616,11 +3616,11 @@ HAL_StatusTypeDef HAL_TIM_DMABurst_ReadStart(TIM_HandleTypeDef *htim, uint32_t B
assert_param(IS_TIM_DMA_SOURCE(BurstRequestSrc));
assert_param(IS_TIM_DMA_LENGTH(BurstLength));

if((htim->State == HAL_TIM_STATE_BUSY))
if(htim->State == HAL_TIM_STATE_BUSY)
{
return HAL_BUSY;
}
else if((htim->State == HAL_TIM_STATE_READY))
else if(htim->State == HAL_TIM_STATE_READY)
{
if((BurstBuffer == 0U ) && (BurstLength > 0U))
{
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -387,11 +387,11 @@ HAL_StatusTypeDef HAL_TIMEx_HallSensor_Start_DMA(TIM_HandleTypeDef *htim, uint32
/* Check the parameters */
assert_param(IS_TIM_XOR_INSTANCE(htim->Instance));

if((htim->State == HAL_TIM_STATE_BUSY))
if(htim->State == HAL_TIM_STATE_BUSY)
{
return HAL_BUSY;
}
else if((htim->State == HAL_TIM_STATE_READY))
else if(htim->State == HAL_TIM_STATE_READY)
{
if(((uint32_t)pData == 0U ) && (Length > 0))
{
Expand Down Expand Up @@ -689,11 +689,11 @@ HAL_StatusTypeDef HAL_TIMEx_OCN_Start_DMA(TIM_HandleTypeDef *htim, uint32_t Chan
/* Check the parameters */
assert_param(IS_TIM_CCXN_INSTANCE(htim->Instance, Channel));

if((htim->State == HAL_TIM_STATE_BUSY))
if(htim->State == HAL_TIM_STATE_BUSY)
{
return HAL_BUSY;
}
else if((htim->State == HAL_TIM_STATE_READY))
else if(htim->State == HAL_TIM_STATE_READY)
{
if(((uint32_t)pData == 0U ) && (Length > 0))
{
Expand Down Expand Up @@ -1101,11 +1101,11 @@ HAL_StatusTypeDef HAL_TIMEx_PWMN_Start_DMA(TIM_HandleTypeDef *htim, uint32_t Cha
/* Check the parameters */
assert_param(IS_TIM_CCXN_INSTANCE(htim->Instance, Channel));

if((htim->State == HAL_TIM_STATE_BUSY))
if(htim->State == HAL_TIM_STATE_BUSY)
{
return HAL_BUSY;
}
else if((htim->State == HAL_TIM_STATE_READY))
else if(htim->State == HAL_TIM_STATE_READY)
{
if(((uint32_t)pData == 0U ) && (Length > 0))
{
Expand Down

0 comments on commit 198387d

Please sign in to comment.