aboutsummaryrefslogtreecommitdiff
path: root/src
diff options
context:
space:
mode:
authorPer Åstrand <per.astrand@arm.com>2020-09-28 08:44:42 +0200
committerPer Åstrand <per.astrand@arm.com>2020-09-28 12:44:45 +0200
commitc801901c992ca632a0beb1eeb78b42c910e2e0aa (patch)
treeeb28f42a42916e31b4efe780df7c747523dc1840 /src
parentc6c1db160f8dbb817420d6bda906bc57a0defa2a (diff)
downloadethos-u-core-driver-c801901c992ca632a0beb1eeb78b42c910e2e0aa.tar.gz
Don't use NULL for integer variables
Avoid using NULL to initialize and compare with for integer variables. Change-Id: I1c370a9bb213dc93db845149d123915273411551
Diffstat (limited to 'src')
-rw-r--r--src/ethosu_device.c4
-rw-r--r--src/ethosu_driver.c4
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];