spi: pxa2xx-pci: Balance reference count for PCI DMA device
Subsystems (3)
Andy Shevchenko
reviewerPATCH 1/1 spi: pxa2xx-pci: Balance reference count for PCI DMA device
The pci_get_slot() increases its reference count, the caller must decrement the reference count by calling pci_dev_put().
--- drivers/spi/spi-pxa2xx-pci.c | 17 ++++++++++++++++- 1 file changed, 16 insertions(+), 1 deletion(-)
drivers/spi/spi-pxa2xx-pci.c +16 -1
@@ -76,14 +76,23 @@ static bool lpss_dma_filter(struct dma_chan *chan, void *param)return true; } +static void lpss_dma_put_device (void *dma_dev) +{ +pci_dev_put (dma_dev); +} +static int lpss_spi_setup (struct pci_dev *dev,struct pxa_spi_info *c) {struct pci_dev *dma_dev; +int ret; c->num_chipselect =1 ; c->max_clk_rate =50000000 ; dma_dev =pci_get_slot (dev->bus,PCI_DEVFN (PCI_SLOT (dev->devfn),0 )); + ret =devm_add_action_or_reset (&dev->dev, lpss_dma_put_device, dma_dev); +if (ret) +return ret;if (c->tx_param) {struct dw_dma_slave *slave = c->tx_param;
@@ -107,8 +116,9 @@ static int lpss_spi_setup(struct pci_dev *dev, struct pxa_spi_info *c)static int mrfld_spi_setup (struct pci_dev *dev,struct pxa_spi_info *c) { -struct pci_dev *dma_dev =pci_get_slot (dev->bus,PCI_DEVFN (21 ,0 ));struct dw_dma_slave *tx, *rx; +struct pci_dev *dma_dev; +int ret;switch (PCI_FUNC (dev->devfn)) {case 0 :
@@ -133,6 +143,11 @@ static int mrfld_spi_setup(struct pci_dev *dev, struct pxa_spi_info *c)return -ENODEV ; } + dma_dev =pci_get_slot (dev->bus,PCI_DEVFN (21 ,0 )); + ret =devm_add_action_or_reset (&dev->dev, lpss_dma_put_device, dma_dev); +if (ret) +return ret; + tx = c->tx_param; tx->dma_dev = &dma_dev->dev;
Signature · 1 line
2.34.1
Mark Brown
maintainerQuoted 4 lines · Andy Shevchenko
The
pci_get_slot()increases its reference count, the caller must decrement the reference count by callingpci_dev_put().
Applied to
https://git.kernel.org/pub/scm/linux/kernel/git/broonie/spi.git for-next
Thanks!
[1/1] spi: pxa2xx-pci: Balance reference count for PCI DMA device
commit: 609d7ffdc42199a0ec949db057e3b4be6745d6c5
All being well this means that it will be integrated into the linux-next tree (usually sometime in the next 24 hours) and sent to Linus during the next merge window (or sooner if it is a bug fix), however if problems are discovered then the patch may be dropped or reverted.
You may get further e-mails resulting from automated or manual testing and review of the tree, please engage with people reporting problems and send followup patches addressing any issues that are reported if needed.
If any updates are required or you are submitting further changes they should be sent as incremental updates against current git, existing patches will not be replaced.
Please add any relevant lists and maintainers to the CCs when replying to this mail.
Thanks,
Mark