Skip to content

Commit a69e89b

Browse files
committed
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
2 parents 0321da8 + bf8d87c commit a69e89b

1 file changed

Lines changed: 12 additions & 2 deletions

File tree

drivers/pci/endpoint/functions/pci-epf-test.c

Lines changed: 12 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -285,7 +285,17 @@ static int pci_epf_test_copy(struct pci_epf_test *epf_test)
285285
if (ret)
286286
dev_err(dev, "Data transfer failed\n");
287287
} else {
288-
memcpy(dst_addr, src_addr, reg->size);
288+
void *buf;
289+
290+
buf = kzalloc(reg->size, GFP_KERNEL);
291+
if (!buf) {
292+
ret = -ENOMEM;
293+
goto err_map_addr;
294+
}
295+
296+
memcpy_fromio(buf, src_addr, reg->size);
297+
memcpy_toio(dst_addr, buf, reg->size);
298+
kfree(buf);
289299
}
290300
ktime_get_ts64(&end);
291301
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)
441451
if (!epf_test->dma_supported) {
442452
dev_err(dev, "Cannot transfer data using DMA\n");
443453
ret = -EINVAL;
444-
goto err_map_addr;
454+
goto err_dma_map;
445455
}
446456

447457
src_phys_addr = dma_map_single(dma_dev, buf, reg->size,

0 commit comments

Comments
 (0)