diff options
author | Geert Uytterhoeven <geert+renesas@glider.be> | 2014-07-10 15:29:32 +0200 |
---|---|---|
committer | Mark Brown <broonie@linaro.org> | 2014-07-11 13:57:10 +0100 |
commit | 89e4b66a2e34744615c79349aa936df1b4204faf (patch) | |
tree | 75a9b942c590ebe9d0d978f3de2e8c07a6bc2e91 /drivers/spi/spi.c | |
parent | 7171511eaec5bf23fb06078f59784a3a0626b38f (diff) | |
download | talos-obmc-linux-89e4b66a2e34744615c79349aa936df1b4204faf.tar.gz talos-obmc-linux-89e4b66a2e34744615c79349aa936df1b4204faf.zip |
spi: core: Fix check for dma_map_sg() failures
According to Documentation/DMA-API.txt, dma_map_sg() returns 0 on failure.
As spi_map_buf() returns an error code, convert zero into -ENOMEM.
Keep the existing check for negative numbers just in case.
Signed-off-by: Geert Uytterhoeven <geert+renesas@glider.be>
Signed-off-by: Mark Brown <broonie@linaro.org>
Diffstat (limited to 'drivers/spi/spi.c')
-rw-r--r-- | drivers/spi/spi.c | 2 |
1 files changed, 2 insertions, 0 deletions
diff --git a/drivers/spi/spi.c b/drivers/spi/spi.c index d4f9670b51bc..91bb512e1009 100644 --- a/drivers/spi/spi.c +++ b/drivers/spi/spi.c @@ -619,6 +619,8 @@ static int spi_map_buf(struct spi_master *master, struct device *dev, } ret = dma_map_sg(dev, sgt->sgl, sgt->nents, dir); + if (!ret) + ret = -ENOMEM; if (ret < 0) { sg_free_table(sgt); return ret; |