mirror of
https://mirrors.bfsu.edu.cn/git/linux.git
synced 2024-11-11 21:38:32 +08:00
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>
This commit is contained in:
parent
7171511eae
commit
89e4b66a2e
@ -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);
|
ret = dma_map_sg(dev, sgt->sgl, sgt->nents, dir);
|
||||||
|
if (!ret)
|
||||||
|
ret = -ENOMEM;
|
||||||
if (ret < 0) {
|
if (ret < 0) {
|
||||||
sg_free_table(sgt);
|
sg_free_table(sgt);
|
||||||
return ret;
|
return ret;
|
||||||
|
Loading…
Reference in New Issue
Block a user