forked from luck/tmp_suning_uos_patched
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);
|
||||
if (!ret)
|
||||
ret = -ENOMEM;
|
||||
if (ret < 0) {
|
||||
sg_free_table(sgt);
|
||||
return ret;
|
||||
|
|
Loading…
Reference in New Issue
Block a user