aboutsummaryrefslogtreecommitdiffstats
path: root/drivers/media/video/cx18/cx18-streams.c
diff options
context:
space:
mode:
authorAndy Walls <awalls@radix.net>2008-08-23 15:42:29 -0400
committerMauro Carvalho Chehab <mchehab@redhat.com>2008-10-12 07:36:53 -0400
commitd3c5e7075508a6874d1a53d0a409b0bbbe3a9fbe (patch)
treea9e6884ac71641938abc1866e5d81f607bd5f907 /drivers/media/video/cx18/cx18-streams.c
parentb04bce476c57ac844962462ee4c813c44fa942cf (diff)
V4L/DVB (8773): cx18: Fix cx18_find_handle() and add error checking
cx18: Fix cx18_find_handle() and add error checking. cx18_find_handle() did not find a good task handle and would use the invalid task handle under common conditions. Added a define for the invalid task handle and added error checking as well. Signed-off-by: Andy Walls <awalls@radix.net> Signed-off-by: Mauro Carvalho Chehab <mchehab@redhat.com>
Diffstat (limited to 'drivers/media/video/cx18/cx18-streams.c')
-rw-r--r--drivers/media/video/cx18/cx18-streams.c8
1 files changed, 4 insertions, 4 deletions
diff --git a/drivers/media/video/cx18/cx18-streams.c b/drivers/media/video/cx18/cx18-streams.c
index 45dc6f399ed4..53c5852bba37 100644
--- a/drivers/media/video/cx18/cx18-streams.c
+++ b/drivers/media/video/cx18/cx18-streams.c
@@ -119,7 +119,7 @@ static void cx18_stream_init(struct cx18 *cx, int type)
119 s->cx = cx; 119 s->cx = cx;
120 s->type = type; 120 s->type = type;
121 s->name = cx18_stream_info[type].name; 121 s->name = cx18_stream_info[type].name;
122 s->handle = 0xffffffff; 122 s->handle = CX18_INVALID_TASK_HANDLE;
123 123
124 s->dma = cx18_stream_info[type].dma; 124 s->dma = cx18_stream_info[type].dma;
125 s->buf_size = cx->stream_buf_size[type]; 125 s->buf_size = cx->stream_buf_size[type];
@@ -548,7 +548,7 @@ int cx18_stop_v4l2_encode_stream(struct cx18_stream *s, int gop_end)
548 clear_bit(CX18_F_S_STREAMING, &s->s_flags); 548 clear_bit(CX18_F_S_STREAMING, &s->s_flags);
549 549
550 cx18_vapi(cx, CX18_DESTROY_TASK, 1, s->handle); 550 cx18_vapi(cx, CX18_DESTROY_TASK, 1, s->handle);
551 s->handle = 0xffffffff; 551 s->handle = CX18_INVALID_TASK_HANDLE;
552 552
553 if (atomic_read(&cx->tot_capturing) > 0) 553 if (atomic_read(&cx->tot_capturing) > 0)
554 return 0; 554 return 0;
@@ -567,8 +567,8 @@ u32 cx18_find_handle(struct cx18 *cx)
567 for (i = 0; i < CX18_MAX_STREAMS; i++) { 567 for (i = 0; i < CX18_MAX_STREAMS; i++) {
568 struct cx18_stream *s = &cx->streams[i]; 568 struct cx18_stream *s = &cx->streams[i];
569 569
570 if (s->v4l2dev && s->handle) 570 if (s->v4l2dev && (s->handle != CX18_INVALID_TASK_HANDLE))
571 return s->handle; 571 return s->handle;
572 } 572 }
573 return 0; 573 return CX18_INVALID_TASK_HANDLE;
574} 574}