summaryrefslogtreecommitdiffstats
path: root/drivers/spi
diff options
context:
space:
mode:
authorXiongfeng Wang <wangxiongfeng2@huawei.com>2022-11-16 17:32:04 +0800
committerMark Brown <broonie@kernel.org>2022-11-16 13:43:03 +0000
commit804313b64e412a81b0b3389a10e7622452004aa6 (patch)
treea29c2da8dbd30df7afcb884bf89d785a8508f0cd /drivers/spi
parentdb2d2dc9a0b58c6faefb6b002fdbed4f0362d1a4 (diff)
downloadlinux-804313b64e412a81b0b3389a10e7622452004aa6.tar.bz2
spi: dw-dma: decrease reference count in dw_spi_dma_init_mfld()
pci_get_device() will increase the reference count for the returned pci_dev. Since 'dma_dev' is only used to filter the channel in dw_spi_dma_chan_filer() after using it we need to call pci_dev_put() to decrease the reference count. Also add pci_dev_put() for the error case. Fixes: 7063c0d942a1 ("spi/dw_spi: add DMA support") Signed-off-by: Xiongfeng Wang <wangxiongfeng2@huawei.com> Acked-by: Serge Semin <fancer.lancer@gmail.com> Link: https://lore.kernel.org/r/20221116093204.46700-1-wangxiongfeng2@huawei.com Signed-off-by: Mark Brown <broonie@kernel.org>
Diffstat (limited to 'drivers/spi')
-rw-r--r--drivers/spi/spi-dw-dma.c3
1 files changed, 3 insertions, 0 deletions
diff --git a/drivers/spi/spi-dw-dma.c b/drivers/spi/spi-dw-dma.c
index 1322b8cce5b7..ababb910b391 100644
--- a/drivers/spi/spi-dw-dma.c
+++ b/drivers/spi/spi-dw-dma.c
@@ -128,12 +128,15 @@ static int dw_spi_dma_init_mfld(struct device *dev, struct dw_spi *dws)
dw_spi_dma_sg_burst_init(dws);
+ pci_dev_put(dma_dev);
+
return 0;
free_rxchan:
dma_release_channel(dws->rxchan);
dws->rxchan = NULL;
err_exit:
+ pci_dev_put(dma_dev);
return -EBUSY;
}