From c801901c992ca632a0beb1eeb78b42c910e2e0aa Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Per=20=C3=85strand?= Date: Mon, 28 Sep 2020 08:44:42 +0200 Subject: Don't use NULL for integer variables Avoid using NULL to initialize and compare with for integer variables. Change-Id: I1c370a9bb213dc93db845149d123915273411551 --- src/ethosu_device.c | 4 ++-- src/ethosu_driver.c | 4 ++-- 2 files changed, 4 insertions(+), 4 deletions(-) diff --git a/src/ethosu_device.c b/src/ethosu_device.c index ba7e0d5..973caad 100644 --- a/src/ethosu_device.c +++ b/src/ethosu_device.c @@ -531,7 +531,7 @@ enum ethosu_error_codes ethosu_set_clock_and_power(struct ethosu_device *dev, uint32_t ethosu_read_reg(struct ethosu_device *dev, uint32_t address) { #if !defined(ARM_NPU_STUB) - ASSERT(dev->base_address != NULL); + ASSERT(dev->base_address != 0); volatile uint32_t *reg = (uint32_t *)(uintptr_t)(dev->base_address + address); return *reg; @@ -546,7 +546,7 @@ uint32_t ethosu_read_reg(struct ethosu_device *dev, uint32_t address) void ethosu_write_reg(struct ethosu_device *dev, uint32_t address, uint32_t value) { #if !defined(ARM_NPU_STUB) - ASSERT(dev->base_address != NULL); + ASSERT(dev->base_address != 0); volatile uint32_t *reg = (uint32_t *)(uintptr_t)(dev->base_address + address); *reg = value; diff --git a/src/ethosu_driver.c b/src/ethosu_driver.c index c640f25..2a2423f 100644 --- a/src/ethosu_driver.c +++ b/src/ethosu_driver.c @@ -149,7 +149,7 @@ struct opt_cfg_s ******************************************************************************/ struct ethosu_driver ethosu_drv = { - .dev = {.base_address = NULL, .pmccntr = 0, .pmu_evcntr = {0, 0, 0, 0}, .pmu_evtypr = {0, 0, 0, 0}}, + .dev = {.base_address = 0, .pmccntr = 0, .pmu_evcntr = {0, 0, 0, 0}, .pmu_evtypr = {0, 0, 0, 0}}, .abort_inference = false}; // IRQ @@ -323,7 +323,7 @@ int ethosu_invoke_v2(const void *custom_data_ptr, ++data_ptr; // Adjust base address to fast memory area - if (ethosu_drv.fast_memory != NULL && num_base_addr >= FAST_MEMORY_BASE_ADDR_INDEX) + if (ethosu_drv.fast_memory != 0 && num_base_addr >= FAST_MEMORY_BASE_ADDR_INDEX) { uint64_t *fast_memory = (uint64_t *)&base_addr[FAST_MEMORY_BASE_ADDR_INDEX]; -- cgit v1.2.1