diff options
author | Marek Szyprowski <m.szyprowski@samsung.com> | 2011-06-28 07:29:02 -0400 |
---|---|---|
committer | Mauro Carvalho Chehab <mchehab@redhat.com> | 2011-06-30 21:33:47 -0400 |
commit | 66072d4fa7cb644f1f064e290f8fddfbd8ccd478 (patch) | |
tree | 97ab6c16f04589118c720fdd314d114d4d9dae5d /drivers/media | |
parent | afdea8bac5e80362459940e18e705d792e677a57 (diff) |
[media] media: vb2: fix allocation failure check
__vb2_queue_alloc function returns the number of successfully allocated
buffers. There is no point in checking if the returned value is negative.
If this function returns 0, videobuf2 should just return -ENOMEM to
userspace, because no driver can work without memory buffers.
Reported-by: Jonathan Corbet <corbet@lwn.net>
Signed-off-by: Marek Szyprowski <m.szyprowski@samsung.com>
Signed-off-by: Kyungmin Park <kyungmin.park@samsung.com>
CC: Pawel Osciak <pawel@osciak.com>
Signed-off-by: Mauro Carvalho Chehab <mchehab@redhat.com>
Diffstat (limited to 'drivers/media')
-rw-r--r-- | drivers/media/video/videobuf2-core.c | 6 |
1 files changed, 3 insertions, 3 deletions
diff --git a/drivers/media/video/videobuf2-core.c b/drivers/media/video/videobuf2-core.c index 84f03b25aedb..3015e6000946 100644 --- a/drivers/media/video/videobuf2-core.c +++ b/drivers/media/video/videobuf2-core.c | |||
@@ -532,9 +532,9 @@ int vb2_reqbufs(struct vb2_queue *q, struct v4l2_requestbuffers *req) | |||
532 | /* Finally, allocate buffers and video memory */ | 532 | /* Finally, allocate buffers and video memory */ |
533 | ret = __vb2_queue_alloc(q, req->memory, num_buffers, num_planes, | 533 | ret = __vb2_queue_alloc(q, req->memory, num_buffers, num_planes, |
534 | plane_sizes); | 534 | plane_sizes); |
535 | if (ret < 0) { | 535 | if (ret == 0) { |
536 | dprintk(1, "Memory allocation failed with error: %d\n", ret); | 536 | dprintk(1, "Memory allocation failed\n"); |
537 | return ret; | 537 | return -ENOMEM; |
538 | } | 538 | } |
539 | 539 | ||
540 | /* | 540 | /* |