Skip to content

Commit

Permalink
PCI: endpoint: functions: Use memcpy_fromio()/memcpy_toio()
Browse files Browse the repository at this point in the history
Functions copying from/to IO addresses should use the
memcpy_fromio()/memcpy_toio() API rather than plain memcpy().

Fix the issue detected through the sparse tool.

Fixes: 349e7a8 ("PCI: endpoint: functions: Add an EP function to test PCI")
Suggested-by: Kishon Vijay Abraham I <[email protected]>
Signed-off-by: Wen Yang <[email protected]>
[[email protected]: updated log]
Signed-off-by: Lorenzo Pieralisi <[email protected]>
Acked-by: Kishon Vijay Abraham I <[email protected]>
CC: Lorenzo Pieralisi <[email protected]>
CC: Bjorn Helgaas <[email protected]>
CC: Gustavo Pimentel <[email protected]>
CC: Niklas Cassel <[email protected]>
CC: Greg Kroah-Hartman <[email protected]>
CC: Cyrille Pitchen <[email protected]>
CC: [email protected]
CC: [email protected]
  • Loading branch information
taskset authored and Lorenzo Pieralisi committed Feb 13, 2019
1 parent bfeffd1 commit 726dabf
Showing 1 changed file with 2 additions and 2 deletions.
4 changes: 2 additions & 2 deletions drivers/pci/endpoint/functions/pci-epf-test.c
Original file line number Diff line number Diff line change
Expand Up @@ -175,7 +175,7 @@ static int pci_epf_test_read(struct pci_epf_test *epf_test)
goto err_map_addr;
}

memcpy(buf, src_addr, reg->size);
memcpy_fromio(buf, src_addr, reg->size);

crc32 = crc32_le(~0, buf, reg->size);
if (crc32 != reg->checksum)
Expand Down Expand Up @@ -230,7 +230,7 @@ static int pci_epf_test_write(struct pci_epf_test *epf_test)
get_random_bytes(buf, reg->size);
reg->checksum = crc32_le(~0, buf, reg->size);

memcpy(dst_addr, buf, reg->size);
memcpy_toio(dst_addr, buf, reg->size);

/*
* wait 1ms inorder for the write to complete. Without this delay L3
Expand Down

0 comments on commit 726dabf

Please sign in to comment.