summaryrefslogtreecommitdiff
path: root/src/vendorcode/cavium/bdk/libbdk-dram
diff options
context:
space:
mode:
authorJacob Garber <jgarber1@ualberta.ca>2019-07-26 11:45:43 -0600
committerPatrick Georgi <pgeorgi@google.com>2019-07-30 09:55:59 +0000
commit4926e989ac2f83bd887bee683c7e2c0481f5cd3a (patch)
tree33517fa1c093e45a6154af542a2e297e81d265f5 /src/vendorcode/cavium/bdk/libbdk-dram
parent9f378d3b0395b2e7b5a8972cf69f1c6fdcabfe09 (diff)
vc/cavium/{bdk,include}: Clean up bdk_phys_to_ptr() calls
The bdk_phys_to_ptr() function converts a uint64_t address to a void * pointer. Judging by the comments, the old implementation had a check that would refuse to convert a null pointer, which required several workarounds when trying to convert the address 0 to a pointer. This isn't the case for coreboot though, which implements this function as a simple (void *) cast, so we can remove the old workarounds. Change-Id: I6537d1699e6726c1fb155d69a51e14da856232de Signed-off-by: Jacob Garber <jgarber1@ualberta.ca> Found-by: Coverity CID 1393962 Reviewed-on: https://review.coreboot.org/c/coreboot/+/34590 Tested-by: build bot (Jenkins) <no-reply@coreboot.org> Reviewed-by: Patrick Rudolph <siro@das-labor.org>
Diffstat (limited to 'src/vendorcode/cavium/bdk/libbdk-dram')
-rw-r--r--src/vendorcode/cavium/bdk/libbdk-dram/bdk-dram-test-addrbus.c2
-rw-r--r--src/vendorcode/cavium/bdk/libbdk-dram/bdk-dram-test.c10
2 files changed, 4 insertions, 8 deletions
diff --git a/src/vendorcode/cavium/bdk/libbdk-dram/bdk-dram-test-addrbus.c b/src/vendorcode/cavium/bdk/libbdk-dram/bdk-dram-test-addrbus.c
index 834ade4c40..afa1ed28af 100644
--- a/src/vendorcode/cavium/bdk/libbdk-dram/bdk-dram-test-addrbus.c
+++ b/src/vendorcode/cavium/bdk/libbdk-dram/bdk-dram-test-addrbus.c
@@ -60,7 +60,7 @@ int __bdk_dram_test_mem_address_bus(uint64_t area, uint64_t max_address, int bur
/* Clear our work area. Checking for aliases later could get false
positives if it matched stale data */
- void *ptr = (area) ? bdk_phys_to_ptr(area) : NULL;
+ void *ptr = bdk_phys_to_ptr(area);
bdk_zero_memory(ptr, max_address - area);
__bdk_dram_flush_to_mem_range(area, max_address);
diff --git a/src/vendorcode/cavium/bdk/libbdk-dram/bdk-dram-test.c b/src/vendorcode/cavium/bdk/libbdk-dram/bdk-dram-test.c
index 5e6e4bcf11..9c78667116 100644
--- a/src/vendorcode/cavium/bdk/libbdk-dram/bdk-dram-test.c
+++ b/src/vendorcode/cavium/bdk/libbdk-dram/bdk-dram-test.c
@@ -101,9 +101,7 @@ static uint64_t dram_test_thread_size;
void __bdk_dram_flush_to_mem(uint64_t address)
{
BDK_MB;
- /* The DRAM code doesn't use the normal bdk_phys_to_ptr() because of the
- NULL check in it. This greatly slows down the memory tests */
- char *ptr = (void*)address;
+ char *ptr = bdk_phys_to_ptr(address);
BDK_CACHE_WBI_L2(ptr);
}
@@ -116,10 +114,8 @@ void __bdk_dram_flush_to_mem(uint64_t address)
*/
void __bdk_dram_flush_to_mem_range(uint64_t area, uint64_t max_address)
{
- /* The DRAM code doesn't use the normal bdk_phys_to_ptr() because of the
- NULL check in it. This greatly slows down the memory tests */
- char *ptr = (void*)area;
- char *end = (void*)max_address;
+ char *ptr = bdk_phys_to_ptr(area);
+ char *end = bdk_phys_to_ptr(max_address);
BDK_MB;
while (ptr < end)
{