[media] vb2: Fix error handling in '__vb2_buf_mem_alloc'
authorChristophe JAILLET <christophe.jaillet@wanadoo.fr>
Sun, 23 Apr 2017 21:40:30 +0000 (18:40 -0300)
committerMauro Carvalho Chehab <mchehab@s-opensource.com>
Tue, 20 Jun 2017 12:04:46 +0000 (09:04 -0300)
'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 <christophe.jaillet@wanadoo.fr>
Signed-off-by: Hans Verkuil <hansverk@cisco.com>
Signed-off-by: Mauro Carvalho Chehab <mchehab@s-opensource.com>
drivers/media/v4l2-core/videobuf2-core.c

index 3107e2196e54e7272c4346b6f3dcc65f05ecbbc7..14f83cecfa923854ab8e18ccf011076727248bb9 100644 (file)
@@ -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;