diff options
author | Antonio Borneo <borneo.antonio@gmail.com> | 2021-07-03 18:51:20 +0200 |
---|---|---|
committer | Antonio Borneo <borneo.antonio@gmail.com> | 2021-07-24 10:37:49 +0100 |
commit | 08ee7bb982b16742f52cfdc6c649d82ffa2eb177 (patch) | |
tree | a824d376b774499303f00cffb201e35b01830d98 /src/flash/nor/psoc4.c | |
parent | b159f5cdedd70fff9309722e927be670845f4df5 (diff) | |
download | riscv-openocd-08ee7bb982b16742f52cfdc6c649d82ffa2eb177.zip riscv-openocd-08ee7bb982b16742f52cfdc6c649d82ffa2eb177.tar.gz riscv-openocd-08ee7bb982b16742f52cfdc6c649d82ffa2eb177.tar.bz2 |
openocd: fix simple cases of NULL comparison
There are more than 1000 NULL comparisons to be aligned to the
coding style.
For recurrent NULL comparison it's preferable using trivial
scripts in order to minimize the review effort.
Patch generated automatically with the command:
sed -i PATTERN $(find src/ -type f)
where PATTERN is in the list:
's/(\([a-z][a-z0-9_]*\) == NULL)/(!\1)/g'
's/(\([a-z][a-z0-9_]*->[a-z][a-z0-9_]*\) == NULL)/(!\1)/g'
's/(\([a-z][a-z0-9_]*\.[a-z][a-z0-9_]*\) == NULL)/(!\1)/g'
's/(\([a-z][a-z0-9_]*\) != NULL)/(\1)/g'
's/(\([a-z][a-z0-9_]*->[a-z][a-z0-9_]*\) != NULL)/(\1)/g'
's/(\([a-z][a-z0-9_]*\.[a-z][a-z0-9_]*\) != NULL)/(\1)/g'
's/(NULL == \([a-z][a-z0-9_]*\))/(!\1)/g'
's/(NULL == \([a-z][a-z0-9_]*->[a-z][a-z0-9_]*\))/(!\1)/g'
's/(NULL == \([a-z][a-z0-9_]*\.[a-z][a-z0-9_]*\))/(!\1)/g'
's/(NULL != \([a-z][a-z0-9_]*\))/(\1)/g'
's/(NULL != \([a-z][a-z0-9_]*->[a-z][a-z0-9_]*\))/(\1)/g'
's/(NULL != \([a-z][a-z0-9_]*\.[a-z][a-z0-9_]*\))/(\1)/g'
Change-Id: Ida103e325d6d0600fb69c0b7a1557ee969db4417
Signed-off-by: Antonio Borneo <borneo.antonio@gmail.com>
Reviewed-on: http://openocd.zylin.com/6350
Tested-by: jenkins
Diffstat (limited to 'src/flash/nor/psoc4.c')
-rw-r--r-- | src/flash/nor/psoc4.c | 8 |
1 files changed, 4 insertions, 4 deletions
diff --git a/src/flash/nor/psoc4.c b/src/flash/nor/psoc4.c index 28c2124..609d3b9 100644 --- a/src/flash/nor/psoc4.c +++ b/src/flash/nor/psoc4.c @@ -320,7 +320,7 @@ static int psoc4_sysreq(struct flash_bank *bank, uint8_t cmd, sysreq_wait_algorithm->address + sysreq_wait_algorithm->size); struct armv7m_common *armv7m = target_to_armv7m(target); - if (armv7m == NULL) { + if (!armv7m) { /* something is very wrong if armv7m is NULL */ LOG_ERROR("unable to get armv7m target"); retval = ERROR_FAIL; @@ -576,7 +576,7 @@ static int psoc4_protect(struct flash_bank *bank, int set, unsigned int first, int prot_sz = num_bits / 8; sysrq_buffer = malloc(param_sz + prot_sz); - if (sysrq_buffer == NULL) { + if (!sysrq_buffer) { LOG_ERROR("no memory for row buffer"); return ERROR_FAIL; } @@ -658,7 +658,7 @@ static int psoc4_write(struct flash_bank *bank, const uint8_t *buffer, return retval; sysrq_buffer = malloc(param_sz + psoc4_info->row_size); - if (sysrq_buffer == NULL) { + if (!sysrq_buffer) { LOG_ERROR("no memory for row buffer"); return ERROR_FAIL; } @@ -833,7 +833,7 @@ static int psoc4_probe(struct flash_bank *bank) bank->size = num_rows * row_size; bank->num_sectors = num_rows; bank->sectors = alloc_block_array(0, row_size, num_rows); - if (bank->sectors == NULL) + if (!bank->sectors) return ERROR_FAIL; LOG_DEBUG("flash bank set %" PRIu32 " rows", num_rows); |