Commit 56fbd39c authored by Federico Vaga's avatar Federico Vaga

sw:drv:spi: check nbits after transfer fetch

Signed-off-by: Federico Vaga's avatarFederico Vaga <federico.vaga@cern.ch>
parent c3b86c7e
......@@ -431,10 +431,6 @@ static int spi_ocores_sw_xfer_next_init(struct spi_ocores *sp)
uint8_t nbits;
uint32_t hz;
nbits = spi_ocores_hw_xfer_bits_per_word(sp);
if (nbits & (~SPI_OCORES_CTRL_CHAR_LEN))
return -EINVAL;
if (!sp->cur_xfer) {
sp->cur_xfer = list_first_entry_or_null(head,
struct spi_transfer,
......@@ -449,6 +445,10 @@ static int spi_ocores_sw_xfer_next_init(struct spi_ocores *sp)
if (WARN(!sp->cur_xfer, "Invalid SPI transfer"))
return -EINVAL;
nbits = spi_ocores_hw_xfer_bits_per_word(sp);
if (nbits & (~SPI_OCORES_CTRL_CHAR_LEN))
return -EINVAL;
sp->cur_ctrl = sp->ctrl_base;
if (sp->master->cur_msg->spi->mode & SPI_CPHA) {
sp->cur_ctrl |= SPI_OCORES_CTRL_Tx_NEG;
......
Markdown is supported
0% or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment