diff options
author | Jacob Garber <jgarber1@ualberta.ca> | 2019-07-26 11:45:43 -0600 |
---|---|---|
committer | Patrick Georgi <pgeorgi@google.com> | 2019-07-30 09:55:59 +0000 |
commit | 4926e989ac2f83bd887bee683c7e2c0481f5cd3a (patch) | |
tree | 33517fa1c093e45a6154af542a2e297e81d265f5 /src/vendorcode/cavium/bdk/libdram/libdram.c | |
parent | 9f378d3b0395b2e7b5a8972cf69f1c6fdcabfe09 (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/libdram/libdram.c')
-rw-r--r-- | src/vendorcode/cavium/bdk/libdram/libdram.c | 5 |
1 files changed, 1 insertions, 4 deletions
diff --git a/src/vendorcode/cavium/bdk/libdram/libdram.c b/src/vendorcode/cavium/bdk/libdram/libdram.c index 214aa05b24..740de8498f 100644 --- a/src/vendorcode/cavium/bdk/libdram/libdram.c +++ b/src/vendorcode/cavium/bdk/libdram/libdram.c @@ -79,10 +79,7 @@ static void bdk_dram_clear_mem(bdk_node_t node) write to the cache line isn't good enough because partial LMC writes may be enabled */ ddr_print("N%d: Rewriting DRAM: start 0 length 0x%llx\n", node, skip); - volatile uint64_t *ptr = bdk_phys_to_ptr(bdk_numa_get_address(node, 8)); - /* The above pointer got address 8 to avoid NULL pointer checking - in bdk_phys_to_ptr(). Correct it here */ - ptr--; + volatile uint64_t *ptr = bdk_phys_to_ptr(bdk_numa_get_address(node, 0)); uint64_t *end = bdk_phys_to_ptr(bdk_numa_get_address(node, skip)); while (ptr < end) { |