From 72b7876c2e3b6087c72ce030d8145ec4a7328121 Mon Sep 17 00:00:00 2001 From: Christophe JAILLET Date: Sun, 23 Apr 2017 18:40:30 -0300 Subject: [PATCH] [media] vb2: Fix error handling in '__vb2_buf_mem_alloc' 'call_ptr_memop' can return NULL, so we must test its return value with 'IS_ERR_OR_NULL'. Otherwise, the test 'if (mem_priv)' is meaningless. Signed-off-by: Christophe JAILLET Signed-off-by: Hans Verkuil Signed-off-by: Mauro Carvalho Chehab --- drivers/media/v4l2-core/videobuf2-core.c | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/drivers/media/v4l2-core/videobuf2-core.c b/drivers/media/v4l2-core/videobuf2-core.c index 3107e2196e54..14f83cecfa92 100644 --- a/drivers/media/v4l2-core/videobuf2-core.c +++ b/drivers/media/v4l2-core/videobuf2-core.c @@ -210,7 +210,7 @@ static int __vb2_buf_mem_alloc(struct vb2_buffer *vb) mem_priv = call_ptr_memop(vb, alloc, q->alloc_devs[plane] ? : q->dev, q->dma_attrs, size, dma_dir, q->gfp_flags); - if (IS_ERR(mem_priv)) { + if (IS_ERR_OR_NULL(mem_priv)) { if (mem_priv) ret = PTR_ERR(mem_priv); goto free; -- 2.20.1