summaryrefslogtreecommitdiff
path: root/drivers/spi/spi.c
diff options
context:
space:
mode:
authorGeert Uytterhoeven <geert+renesas@glider.be>2014-07-10 15:29:32 +0200
committerNitin Garg <nitin.garg@freescale.com>2015-09-17 09:20:39 -0500
commitf597dac456453d193f826c08e32e4db4667576f8 (patch)
tree9a8673deaba808378e1298b0a4725ed340849fba /drivers/spi/spi.c
parent368563f098a622a958f87f5eea313766f871e9f8 (diff)
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> (cherry picked from commit 89e4b66a2e34744615c79349aa936df1b4204faf) (cherry picked from commit d176f970196ecc2c0f0c30116061fdeba3461556)
Diffstat (limited to 'drivers/spi/spi.c')
-rw-r--r--drivers/spi/spi.c2
1 files changed, 2 insertions, 0 deletions
diff --git a/drivers/spi/spi.c b/drivers/spi/spi.c
index 2cd859b0019c..3813f7fe1331 100644
--- a/drivers/spi/spi.c
+++ b/drivers/spi/spi.c
@@ -622,6 +622,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;