return NULL if alloc fails to avoid taking error code as buffer pointer Signed-off-by: Jun Nie <njun@xxxxxxxxxxx> --- drivers/media/video/videobuf2-dma-contig.c | 4 ++-- 1 files changed, 2 insertions(+), 2 deletions(-) diff --git a/drivers/media/video/videobuf2-dma-contig.c b/drivers/media/video/videobuf2-dma-contig.c index a790a5f..8e8c7aa 100644 --- a/drivers/media/video/videobuf2-dma-contig.c +++ b/drivers/media/video/videobuf2-dma-contig.c @@ -40,7 +40,7 @@ static void *vb2_dma_contig_alloc(void *alloc_ctx, unsigned long size) buf = kzalloc(sizeof *buf, GFP_KERNEL); if (!buf) - return ERR_PTR(-ENOMEM); + return NULL; buf->vaddr = dma_alloc_coherent(conf->dev, size, &buf->paddr, GFP_KERNEL); @@ -48,7 +48,7 @@ static void *vb2_dma_contig_alloc(void *alloc_ctx, unsigned long size) dev_err(conf->dev, "dma_alloc_coherent of size %ld failed\n", size); kfree(buf); - return ERR_PTR(-ENOMEM); + return NULL; } buf->conf = conf; -- 1.7.0.4 -- To unsubscribe from this list: send the line "unsubscribe linux-media" in the body of a message to majordomo@xxxxxxxxxxxxxxx More majordomo info at http://vger.kernel.org/majordomo-info.html