diff mbox series

udmabuf: fix error code in map_udmabuf()

Message ID 20180914065615.GA12043@mwanda (mailing list archive)
State New, archived
Headers show
Series udmabuf: fix error code in map_udmabuf() | expand

Commit Message

Dan Carpenter Sept. 14, 2018, 6:56 a.m. UTC
We accidentally forgot to set "ret" on this error path so it means we
return NULL instead of an error pointer.  The caller checks for NULL and
changes it to an error pointer so it doesn't cause an issue at run time.

Signed-off-by: Dan Carpenter <dan.carpenter@oracle.com>

Comments

Gerd Hoffmann Sept. 14, 2018, 9:45 a.m. UTC | #1
On Fri, Sep 14, 2018 at 09:56:15AM +0300, Dan Carpenter wrote:
> We accidentally forgot to set "ret" on this error path so it means we
> return NULL instead of an error pointer.  The caller checks for NULL and
> changes it to an error pointer so it doesn't cause an issue at run time.

Pushed to drm-misc-next.

thanks,
  Gerd
diff mbox series

Patch

diff --git a/drivers/dma-buf/udmabuf.c b/drivers/dma-buf/udmabuf.c
index 9edabce0b8ab..5b44ef226904 100644
--- a/drivers/dma-buf/udmabuf.c
+++ b/drivers/dma-buf/udmabuf.c
@@ -61,8 +61,10 @@  static struct sg_table *map_udmabuf(struct dma_buf_attachment *at,
 					GFP_KERNEL);
 	if (ret < 0)
 		goto err;
-	if (!dma_map_sg(at->dev, sg->sgl, sg->nents, direction))
+	if (!dma_map_sg(at->dev, sg->sgl, sg->nents, direction)) {
+		ret = -EINVAL;
 		goto err;
+	}
 	return sg;
 
 err: