linux-arm-kernel.lists.infradead.org archive mirror
 help / color / mirror / Atom feed
* [PATCH v2] drivers: spi: Insert the missing pci_dev_put()before return
@ 2024-08-29  3:35 Yang Ruibin
  2024-08-29 17:38 ` Mark Brown
  2024-08-30  8:55 ` Geert Uytterhoeven
  0 siblings, 2 replies; 13+ messages in thread
From: Yang Ruibin @ 2024-08-29  3:35 UTC (permalink / raw)
  To: Daniel Mack, Haojian Zhuang, Robert Jarzmik, Mark Brown,
	linux-arm-kernel, linux-spi, linux-kernel
  Cc: opensource.kernel, Yang Ruibin

Increase the reference count by calling pci_get_slot(), and remember to
decrement the reference count by calling pci_dev_put().

Signed-off-by: Yang Ruibin <11162571@vivo.com>
---
 drivers/spi/spi-pxa2xx-pci.c | 8 ++++++--
 1 file changed, 6 insertions(+), 2 deletions(-)

diff --git a/drivers/spi/spi-pxa2xx-pci.c b/drivers/spi/spi-pxa2xx-pci.c
index cc8dcf782..a7bf4568f 100644
--- a/drivers/spi/spi-pxa2xx-pci.c
+++ b/drivers/spi/spi-pxa2xx-pci.c
@@ -146,8 +146,10 @@ static int lpss_spi_setup(struct pci_dev *dev, struct pxa2xx_spi_controller *c)
 	c->num_chipselect = 1;
 
 	ret = pxa2xx_spi_pci_clk_register(dev, ssp, 50000000);
-	if (ret)
+	if (ret) {
+		pci_dev_put(dma_dev);
 		return ret;
+	}
 
 	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);
@@ -222,8 +224,10 @@ static int mrfld_spi_setup(struct pci_dev *dev, struct pxa2xx_spi_controller *c)
 	}
 
 	ret = pxa2xx_spi_pci_clk_register(dev, ssp, 25000000);
-	if (ret)
+	if (ret) {
+		pci_dev_put(dma_dev);
 		return ret;
+	}
 
 	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);
-- 
2.34.1



^ permalink raw reply related	[flat|nested] 13+ messages in thread

end of thread, other threads:[~2024-09-03  6:30 UTC | newest]

Thread overview: 13+ messages (download: mbox.gz follow: Atom feed
-- links below jump to the message on this page --
2024-08-29  3:35 [PATCH v2] drivers: spi: Insert the missing pci_dev_put()before return Yang Ruibin
2024-08-29 17:38 ` Mark Brown
2024-08-30  8:55 ` Geert Uytterhoeven
2024-08-30 17:10   ` Krzysztof Kozlowski
2024-08-30 17:49     ` Jakub Kicinski
2024-09-02  7:15     ` Yuesong Li
2024-09-03  6:29       ` Greg Kroah-Hartman
2024-08-30 19:12   ` Andy Shevchenko
2024-08-30 19:56     ` Mark Brown
2024-09-02 10:21       ` Andy Shevchenko
2024-08-30 19:57   ` Mark Brown
2024-08-30 22:23     ` Nathan Chancellor
2024-09-02 11:48       ` Mark Brown

This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox;
as well as URLs for NNTP newsgroup(s).