Linux kernel mirror (for testing) git.kernel.org/pub/scm/linux/kernel/git/torvalds/linux.git
kernel os linux

V4L/DVB: cx88: fix setting input when using DVB

In cx88-mpeg.c, there is code that sets core->input to CX88_VMUX_DVB.
However, this may be incorrect, since core->input is actually an
index to core->board.input[], which has not enough elements to be
indexed by the value of CX88_VMUX_DVB. So, the modified code searches
core->board.input[] for an input with a type of CX88_VMUX_DVB, and if
it does not find one, the index is simply set to zero.
The change may not have much effect, though, since it appears the only
case when core->input is actually used is when the current input is
being queried.

Signed-off-by: Istvan Varga <istvanv@users.sourceforge.net>
Signed-off-by: Mauro Carvalho Chehab <mchehab@redhat.com>

authored by

Istvan Varga and committed by
Mauro Carvalho Chehab
d922b8ea db190fc1

+10 -1
+10 -1
drivers/media/video/cx88/cx88-mpeg.c
··· 599 599 static int cx8802_request_acquire(struct cx8802_driver *drv) 600 600 { 601 601 struct cx88_core *core = drv->core; 602 + unsigned int i; 602 603 603 604 /* Fail a request for hardware if the device is busy. */ 604 605 if (core->active_type_id != CX88_BOARD_NONE && 605 606 core->active_type_id != drv->type_id) 606 607 return -EBUSY; 607 608 608 - core->input = CX88_VMUX_DVB; 609 + core->input = 0; 610 + for (i = 0; 611 + i < (sizeof(core->board.input) / sizeof(struct cx88_input)); 612 + i++) { 613 + if (core->board.input[i].type == CX88_VMUX_DVB) { 614 + core->input = i; 615 + break; 616 + } 617 + } 609 618 610 619 if (drv->advise_acquire) 611 620 {