From: Christophe JAILLET <christophe.jaillet@xxxxxxxxxx> Subject: drivers/rapidio/devices/rio_mport_cdev.c: fix error handling in 'rio_dma_transfer()' In case of error, 'dma_map_sg()' returns 0, not a negative value. There is BUG_ON() in 'dma_map_sg_attrs()' which makes sure of that. Link: http://lkml.kernel.org/r/d4235bd2b9274e99f6c86ea71b1fa1c7bd8d0c08.1505687047.git.christophe.jaillet@xxxxxxxxxx Signed-off-by: Christophe JAILLET <christophe.jaillet@xxxxxxxxxx> Reviewed-by: Logan Gunthorpe <logang@xxxxxxxxxxxx> Cc: Matt Porter <mporter@xxxxxxxxxxxxxxxxxxx> Cc: Alexandre Bounine <alexandre.bounine@xxxxxxx> Cc: Lorenzo Stoakes <lstoakes@xxxxxxxxx> Cc: Jesper Nilsson <jesper.nilsson@xxxxxxxx> Cc: Christian K_nig <christian.koenig@xxxxxxx> Signed-off-by: Andrew Morton <akpm@xxxxxxxxxxxxxxxxxxxx> --- drivers/rapidio/devices/rio_mport_cdev.c | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff -puN drivers/rapidio/devices/rio_mport_cdev.c~rapidio-fix-an-error-handling-in-rio_dma_transfer drivers/rapidio/devices/rio_mport_cdev.c --- a/drivers/rapidio/devices/rio_mport_cdev.c~rapidio-fix-an-error-handling-in-rio_dma_transfer +++ a/drivers/rapidio/devices/rio_mport_cdev.c @@ -961,7 +961,7 @@ rio_dma_transfer(struct file *filp, u32 nents = dma_map_sg(chan->device->dev, req->sgt.sgl, req->sgt.nents, dir); - if (nents == -EFAULT) { + if (nents == 0) { rmcd_error("Failed to map SG list"); ret = -EFAULT; goto err_pg; _ -- To unsubscribe from this list: send the line "unsubscribe mm-commits" in the body of a message to majordomo@xxxxxxxxxxxxxxx More majordomo info at http://vger.kernel.org/majordomo-info.html