Skip to contentSkip to conversation

udmabuf: fix error code in map_udmabuf()

PATCH Applied Dan Carpenter 2 participants 2 messages Sep 14, 2018

Subsystems (4)
lore
Share & tools
lore
#0 lore raw

PATCH 1/1 udmabuf: fix error code in map_udmabuf()

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.

drivers/dma-buf/udmabuf.c +3 -1
index 9edabce0b8ab..5b44ef226904 100644
@@ -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:
maintainer Applied
#1 lore raw
Quoted 3 lines · Dan Carpenter

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