linux-spi.vger.kernel.org archive mirror
 help / color / mirror / Atom feed
* [PATCH 1/2] spi: core: Fix check for dma_map_sg() failures
@ 2014-07-10 13:29 Geert Uytterhoeven
  2014-07-10 13:29 ` [PATCH 2/2] [RFC] spi: core: Pass correct device to dma_map_sg() Geert Uytterhoeven
       [not found] ` <1404998973-19425-1-git-send-email-geert-Td1EMuHUCqxL1ZNQvxDV9g@public.gmane.org>
  0 siblings, 2 replies; 3+ messages in thread
From: Geert Uytterhoeven @ 2014-07-10 13:29 UTC (permalink / raw)
  To: Mark Brown; +Cc: linux-spi, dmaengine, linux-kernel, Geert Uytterhoeven

From: Geert Uytterhoeven <geert+renesas@glider.be>

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>
---
 drivers/spi/spi.c | 2 ++
 1 file changed, 2 insertions(+)

diff --git a/drivers/spi/spi.c b/drivers/spi/spi.c
index 3a3245dd64ed..3aac0e885cd9 100644
--- a/drivers/spi/spi.c
+++ b/drivers/spi/spi.c
@@ -617,6 +617,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;
-- 
1.9.1

^ permalink raw reply related	[flat|nested] 3+ messages in thread

end of thread, other threads:[~2014-07-11 12:57 UTC | newest]

Thread overview: 3+ messages (download: mbox.gz follow: Atom feed
-- links below jump to the message on this page --
2014-07-10 13:29 [PATCH 1/2] spi: core: Fix check for dma_map_sg() failures Geert Uytterhoeven
2014-07-10 13:29 ` [PATCH 2/2] [RFC] spi: core: Pass correct device to dma_map_sg() Geert Uytterhoeven
     [not found] ` <1404998973-19425-1-git-send-email-geert-Td1EMuHUCqxL1ZNQvxDV9g@public.gmane.org>
2014-07-11 12:57   ` [PATCH 1/2] spi: core: Fix check for dma_map_sg() failures Mark Brown

This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox;
as well as URLs for NNTP newsgroup(s).