Donate to e Foundation | Murena handsets with /e/OS | Own a part of Murena! Learn more

Commit b66849f3 authored by Wei Chen's avatar Wei Chen Committed by Greg Kroah-Hartman
Browse files

media: netup_unidvb: fix irq init by register it at the end of probe

[ Upstream commit e6ad6233592593079db5c8fa592c298e51bc1356 ]

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/20230315134518.1074497-1-harperchen1110@gmail.com


Signed-off-by: default avatarWei Chen <harperchen1110@gmail.com>
Signed-off-by: default avatarMauro Carvalho Chehab <mchehab@kernel.org>
Signed-off-by: default avatarSasha Levin <sashal@kernel.org>
parent 88aef84e
Loading
Loading
Loading
Loading
+9 −8
Original line number Original line Diff line number Diff line
@@ -887,12 +887,7 @@ static int netup_unidvb_initdev(struct pci_dev *pci_dev,
		ndev->lmmio0, (u32)pci_resource_len(pci_dev, 0),
		ndev->lmmio0, (u32)pci_resource_len(pci_dev, 0),
		ndev->lmmio1, (u32)pci_resource_len(pci_dev, 1),
		ndev->lmmio1, (u32)pci_resource_len(pci_dev, 1),
		pci_dev->irq);
		pci_dev->irq);
	if (request_irq(pci_dev->irq, netup_unidvb_isr, IRQF_SHARED,

			"netup_unidvb", pci_dev) < 0) {
		dev_err(&pci_dev->dev,
			"%s(): can't get IRQ %d\n", __func__, pci_dev->irq);
		goto irq_request_err;
	}
	ndev->dma_size = 2 * 188 *
	ndev->dma_size = 2 * 188 *
		NETUP_DMA_BLOCKS_COUNT * NETUP_DMA_PACKETS_COUNT;
		NETUP_DMA_BLOCKS_COUNT * NETUP_DMA_PACKETS_COUNT;
	ndev->dma_virt = dma_alloc_coherent(&pci_dev->dev,
	ndev->dma_virt = dma_alloc_coherent(&pci_dev->dev,
@@ -933,6 +928,14 @@ static int netup_unidvb_initdev(struct pci_dev *pci_dev,
		dev_err(&pci_dev->dev, "netup_unidvb: DMA setup failed\n");
		dev_err(&pci_dev->dev, "netup_unidvb: DMA setup failed\n");
		goto dma_setup_err;
		goto dma_setup_err;
	}
	}

	if (request_irq(pci_dev->irq, netup_unidvb_isr, IRQF_SHARED,
			"netup_unidvb", pci_dev) < 0) {
		dev_err(&pci_dev->dev,
			"%s(): can't get IRQ %d\n", __func__, pci_dev->irq);
		goto dma_setup_err;
	}

	dev_info(&pci_dev->dev,
	dev_info(&pci_dev->dev,
		"netup_unidvb: device has been initialized\n");
		"netup_unidvb: device has been initialized\n");
	return 0;
	return 0;
@@ -951,8 +954,6 @@ static int netup_unidvb_initdev(struct pci_dev *pci_dev,
	dma_free_coherent(&pci_dev->dev, ndev->dma_size,
	dma_free_coherent(&pci_dev->dev, ndev->dma_size,
			ndev->dma_virt, ndev->dma_phys);
			ndev->dma_virt, ndev->dma_phys);
dma_alloc_err:
dma_alloc_err:
	free_irq(pci_dev->irq, pci_dev);
irq_request_err:
	iounmap(ndev->lmmio1);
	iounmap(ndev->lmmio1);
pci_bar1_error:
pci_bar1_error:
	iounmap(ndev->lmmio0);
	iounmap(ndev->lmmio0);