mirror of
https://github.com/Fishwaldo/Star64_linux.git
synced 2025-07-23 23:32:14 +00:00
ath10k: convert pci_alloc_consistent() to dma_alloc_coherent()
This allows to use GFP_KERNEL allocation. This should decrease chance of allocation failure, e.g. during firmware recovery. Reported-By: Avery Pennarun <apenwarr@gmail.com> Signed-off-by: Michal Kazior <michal.kazior@tieto.com> Signed-off-by: Kalle Valo <kvalo@qca.qualcomm.com>
This commit is contained in:
parent
c508671dd5
commit
68c03249f3
2 changed files with 37 additions and 38 deletions
|
@ -358,9 +358,10 @@ static int ath10k_pci_diag_read_mem(struct ath10k *ar, u32 address, void *data,
|
|||
* 2) Buffer in DMA-able space
|
||||
*/
|
||||
orig_nbytes = nbytes;
|
||||
data_buf = (unsigned char *)pci_alloc_consistent(ar_pci->pdev,
|
||||
orig_nbytes,
|
||||
&ce_data_base);
|
||||
data_buf = (unsigned char *)dma_alloc_coherent(ar->dev,
|
||||
orig_nbytes,
|
||||
&ce_data_base,
|
||||
GFP_ATOMIC);
|
||||
|
||||
if (!data_buf) {
|
||||
ret = -ENOMEM;
|
||||
|
@ -458,8 +459,8 @@ done:
|
|||
address, ret);
|
||||
|
||||
if (data_buf)
|
||||
pci_free_consistent(ar_pci->pdev, orig_nbytes,
|
||||
data_buf, ce_data_base);
|
||||
dma_free_coherent(ar->dev, orig_nbytes, data_buf,
|
||||
ce_data_base);
|
||||
|
||||
return ret;
|
||||
}
|
||||
|
@ -502,9 +503,10 @@ static int ath10k_pci_diag_write_mem(struct ath10k *ar, u32 address,
|
|||
* 2) Buffer in DMA-able space
|
||||
*/
|
||||
orig_nbytes = nbytes;
|
||||
data_buf = (unsigned char *)pci_alloc_consistent(ar_pci->pdev,
|
||||
orig_nbytes,
|
||||
&ce_data_base);
|
||||
data_buf = (unsigned char *)dma_alloc_coherent(ar->dev,
|
||||
orig_nbytes,
|
||||
&ce_data_base,
|
||||
GFP_ATOMIC);
|
||||
if (!data_buf) {
|
||||
ret = -ENOMEM;
|
||||
goto done;
|
||||
|
@ -600,8 +602,8 @@ static int ath10k_pci_diag_write_mem(struct ath10k *ar, u32 address,
|
|||
|
||||
done:
|
||||
if (data_buf) {
|
||||
pci_free_consistent(ar_pci->pdev, orig_nbytes, data_buf,
|
||||
ce_data_base);
|
||||
dma_free_coherent(ar->dev, orig_nbytes, data_buf,
|
||||
ce_data_base);
|
||||
}
|
||||
|
||||
if (ret != 0)
|
||||
|
|
Loading…
Add table
Add a link
Reference in a new issue