diff options
author | 2022-03-22 17:16:23 -0500 | |
---|---|---|
committer | 2022-03-22 17:16:23 -0500 | |
commit | a69e89ba6c810295b4ce795ce38088788857822f (patch) | |
tree | ddc98a49b384d4a77e8c83133b295dc5a8a8bfcc | |
parent | Merge branch 'pci/host/dwc' (diff) | |
parent | PCI: endpoint: Fix misused goto label (diff) | |
download | wireguard-linux-a69e89ba6c810295b4ce795ce38088788857822f.tar.xz wireguard-linux-a69e89ba6c810295b4ce795ce38088788857822f.zip |
Merge branch 'remotes/lorenzo/pci/endpoint'
- Fix alignment fault error in copy tests (Hou Zhiqiang)
- Fix misused goto label (Li Chen)
* remotes/lorenzo/pci/endpoint:
PCI: endpoint: Fix misused goto label
PCI: endpoint: Fix alignment fault error in copy tests
-rw-r--r-- | drivers/pci/endpoint/functions/pci-epf-test.c | 14 |
1 files changed, 12 insertions, 2 deletions
diff --git a/drivers/pci/endpoint/functions/pci-epf-test.c b/drivers/pci/endpoint/functions/pci-epf-test.c index 90d84d3bc868..5b833f00e980 100644 --- a/drivers/pci/endpoint/functions/pci-epf-test.c +++ b/drivers/pci/endpoint/functions/pci-epf-test.c @@ -285,7 +285,17 @@ static int pci_epf_test_copy(struct pci_epf_test *epf_test) if (ret) dev_err(dev, "Data transfer failed\n"); } else { - memcpy(dst_addr, src_addr, reg->size); + void *buf; + + buf = kzalloc(reg->size, GFP_KERNEL); + if (!buf) { + ret = -ENOMEM; + goto err_map_addr; + } + + memcpy_fromio(buf, src_addr, reg->size); + memcpy_toio(dst_addr, buf, reg->size); + kfree(buf); } ktime_get_ts64(&end); pci_epf_test_print_rate("COPY", reg->size, &start, &end, use_dma); @@ -441,7 +451,7 @@ static int pci_epf_test_write(struct pci_epf_test *epf_test) if (!epf_test->dma_supported) { dev_err(dev, "Cannot transfer data using DMA\n"); ret = -EINVAL; - goto err_map_addr; + goto err_dma_map; } src_phys_addr = dma_map_single(dma_dev, buf, reg->size, |