Linux kernel mirror (for testing) git.kernel.org/pub/scm/linux/kernel/git/torvalds/linux.git
kernel os linux

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>

authored by

Xiongfeng Wang and committed by
Mark Brown
804313b6 db2d2dc9

+3
+3
drivers/spi/spi-dw-dma.c
··· 128 128 129 129 dw_spi_dma_sg_burst_init(dws); 130 130 131 + pci_dev_put(dma_dev); 132 + 131 133 return 0; 132 134 133 135 free_rxchan: 134 136 dma_release_channel(dws->rxchan); 135 137 dws->rxchan = NULL; 136 138 err_exit: 139 + pci_dev_put(dma_dev); 137 140 return -EBUSY; 138 141 } 139 142