diff options
author | Chris Lesiak <chris.lesiak@licor.com> | 2019-03-07 23:39:00 +0300 |
---|---|---|
committer | Greg Kroah-Hartman <gregkh@linuxfoundation.org> | 2019-05-31 16:47:35 +0300 |
commit | 9618ab20013e3a008f3fa3ebae415e45c1b8f9bc (patch) | |
tree | 8dd8ceacc1a3291bcc6a1abc597fcfe8bfc9c5ea /sound | |
parent | d5f68b8efa00e5daffb16eac09e700767385fcd6 (diff) | |
download | linux-9618ab20013e3a008f3fa3ebae415e45c1b8f9bc.tar.xz |
spi: Fix zero length xfer bug
[ Upstream commit 5442dcaa0d90fc376bdfc179a018931a8f43dea4 ]
This fixes a bug for messages containing both zero length and
unidirectional xfers.
The function spi_map_msg will allocate dummy tx and/or rx buffers
for use with unidirectional transfers when the hardware can only do
a bidirectional transfer. That dummy buffer will be used in place
of a NULL buffer even when the xfer length is 0.
Then in the function __spi_map_msg, if he hardware can dma,
the zero length xfer will have spi_map_buf called on the dummy
buffer.
Eventually, __sg_alloc_table is called and returns -EINVAL
because nents == 0.
This fix prevents the error by not using the dummy buffer when
the xfer length is zero.
Signed-off-by: Chris Lesiak <chris.lesiak@licor.com>
Signed-off-by: Mark Brown <broonie@kernel.org>
Signed-off-by: Sasha Levin <sashal@kernel.org>
Diffstat (limited to 'sound')
0 files changed, 0 insertions, 0 deletions