aboutsummaryrefslogtreecommitdiff
path: root/src
diff options
context:
space:
mode:
authorAntonio Borneo <borneo.antonio@gmail.com>2023-04-09 00:00:37 +0200
committerAntonio Borneo <borneo.antonio@gmail.com>2023-05-05 22:08:38 +0000
commitaa1214280d11c32f82961da44dee863098e1ac38 (patch)
tree082d6a22ce07dfa4b87e171ed303e16398993f31 /src
parentd4fe63e36b662ad274783585ff7222befbf54268 (diff)
downloadriscv-openocd-aa1214280d11c32f82961da44dee863098e1ac38.zip
riscv-openocd-aa1214280d11c32f82961da44dee863098e1ac38.tar.gz
riscv-openocd-aa1214280d11c32f82961da44dee863098e1ac38.tar.bz2
flash: with pointers, use NULL instead of 0
Don't compare pointers with 0, use NULL when needed. Don't pass 0 ad pointer argument, pass NULL. Detected through 'sparse' tool. Change-Id: I118554fffde41c94cea9e1201ea941ff3c1ee762 Signed-off-by: Antonio Borneo <borneo.antonio@gmail.com> Reviewed-on: https://review.openocd.org/c/openocd/+/7595 Tested-by: jenkins
Diffstat (limited to 'src')
-rw-r--r--src/flash/nand/lpc32xx.c2
-rw-r--r--src/flash/nor/msp432.c2
-rw-r--r--src/flash/nor/stellaris.c2
3 files changed, 3 insertions, 3 deletions
diff --git a/src/flash/nand/lpc32xx.c b/src/flash/nand/lpc32xx.c
index 2c578d1..f8b59b3 100644
--- a/src/flash/nand/lpc32xx.c
+++ b/src/flash/nand/lpc32xx.c
@@ -1029,7 +1029,7 @@ static int lpc32xx_write_page_slc(struct nand_device *nand,
LOG_DEBUG("SLC write page %" PRIx32 " data=%d, oob=%d, "
"data_size=%" PRIu32 ", oob_size=%" PRIu32,
- page, data != 0, oob != 0, data_size, oob_size);
+ page, !!data, !!oob, data_size, oob_size);
target_mem_base = pworking_area->address;
/*
diff --git a/src/flash/nor/msp432.c b/src/flash/nor/msp432.c
index d9b9695..5e2935d 100644
--- a/src/flash/nor/msp432.c
+++ b/src/flash/nor/msp432.c
@@ -375,7 +375,7 @@ static int msp432_init(struct flash_bank *bank)
buf_set_u32(reg_params[0].value, 0, 32, ALGO_STACK_POINTER_ADDR);
/* Begin executing the flash helper algorithm */
- retval = target_start_algorithm(target, 0, 0, 1, reg_params,
+ retval = target_start_algorithm(target, 0, NULL, 1, reg_params,
algo_entry_addr, 0, &msp432_bank->armv7m_info);
destroy_reg_param(&reg_params[0]);
if (retval != ERROR_OK) {
diff --git a/src/flash/nor/stellaris.c b/src/flash/nor/stellaris.c
index 3a78952..972686e 100644
--- a/src/flash/nor/stellaris.c
+++ b/src/flash/nor/stellaris.c
@@ -1342,7 +1342,7 @@ COMMAND_HANDLER(stellaris_handle_recover_command)
* cycle to recover.
*/
- Jim_Eval_Named(CMD_CTX->interp, "catch { hla_command \"debug unlock\" }", 0, 0);
+ Jim_Eval_Named(CMD_CTX->interp, "catch { hla_command \"debug unlock\" }", NULL, 0);
if (!strcmp(Jim_GetString(Jim_GetResult(CMD_CTX->interp), NULL), "0")) {
retval = ERROR_OK;
goto user_action;