spi: stm32: fix spi_stm32_init()
It is incorrect to call spi_context_release() on an STM32 spi_stm32_data object's ctx field before data->ctx->config is first set in spi_stm32_configure(). This is because spi_context_release() reads ctx->config->operation. In particular, during spi_stm32_init(), calling spi_context_release() reads the uninitialized memory in data->ctx->config->operation. Call spi_context_unlock_unconditionally() instead to properly increase the semaphore count. Without this patch, the first call to spi_transceive() can block forever depending on the value of the uninitialized memory holding data->ctx->config->operation. Signed-off-by: Marti Bolivar <marti.bolivar@linaro.org>
This commit is contained in:
parent
d1fa43d99b
commit
6318750837
1 changed files with 1 additions and 1 deletions
|
@ -351,7 +351,7 @@ static int spi_stm32_init(struct device *dev)
|
|||
cfg->irq_config(dev);
|
||||
#endif
|
||||
|
||||
spi_context_release(&data->ctx, 0);
|
||||
spi_context_unlock_unconditionally(&data->ctx);
|
||||
|
||||
return 0;
|
||||
}
|
||||
|
|
Loading…
Add table
Add a link
Reference in a new issue