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/at91sam4.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/at91sam4.c')
-rw-r--r-- | src/flash/nor/at91sam4.c | 10 |
1 files changed, 5 insertions, 5 deletions
diff --git a/src/flash/nor/at91sam4.c b/src/flash/nor/at91sam4.c index 958ec5e..23d1c5f 100644 --- a/src/flash/nor/at91sam4.c +++ b/src/flash/nor/at91sam4.c @@ -2318,7 +2318,7 @@ static struct sam4_chip *target2sam4(struct target *target) { struct sam4_chip *chip; - if (target == NULL) + if (!target) return NULL; chip = all_sam4_chips; @@ -2611,7 +2611,7 @@ static int sam4_get_details(struct sam4_bank_private *private) else details++; } - if (details->name == NULL) { + if (!details->name) { LOG_ERROR("SAM4 ChipID 0x%08x not found in table (perhaps you can ID this chip?)", (unsigned int)(private->chip->cfg.CHIPID_CIDR)); /* Help the victim, print details about the chip */ @@ -2662,7 +2662,7 @@ static int sam4_info(struct flash_bank *bank, struct command_invocation *cmd) int k = bank->size / 1024; private = get_sam4_bank_private(bank); - if (private == NULL) + if (!private) return ERROR_FAIL; command_print_sameline(cmd, "%s bank %d: %d kB at " TARGET_ADDR_FMT, @@ -2715,9 +2715,9 @@ static int sam4_probe(struct flash_bank *bank) } } - if (bank->sectors == NULL) { + if (!bank->sectors) { bank->sectors = calloc(private->nsectors, (sizeof((bank->sectors)[0]))); - if (bank->sectors == NULL) { + if (!bank->sectors) { LOG_ERROR("No memory!"); return ERROR_FAIL; } |