diff mbox series

spi: add missing pci_dev_put() before return

Message ID 1644890407-65167-1-git-send-email-wangqing@vivo.com (mailing list archive)
State Accepted
Commit 4d986ffa036a773456476f70bd0fde2fb1330b7d
Headers show
Series spi: add missing pci_dev_put() before return | expand

Commit Message

王擎 Feb. 15, 2022, 2 a.m. UTC
From: Wang Qing <wangqing@vivo.com>

pci_get_slot() increases its reference count, the caller must
decrement the reference count by calling pci_dev_put()

Signed-off-by: Wang Qing <wangqing@vivo.com>
---
 drivers/spi/spi-topcliff-pch.c | 7 +++++--
 1 file changed, 5 insertions(+), 2 deletions(-)

Comments

Mark Brown Feb. 23, 2022, 4:08 a.m. UTC | #1
On Mon, 14 Feb 2022 18:00:07 -0800, Qing Wang wrote:
> From: Wang Qing <wangqing@vivo.com>
> 
> pci_get_slot() increases its reference count, the caller must
> decrement the reference count by calling pci_dev_put()
> 
> 

Applied to

   https://git.kernel.org/pub/scm/linux/kernel/git/broonie/spi.git for-next

Thanks!

[1/1] spi: add missing pci_dev_put() before return
      commit: 4d986ffa036a773456476f70bd0fde2fb1330b7d

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
Christophe JAILLET Feb. 23, 2022, 8:12 p.m. UTC | #2
Le 23/02/2022 à 05:08, Mark Brown a écrit :
> On Mon, 14 Feb 2022 18:00:07 -0800, Qing Wang wrote:
>> From: Wang Qing <wangqing-DGpbCiVdSXo@public.gmane.org>
>>
>> pci_get_slot() increases its reference count, the caller must
>> decrement the reference count by calling pci_dev_put()
>>
>>
> 
> Applied to
> 
>     https://git.kernel.org/pub/scm/linux/kernel/git/broonie/spi.git for-next
> 
> Thanks!
> 
> [1/1] spi: add missing pci_dev_put() before return
>        commit: 4d986ffa036a773456476f70bd0fde2fb1330b7d
> 

Hi, not sure that the patch is correct.

Shouldn't the reference be released in the error handling path and in 
pch_spi_release_dma() ?

Instead of *unconditionally* at the end of pch_spi_request_dma()?

CJ
diff mbox series

Patch

diff --git a/drivers/spi/spi-topcliff-pch.c b/drivers/spi/spi-topcliff-pch.c
index 8c4615b..8e1cc34
--- a/drivers/spi/spi-topcliff-pch.c
+++ b/drivers/spi/spi-topcliff-pch.c
@@ -877,7 +877,7 @@  static void pch_spi_request_dma(struct pch_spi_data *data, int bpw)
 		dev_err(&data->master->dev,
 			"ERROR: dma_request_channel FAILS(Tx)\n");
 		data->use_dma = 0;
-		return;
+		goto out;
 	}
 	dma->chan_tx = chan;
 
@@ -894,9 +894,12 @@  static void pch_spi_request_dma(struct pch_spi_data *data, int bpw)
 		dma_release_channel(dma->chan_tx);
 		dma->chan_tx = NULL;
 		data->use_dma = 0;
-		return;
+		goto out;
 	}
 	dma->chan_rx = chan;
+
+out:
+	pci_dev_put(dma_dev);
 }
 
 static void pch_spi_release_dma(struct pch_spi_data *data)