mirror of
https://git.kernel.org/pub/scm/linux/kernel/git/stable/linux.git
synced 2024-09-06 10:57:46 +00:00
spi/omap2-mcpsi: Always call spi_finalize_current_message()
The spi queue waits forever for spi_finalize_current_message() to be called, blocking the bus. Ensure that all error paths from omap2_mcspi_transfer_one_message() call spi_finalize_current_message(). Signed-off-by: Fionn Cleary <fionn.cleary@streamunlimited.com> Signed-off-by: Mark Brown <broonie@kernel.org>
This commit is contained in:
parent
c517d838eb
commit
c5a06e75f3
1 changed files with 12 additions and 4 deletions
|
@ -1210,6 +1210,7 @@ static int omap2_mcspi_transfer_one_message(struct spi_master *master,
|
||||||
struct omap2_mcspi *mcspi;
|
struct omap2_mcspi *mcspi;
|
||||||
struct omap2_mcspi_dma *mcspi_dma;
|
struct omap2_mcspi_dma *mcspi_dma;
|
||||||
struct spi_transfer *t;
|
struct spi_transfer *t;
|
||||||
|
int status;
|
||||||
|
|
||||||
spi = m->spi;
|
spi = m->spi;
|
||||||
mcspi = spi_master_get_devdata(master);
|
mcspi = spi_master_get_devdata(master);
|
||||||
|
@ -1229,7 +1230,8 @@ static int omap2_mcspi_transfer_one_message(struct spi_master *master,
|
||||||
tx_buf ? "tx" : "",
|
tx_buf ? "tx" : "",
|
||||||
rx_buf ? "rx" : "",
|
rx_buf ? "rx" : "",
|
||||||
t->bits_per_word);
|
t->bits_per_word);
|
||||||
return -EINVAL;
|
status = -EINVAL;
|
||||||
|
goto out;
|
||||||
}
|
}
|
||||||
|
|
||||||
if (m->is_dma_mapped || len < DMA_MIN_BYTES)
|
if (m->is_dma_mapped || len < DMA_MIN_BYTES)
|
||||||
|
@ -1241,7 +1243,8 @@ static int omap2_mcspi_transfer_one_message(struct spi_master *master,
|
||||||
if (dma_mapping_error(mcspi->dev, t->tx_dma)) {
|
if (dma_mapping_error(mcspi->dev, t->tx_dma)) {
|
||||||
dev_dbg(mcspi->dev, "dma %cX %d bytes error\n",
|
dev_dbg(mcspi->dev, "dma %cX %d bytes error\n",
|
||||||
'T', len);
|
'T', len);
|
||||||
return -EINVAL;
|
status = -EINVAL;
|
||||||
|
goto out;
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
if (mcspi_dma->dma_rx && rx_buf != NULL) {
|
if (mcspi_dma->dma_rx && rx_buf != NULL) {
|
||||||
|
@ -1253,14 +1256,19 @@ static int omap2_mcspi_transfer_one_message(struct spi_master *master,
|
||||||
if (tx_buf != NULL)
|
if (tx_buf != NULL)
|
||||||
dma_unmap_single(mcspi->dev, t->tx_dma,
|
dma_unmap_single(mcspi->dev, t->tx_dma,
|
||||||
len, DMA_TO_DEVICE);
|
len, DMA_TO_DEVICE);
|
||||||
return -EINVAL;
|
status = -EINVAL;
|
||||||
|
goto out;
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
omap2_mcspi_work(mcspi, m);
|
omap2_mcspi_work(mcspi, m);
|
||||||
|
/* spi_finalize_current_message() changes the status inside the
|
||||||
|
* spi_message, save the status here. */
|
||||||
|
status = m->status;
|
||||||
|
out:
|
||||||
spi_finalize_current_message(master);
|
spi_finalize_current_message(master);
|
||||||
return 0;
|
return status;
|
||||||
}
|
}
|
||||||
|
|
||||||
static int omap2_mcspi_master_setup(struct omap2_mcspi *mcspi)
|
static int omap2_mcspi_master_setup(struct omap2_mcspi *mcspi)
|
||||||
|
|
Loading…
Reference in a new issue