Skip to content

Commit e6ad623

Browse files
harperchenmchehab
authored andcommitted
media: netup_unidvb: fix irq init by register it at the end of probe
IRQ handler netup_spi_interrupt() takes spinlock spi->lock. The lock is initialized in netup_spi_init(). However, irq handler is registered before initializing the lock. Spinlock dma->lock and i2c->lock suffer from the same problem. Fix this by registering the irq at the end of probe. Link: https://lore.kernel.org/linux-media/[email protected] Signed-off-by: Wei Chen <[email protected]> Signed-off-by: Mauro Carvalho Chehab <[email protected]>
1 parent a3fd1ef commit e6ad623

File tree

1 file changed

+9
-8
lines changed

1 file changed

+9
-8
lines changed

drivers/media/pci/netup_unidvb/netup_unidvb_core.c

Lines changed: 9 additions & 8 deletions
Original file line numberDiff line numberDiff line change
@@ -887,12 +887,7 @@ static int netup_unidvb_initdev(struct pci_dev *pci_dev,
887887
ndev->lmmio0, (u32)pci_resource_len(pci_dev, 0),
888888
ndev->lmmio1, (u32)pci_resource_len(pci_dev, 1),
889889
pci_dev->irq);
890-
if (request_irq(pci_dev->irq, netup_unidvb_isr, IRQF_SHARED,
891-
"netup_unidvb", pci_dev) < 0) {
892-
dev_err(&pci_dev->dev,
893-
"%s(): can't get IRQ %d\n", __func__, pci_dev->irq);
894-
goto irq_request_err;
895-
}
890+
896891
ndev->dma_size = 2 * 188 *
897892
NETUP_DMA_BLOCKS_COUNT * NETUP_DMA_PACKETS_COUNT;
898893
ndev->dma_virt = dma_alloc_coherent(&pci_dev->dev,
@@ -933,6 +928,14 @@ static int netup_unidvb_initdev(struct pci_dev *pci_dev,
933928
dev_err(&pci_dev->dev, "netup_unidvb: DMA setup failed\n");
934929
goto dma_setup_err;
935930
}
931+
932+
if (request_irq(pci_dev->irq, netup_unidvb_isr, IRQF_SHARED,
933+
"netup_unidvb", pci_dev) < 0) {
934+
dev_err(&pci_dev->dev,
935+
"%s(): can't get IRQ %d\n", __func__, pci_dev->irq);
936+
goto dma_setup_err;
937+
}
938+
936939
dev_info(&pci_dev->dev,
937940
"netup_unidvb: device has been initialized\n");
938941
return 0;
@@ -951,8 +954,6 @@ static int netup_unidvb_initdev(struct pci_dev *pci_dev,
951954
dma_free_coherent(&pci_dev->dev, ndev->dma_size,
952955
ndev->dma_virt, ndev->dma_phys);
953956
dma_alloc_err:
954-
free_irq(pci_dev->irq, pci_dev);
955-
irq_request_err:
956957
iounmap(ndev->lmmio1);
957958
pci_bar1_error:
958959
iounmap(ndev->lmmio0);

0 commit comments

Comments
 (0)