aboutsummaryrefslogtreecommitdiffstats
path: root/drivers/media/video/ivtv
diff options
context:
space:
mode:
authorHans Verkuil <hverkuil@xs4all.nl>2008-04-26 07:43:50 -0400
committerMauro Carvalho Chehab <mchehab@infradead.org>2008-04-29 17:41:33 -0400
commitd86e2ee98eeef61bdab8ca1bf4837c5709173790 (patch)
treeaaea7b958345d803b81f740d6f0de97c5a41719e /drivers/media/video/ivtv
parentc117d05cd4c09342f97ba1c6ef63f0bae3239a39 (diff)
V4L/DVB (7754): ivtv: change initialization order to fix an oops when device registration failed
Signed-off-by: Hans Verkuil <hverkuil@xs4all.nl> Signed-off-by: Mauro Carvalho Chehab <mchehab@infradead.org>
Diffstat (limited to 'drivers/media/video/ivtv')
-rw-r--r--drivers/media/video/ivtv/ivtv-driver.c33
1 files changed, 16 insertions, 17 deletions
diff --git a/drivers/media/video/ivtv/ivtv-driver.c b/drivers/media/video/ivtv/ivtv-driver.c
index 065df53f80fd..06a1f3c4de4b 100644
--- a/drivers/media/video/ivtv/ivtv-driver.c
+++ b/drivers/media/video/ivtv/ivtv-driver.c
@@ -1195,13 +1195,6 @@ static int __devinit ivtv_probe(struct pci_dev *dev,
1195 ivtv_call_i2c_clients(itv, VIDIOC_INT_S_STD_OUTPUT, &itv->std); 1195 ivtv_call_i2c_clients(itv, VIDIOC_INT_S_STD_OUTPUT, &itv->std);
1196 } 1196 }
1197 1197
1198 retval = ivtv_streams_setup(itv);
1199 if (retval) {
1200 IVTV_ERR("Error %d setting up streams\n", retval);
1201 goto free_i2c;
1202 }
1203
1204 IVTV_DEBUG_IRQ("Masking interrupts\n");
1205 /* clear interrupt mask, effectively disabling interrupts */ 1198 /* clear interrupt mask, effectively disabling interrupts */
1206 ivtv_set_irq_mask(itv, 0xffffffff); 1199 ivtv_set_irq_mask(itv, 0xffffffff);
1207 1200
@@ -1210,32 +1203,38 @@ static int __devinit ivtv_probe(struct pci_dev *dev,
1210 IRQF_SHARED | IRQF_DISABLED, itv->name, (void *)itv); 1203 IRQF_SHARED | IRQF_DISABLED, itv->name, (void *)itv);
1211 if (retval) { 1204 if (retval) {
1212 IVTV_ERR("Failed to register irq %d\n", retval); 1205 IVTV_ERR("Failed to register irq %d\n", retval);
1213 goto free_streams; 1206 goto free_i2c;
1207 }
1208
1209 retval = ivtv_streams_setup(itv);
1210 if (retval) {
1211 IVTV_ERR("Error %d setting up streams\n", retval);
1212 goto free_irq;
1214 } 1213 }
1215 retval = ivtv_streams_register(itv); 1214 retval = ivtv_streams_register(itv);
1216 if (retval) { 1215 if (retval) {
1217 IVTV_ERR("Error %d registering devices\n", retval); 1216 IVTV_ERR("Error %d registering devices\n", retval);
1218 goto free_irq; 1217 goto free_streams;
1219 } 1218 }
1220 IVTV_INFO("Initialized card #%d: %s\n", itv->num, itv->card_name); 1219 IVTV_INFO("Initialized card #%d: %s\n", itv->num, itv->card_name);
1221 return 0; 1220 return 0;
1222 1221
1223 free_irq: 1222free_streams:
1224 free_irq(itv->dev->irq, (void *)itv);
1225 free_streams:
1226 ivtv_streams_cleanup(itv); 1223 ivtv_streams_cleanup(itv);
1227 free_i2c: 1224free_irq:
1225 free_irq(itv->dev->irq, (void *)itv);
1226free_i2c:
1228 exit_ivtv_i2c(itv); 1227 exit_ivtv_i2c(itv);
1229 free_io: 1228free_io:
1230 ivtv_iounmap(itv); 1229 ivtv_iounmap(itv);
1231 free_mem: 1230free_mem:
1232 release_mem_region(itv->base_addr, IVTV_ENCODER_SIZE); 1231 release_mem_region(itv->base_addr, IVTV_ENCODER_SIZE);
1233 release_mem_region(itv->base_addr + IVTV_REG_OFFSET, IVTV_REG_SIZE); 1232 release_mem_region(itv->base_addr + IVTV_REG_OFFSET, IVTV_REG_SIZE);
1234 if (itv->has_cx23415) 1233 if (itv->has_cx23415)
1235 release_mem_region(itv->base_addr + IVTV_DECODER_OFFSET, IVTV_DECODER_SIZE); 1234 release_mem_region(itv->base_addr + IVTV_DECODER_OFFSET, IVTV_DECODER_SIZE);
1236 free_workqueue: 1235free_workqueue:
1237 destroy_workqueue(itv->irq_work_queues); 1236 destroy_workqueue(itv->irq_work_queues);
1238 err: 1237err:
1239 if (retval == 0) 1238 if (retval == 0)
1240 retval = -ENODEV; 1239 retval = -ENODEV;
1241 IVTV_ERR("Error %d on initialization\n", retval); 1240 IVTV_ERR("Error %d on initialization\n", retval);