diff mbox series

[v1] drivers:spi:Insert the missing pci_dev_put()before return

Message ID 20240820111236.550379-1-11162571@vivo.com (mailing list archive)
State New, archived
Headers show
Series [v1] drivers:spi:Insert the missing pci_dev_put()before return | expand

Commit Message

Yang Ruibin Aug. 20, 2024, 11:12 a.m. UTC
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 | 4 ++--
 1 file changed, 2 insertions(+), 2 deletions(-)

 
 	ret = pxa2xx_spi_pci_clk_register(dev, ssp, 25000000);
-	if (ret)
+	if (ret) {
+		pci_dev_put(dma_dev);
 		return ret;
+	}

Comments

Mark Brown Aug. 28, 2024, 8:54 p.m. UTC | #1
On Tue, Aug 20, 2024 at 07:12:35AM -0400, Yang Ruibin wrote:
> Increase the reference count by calling pci_get_slot(), and remember to 
> decrement the reference count by calling pci_dev_put().

I haven't seen exactly how but your patch is corrupted and can't be
applied:

Applying: spi: Insert the missing pci_dev_put() before return
error: corrupt patch at line 18
error: could not build fake ancestor
Patch failed at 0001 spi: Insert the missing pci_dev_put() before return

Please submit patches using subject lines reflecting the style for the
subsystem, this makes it easier for people to identify relevant patches.
Look at what existing commits in the area you're changing are doing and
make sure your subject lines visually resemble what they're doing.
There's no need to resubmit to fix this alone.
diff mbox series

Patch

diff --git a/drivers/spi/spi-pxa2xx-pci.c b/drivers/spi/spi-pxa2xx-pci.c
index 72bccb3b5..d49d8fef4 100644
--- a/drivers/spi/spi-pxa2xx-pci.c
+++ b/drivers/spi/spi-pxa2xx-pci.c
@@ -145,7 +145,7 @@  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;
+	}
@@ -223,7 +223,7 @@  static int mrfld_spi_setup(struct pci_dev *dev, struct pxa2xx_spi_controller *c)
 	}