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/nrf5.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/nrf5.c')
-rw-r--r-- | src/flash/nor/nrf5.c | 16 |
1 files changed, 8 insertions, 8 deletions
diff --git a/src/flash/nor/nrf5.c b/src/flash/nor/nrf5.c index 9decbea..8870164 100644 --- a/src/flash/nor/nrf5.c +++ b/src/flash/nor/nrf5.c @@ -293,7 +293,7 @@ static bool nrf5_bank_is_probed(const struct flash_bank *bank) { struct nrf5_bank *nbank = bank->driver_priv; - assert(nbank != NULL); + assert(nbank); return nbank->probed; } @@ -444,7 +444,7 @@ static int nrf5_protect_check_clenr0(struct flash_bank *bank) struct nrf5_bank *nbank = bank->driver_priv; struct nrf5_info *chip = nbank->chip; - assert(chip != NULL); + assert(chip); res = target_read_u32(chip->target, NRF51_FICR_CLENR0, &clenr0); @@ -474,7 +474,7 @@ static int nrf5_protect_check_bprot(struct flash_bank *bank) struct nrf5_bank *nbank = bank->driver_priv; struct nrf5_info *chip = nbank->chip; - assert(chip != NULL); + assert(chip); static uint32_t nrf5_bprot_offsets[4] = { 0x600, 0x604, 0x610, 0x614 }; uint32_t bprot_reg = 0; @@ -505,7 +505,7 @@ static int nrf5_protect_check(struct flash_bank *bank) struct nrf5_bank *nbank = bank->driver_priv; struct nrf5_info *chip = nbank->chip; - assert(chip != NULL); + assert(chip); if (chip->features & NRF5_FEATURE_BPROT) return nrf5_protect_check_bprot(bank); @@ -1133,7 +1133,7 @@ static void nrf5_free_driver_priv(struct flash_bank *bank) { struct nrf5_bank *nbank = bank->driver_priv; struct nrf5_info *chip = nbank->chip; - if (chip == NULL) + if (!chip) return; chip->refcount--; @@ -1197,7 +1197,7 @@ FLASH_BANK_COMMAND_HANDLER(nrf5_flash_bank_command) nbank = &chip->bank[1]; break; } - assert(nbank != NULL); + assert(nbank); chip->refcount++; nbank->chip = chip; @@ -1218,7 +1218,7 @@ COMMAND_HANDLER(nrf5_handle_mass_erase_command) if (res != ERROR_OK) return res; - assert(bank != NULL); + assert(bank); struct nrf5_info *chip; @@ -1265,7 +1265,7 @@ COMMAND_HANDLER(nrf5_handle_info_command) if (res != ERROR_OK) return res; - assert(bank != NULL); + assert(bank); struct nrf5_info *chip; |