From 4926e989ac2f83bd887bee683c7e2c0481f5cd3a Mon Sep 17 00:00:00 2001 From: Jacob Garber Date: Fri, 26 Jul 2019 11:45:43 -0600 Subject: 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 Found-by: Coverity CID 1393962 Reviewed-on: https://review.coreboot.org/c/coreboot/+/34590 Tested-by: build bot (Jenkins) Reviewed-by: Patrick Rudolph --- src/vendorcode/cavium/bdk/libbdk-hal/bdk-l2c.c | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) (limited to 'src/vendorcode/cavium/bdk/libbdk-hal/bdk-l2c.c') diff --git a/src/vendorcode/cavium/bdk/libbdk-hal/bdk-l2c.c b/src/vendorcode/cavium/bdk/libbdk-hal/bdk-l2c.c index 6c163da2d4..aa7d6582a8 100644 --- a/src/vendorcode/cavium/bdk/libbdk-hal/bdk-l2c.c +++ b/src/vendorcode/cavium/bdk/libbdk-hal/bdk-l2c.c @@ -141,7 +141,7 @@ int bdk_l2c_unlock_mem_region(bdk_node_t node, uint64_t start, uint64_t len) len += start & BDK_CACHE_LINE_MASK; start &= ~BDK_CACHE_LINE_MASK; len = (len + BDK_CACHE_LINE_MASK) & ~BDK_CACHE_LINE_MASK; - void *ptr = (start) ? bdk_phys_to_ptr(start) : NULL; + void *ptr = bdk_phys_to_ptr(start); while (len > 0) { -- cgit v1.2.3