mirror of https://github.com/ARMmbed/mbed-os.git
Fix operator precedence warning in can_api.c
The original code was: if(LPC_CAN1->IER | LPC_CAN2->IER != 0) { This would actually be interpreted as: if(LPC_CAN1->IER | (LPC_CAN2->IER != 0)) { I simplified it to: if(LPC_CAN1->IER | LPC_CAN2->IER) { With the comparison removed, the GCC warning no longer fires since the user's intent is no longer unclear. However, the end result should be the same.pull/24/head
parent
15f833bc1b
commit
c411823656
|
@ -164,7 +164,7 @@ void can_irq_set(can_t *obj, CanIrqType type, uint32_t enable) {
|
|||
obj->dev->MOD &= ~(1);
|
||||
|
||||
// Enable NVIC if at least 1 interrupt is active
|
||||
if(LPC_CAN1->IER | LPC_CAN2->IER != 0) {
|
||||
if(LPC_CAN1->IER | LPC_CAN2->IER) {
|
||||
NVIC_SetVector(CAN_IRQn, (uint32_t) &can_irq_n);
|
||||
NVIC_EnableIRQ(CAN_IRQn);
|
||||
}
|
||||
|
|
Loading…
Reference in New Issue