upstream: [media] vb2: don't init the list if there are still buffers
authorHans Verkuil <hans.verkuil@cisco.com>
Mon, 24 Feb 2014 16:41:20 +0000 (13:41 -0300)
committerChanho Park <chanho61.park@samsung.com>
Tue, 18 Nov 2014 02:54:54 +0000 (11:54 +0900)
commitd109cabf04f058ae515664c23fdef70dd29a4b0d
treed4fa238b2eff5888b4ba5a721c0bae71a0ae818a
parentb7d59ef6e51fbb9747561b3054e90dd158f003f7
upstream: [media] vb2: don't init the list if there are still buffers

__vb2_queue_free() would init the queued_list at all times, even if
q->num_buffers > 0. This should only happen if num_buffers == 0.

This situation can happen if a CREATE_BUFFERS call couldn't allocate
enough buffers and had to free those it did manage to allocate before
returning an error.

While we're at it: __vb2_queue_alloc() returns the number of buffers
allocated, not an error code. So stick the result in allocated_buffers
instead of ret as that's very confusing.

Signed-off-by: Hans Verkuil <hans.verkuil@cisco.com>
Acked-by: Laurent Pinchart <laurent.pinchart@ideasonboard.com>
Signed-off-by: Mauro Carvalho Chehab <m.chehab@samsung.com>
drivers/media/v4l2-core/videobuf2-core.c