drivers: can: Set a initial state to the can device before HAL_CAN_Init

As part of HAL_CAN_Init we check the initial state of the can handle.
Setting it to HAL_CAN_STATE_RESET as an initial state to start the
Init properly.

Resolves: #8416
Coverity-CID: 186580

Signed-off-by: Sritej Kanakadandi Venkata Rama <sritej.kvr@gmail.com>
This commit is contained in:
Sritej Kanakadandi Venkata Rama 2018-06-18 13:47:06 -07:00 committed by Anas Nashif
commit 6f61f09803

View file

@ -254,6 +254,8 @@ int can_stm32_runtime_configure(struct device *dev, enum can_mode mode,
hcan.Init.BS2 = bs2;
hcan.Init.Prescaler = prescaler;
hcan.State = HAL_CAN_STATE_RESET;
hal_ret = HAL_CAN_Init(&hcan);
if (hal_ret != HAL_OK) {
SYS_LOG_ERR("HAL_CAN_Init failed: %d", hal_ret);