Message ID | 1404998973-19425-1-git-send-email-geert@linux-m68k.org (mailing list archive) |
---|---|
State | Accepted |
Commit | 89e4b66a2e34744615c79349aa936df1b4204faf |
Headers | show |
On Thu, Jul 10, 2014 at 03:29:32PM +0200, Geert Uytterhoeven wrote: > 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. Applied both, thanks.
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;