udmabuf: fix error code in map_udmabuf()
authorDan Carpenter <dan.carpenter@oracle.com>
Fri, 14 Sep 2018 06:56:15 +0000 (09:56 +0300)
committerGerd Hoffmann <kraxel@redhat.com>
Fri, 14 Sep 2018 09:44:59 +0000 (11:44 +0200)
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>
Link: http://patchwork.freedesktop.org/patch/msgid/20180914065615.GA12043@mwanda
Signed-off-by: Gerd Hoffmann <kraxel@redhat.com>
drivers/dma-buf/udmabuf.c

index 9edabce0b8ab3c82e0f91d43415881904d4592c3..5b44ef226904f9be2530b992c3d06ed338dca53c 100644 (file)
@@ -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: