From d922b8ea33afad725920375b2d3bd65218cdb133 Mon Sep 17 00:00:00 2001 From: Istvan Varga Date: Sat, 27 Mar 2010 09:47:45 -0300 Subject: [PATCH] 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 Signed-off-by: Mauro Carvalho Chehab --- drivers/media/video/cx88/cx88-mpeg.c | 11 ++++++++++- 1 file changed, 10 insertions(+), 1 deletion(-) diff --git a/drivers/media/video/cx88/cx88-mpeg.c b/drivers/media/video/cx88/cx88-mpeg.c index 6aba7af9160..499f8d512ad 100644 --- a/drivers/media/video/cx88/cx88-mpeg.c +++ b/drivers/media/video/cx88/cx88-mpeg.c @@ -599,13 +599,22 @@ struct cx8802_driver * cx8802_get_driver(struct cx8802_dev *dev, enum cx88_board static int cx8802_request_acquire(struct cx8802_driver *drv) { struct cx88_core *core = drv->core; + unsigned int i; /* Fail a request for hardware if the device is busy. */ if (core->active_type_id != CX88_BOARD_NONE && core->active_type_id != drv->type_id) return -EBUSY; - core->input = CX88_VMUX_DVB; + core->input = 0; + for (i = 0; + i < (sizeof(core->board.input) / sizeof(struct cx88_input)); + i++) { + if (core->board.input[i].type == CX88_VMUX_DVB) { + core->input = i; + break; + } + } if (drv->advise_acquire) { -- 2.46.0