Merge pull request #5817 from makomi/stm32f0

cpu/stm32f0: uart: suppress cppcheck nullPointer errors
This commit is contained in:
Oleg Hahm 2016-09-23 19:50:31 +02:00 committed by GitHub
commit 50215e9b5d

View File

@ -113,6 +113,12 @@ int init_base(uart_t uart, uint32_t baudrate)
return -1; return -1;
} }
/* Make sure port and dev are != NULL here, i.e. that the variables are
* assigned in all non-returning branches of the switch at the top of this
* function. */
assert(port != NULL);
assert(dev != NULL);
/* configure RX and TX pins, set pin to use alternative function mode */ /* configure RX and TX pins, set pin to use alternative function mode */
port->MODER &= ~(3 << (rx_pin * 2) | 3 << (tx_pin * 2)); port->MODER &= ~(3 << (rx_pin * 2) | 3 << (tx_pin * 2));
port->MODER |= 2 << (rx_pin * 2) | 2 << (tx_pin * 2); port->MODER |= 2 << (rx_pin * 2) | 2 << (tx_pin * 2);