Re: [PATCH] spi: dw-dma: decrease reference count in dw_spi_dma_init_mfld()

[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

 



Hi Serge,

On 2022/11/16 19:19, Serge Semin wrote:
> Hi Xiongfeng,
> 
> On Wed, Nov 16, 2022 at 05:32:04PM +0800, Xiongfeng Wang wrote:
>> 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 use pci_dev_put() to
>                          ^               ^            ^
>                          |               |            |
>                       drop the dot and comma          s/use/call
> 
> * Although this could be fixed by Mark on merging the patch in.

Thanks for your reply !  Sorry, I am not so sure about the modification.
Let me make sure it and send another version.
Do you mean change it like below:

  dw_spi_dma_chan_filer(), we need to use pci_dev_put() to

Thanks,
Xiongfeng

> 
>> 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@xxxxxxxxxx>
> 
> Nice catch. Thanks for the patch.
> Acked-by: Serge Semin <fancer.lancer@xxxxxxxxx>
> 
> -Sergey
> 
>> ---
>>  drivers/spi/spi-dw-dma.c | 3 +++
>>  1 file changed, 3 insertions(+)
>>
>> 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;
>>  }
>>  
>> -- 
>> 2.20.1
>>
> .
> 



[Index of Archives]     [Linux Kernel]     [Linux ARM (vger)]     [Linux ARM MSM]     [Linux Omap]     [Linux Arm]     [Linux Tegra]     [Fedora ARM]     [Linux for Samsung SOC]     [eCos]     [Linux Fastboot]     [Gcc Help]     [Git]     [DCCP]     [IETF Announce]     [Security]     [Linux MIPS]     [Yosemite Campsites]

  Powered by Linux