Commit d86e2ee9 authored by Hans Verkuil's avatar Hans Verkuil Committed by Mauro Carvalho Chehab

V4L/DVB (7754): ivtv: change initialization order to fix an oops when device registration failed

Signed-off-by: default avatarHans Verkuil <hverkuil@xs4all.nl>
Signed-off-by: default avatarMauro Carvalho Chehab <mchehab@infradead.org>
parent c117d05c
...@@ -1195,13 +1195,6 @@ static int __devinit ivtv_probe(struct pci_dev *dev, ...@@ -1195,13 +1195,6 @@ static int __devinit ivtv_probe(struct pci_dev *dev,
ivtv_call_i2c_clients(itv, VIDIOC_INT_S_STD_OUTPUT, &itv->std); ivtv_call_i2c_clients(itv, VIDIOC_INT_S_STD_OUTPUT, &itv->std);
} }
retval = ivtv_streams_setup(itv);
if (retval) {
IVTV_ERR("Error %d setting up streams\n", retval);
goto free_i2c;
}
IVTV_DEBUG_IRQ("Masking interrupts\n");
/* clear interrupt mask, effectively disabling interrupts */ /* clear interrupt mask, effectively disabling interrupts */
ivtv_set_irq_mask(itv, 0xffffffff); ivtv_set_irq_mask(itv, 0xffffffff);
...@@ -1210,32 +1203,38 @@ static int __devinit ivtv_probe(struct pci_dev *dev, ...@@ -1210,32 +1203,38 @@ static int __devinit ivtv_probe(struct pci_dev *dev,
IRQF_SHARED | IRQF_DISABLED, itv->name, (void *)itv); IRQF_SHARED | IRQF_DISABLED, itv->name, (void *)itv);
if (retval) { if (retval) {
IVTV_ERR("Failed to register irq %d\n", retval); IVTV_ERR("Failed to register irq %d\n", retval);
goto free_streams; goto free_i2c;
}
retval = ivtv_streams_setup(itv);
if (retval) {
IVTV_ERR("Error %d setting up streams\n", retval);
goto free_irq;
} }
retval = ivtv_streams_register(itv); retval = ivtv_streams_register(itv);
if (retval) { if (retval) {
IVTV_ERR("Error %d registering devices\n", retval); IVTV_ERR("Error %d registering devices\n", retval);
goto free_irq; goto free_streams;
} }
IVTV_INFO("Initialized card #%d: %s\n", itv->num, itv->card_name); IVTV_INFO("Initialized card #%d: %s\n", itv->num, itv->card_name);
return 0; return 0;
free_irq: free_streams:
free_irq(itv->dev->irq, (void *)itv);
free_streams:
ivtv_streams_cleanup(itv); ivtv_streams_cleanup(itv);
free_i2c: free_irq:
free_irq(itv->dev->irq, (void *)itv);
free_i2c:
exit_ivtv_i2c(itv); exit_ivtv_i2c(itv);
free_io: free_io:
ivtv_iounmap(itv); ivtv_iounmap(itv);
free_mem: free_mem:
release_mem_region(itv->base_addr, IVTV_ENCODER_SIZE); release_mem_region(itv->base_addr, IVTV_ENCODER_SIZE);
release_mem_region(itv->base_addr + IVTV_REG_OFFSET, IVTV_REG_SIZE); release_mem_region(itv->base_addr + IVTV_REG_OFFSET, IVTV_REG_SIZE);
if (itv->has_cx23415) if (itv->has_cx23415)
release_mem_region(itv->base_addr + IVTV_DECODER_OFFSET, IVTV_DECODER_SIZE); release_mem_region(itv->base_addr + IVTV_DECODER_OFFSET, IVTV_DECODER_SIZE);
free_workqueue: free_workqueue:
destroy_workqueue(itv->irq_work_queues); destroy_workqueue(itv->irq_work_queues);
err: err:
if (retval == 0) if (retval == 0)
retval = -ENODEV; retval = -ENODEV;
IVTV_ERR("Error %d on initialization\n", retval); IVTV_ERR("Error %d on initialization\n", retval);
......
Markdown is supported
0%
or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment