Commit 72b7876c authored by Christophe JAILLET's avatar Christophe JAILLET Committed by Mauro Carvalho Chehab

[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: default avatarChristophe JAILLET <christophe.jaillet@wanadoo.fr>
Signed-off-by: default avatarHans Verkuil <hansverk@cisco.com>
Signed-off-by: default avatarMauro Carvalho Chehab <mchehab@s-opensource.com>
parent 8b8470fd
...@@ -210,7 +210,7 @@ static int __vb2_buf_mem_alloc(struct vb2_buffer *vb) ...@@ -210,7 +210,7 @@ static int __vb2_buf_mem_alloc(struct vb2_buffer *vb)
mem_priv = call_ptr_memop(vb, alloc, mem_priv = call_ptr_memop(vb, alloc,
q->alloc_devs[plane] ? : q->dev, q->alloc_devs[plane] ? : q->dev,
q->dma_attrs, size, dma_dir, q->gfp_flags); q->dma_attrs, size, dma_dir, q->gfp_flags);
if (IS_ERR(mem_priv)) { if (IS_ERR_OR_NULL(mem_priv)) {
if (mem_priv) if (mem_priv)
ret = PTR_ERR(mem_priv); ret = PTR_ERR(mem_priv);
goto free; goto free;
......
Markdown is supported
0%
or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment