target: with pointers, use NULL instead of 0

Don't assign pointer to 0, use NULL.
Don't pass 0 ad pointer argument, pass NULL.

Detected through 'sparse' tool.

Change-Id: I806031d2ae505fa5f0accc6be1936d48cd365ca4
Signed-off-by: Antonio Borneo <borneo.antonio@gmail.com>
Reviewed-on: https://review.openocd.org/c/openocd/+/7604
Tested-by: jenkins
This commit is contained in:
Antonio Borneo 2023-04-09 01:40:51 +02:00
parent 4b7dc55738
commit d771d7f1a7
4 changed files with 10 additions and 10 deletions

View File

@ -57,7 +57,7 @@ static const struct arm9tdmi_vector {
{"dabt", ARM9TDMI_DABT_VECTOR},
{"irq", ARM9TDMI_IRQ_VECTOR},
{"fiq", ARM9TDMI_FIQ_VECTOR},
{0, 0},
{NULL, 0},
};
int arm9tdmi_examine_debug_reason(struct target *target)

View File

@ -274,7 +274,7 @@ static int dpmv8_instr_write_data_dcc(struct arm_dpm *dpm,
if (retval != ERROR_OK)
return retval;
return dpmv8_exec_opcode(dpm, opcode, 0);
return dpmv8_exec_opcode(dpm, opcode, NULL);
}
static int dpmv8_instr_write_data_dcc_64(struct arm_dpm *dpm,
@ -287,7 +287,7 @@ static int dpmv8_instr_write_data_dcc_64(struct arm_dpm *dpm,
if (retval != ERROR_OK)
return retval;
return dpmv8_exec_opcode(dpm, opcode, 0);
return dpmv8_exec_opcode(dpm, opcode, NULL);
}
static int dpmv8_instr_write_data_r0(struct arm_dpm *dpm,

View File

@ -60,7 +60,7 @@ static inline int dsp563xx_once_ir_exec(struct jtag_tap *tap, int flush, uint8_t
{
int err;
err = dsp563xx_write_dr_u8(tap, 0, instr | (ex << 5) | (go << 6) | (rw << 7), 8, 0);
err = dsp563xx_write_dr_u8(tap, NULL, instr | (ex << 5) | (go << 6) | (rw << 7), 8, 0);
if (err != ERROR_OK)
return err;
if (flush)
@ -226,7 +226,7 @@ int dsp563xx_once_reg_write(struct jtag_tap *tap, int flush, uint8_t reg, uint32
err = dsp563xx_once_ir_exec(tap, flush, reg, 0, 0, 0);
if (err != ERROR_OK)
return err;
err = dsp563xx_write_dr_u32(tap, 0x00, data, 24, 0);
err = dsp563xx_write_dr_u32(tap, NULL, data, 24, 0);
if (err != ERROR_OK)
return err;
if (flush)
@ -242,7 +242,7 @@ int dsp563xx_once_execute_sw_ir(struct jtag_tap *tap, int flush, uint32_t opcode
err = dsp563xx_once_ir_exec(tap, flush, DSP563XX_ONCE_OPDBR, 0, 1, 0);
if (err != ERROR_OK)
return err;
err = dsp563xx_write_dr_u32(tap, 0, opcode, 24, 0);
err = dsp563xx_write_dr_u32(tap, NULL, opcode, 24, 0);
if (err != ERROR_OK)
return err;
if (flush)
@ -258,7 +258,7 @@ int dsp563xx_once_execute_dw_ir(struct jtag_tap *tap, int flush, uint32_t opcode
err = dsp563xx_once_ir_exec(tap, flush, DSP563XX_ONCE_OPDBR, 0, 0, 0);
if (err != ERROR_OK)
return err;
err = dsp563xx_write_dr_u32(tap, 0, opcode, 24, 0);
err = dsp563xx_write_dr_u32(tap, NULL, opcode, 24, 0);
if (err != ERROR_OK)
return err;
if (flush) {
@ -270,7 +270,7 @@ int dsp563xx_once_execute_dw_ir(struct jtag_tap *tap, int flush, uint32_t opcode
err = dsp563xx_once_ir_exec(tap, flush, DSP563XX_ONCE_OPDBR, 0, 1, 0);
if (err != ERROR_OK)
return err;
err = dsp563xx_write_dr_u32(tap, 0, operand, 24, 0);
err = dsp563xx_write_dr_u32(tap, NULL, operand, 24, 0);
if (err != ERROR_OK)
return err;
if (flush) {

View File

@ -410,7 +410,7 @@ static int xtensa_core_reg_get(struct reg *reg)
return ERROR_TARGET_NOT_HALTED;
if (!reg->exist) {
if (strncmp(reg->name, "?0x", 3) == 0) {
unsigned int regnum = strtoul(reg->name + 1, 0, 0);
unsigned int regnum = strtoul(reg->name + 1, NULL, 0);
LOG_WARNING("Read unknown register 0x%04x ignored", regnum);
return ERROR_OK;
}
@ -430,7 +430,7 @@ static int xtensa_core_reg_set(struct reg *reg, uint8_t *buf)
if (!reg->exist) {
if (strncmp(reg->name, "?0x", 3) == 0) {
unsigned int regnum = strtoul(reg->name + 1, 0, 0);
unsigned int regnum = strtoul(reg->name + 1, NULL, 0);
LOG_WARNING("Write unknown register 0x%04x ignored", regnum);
return ERROR_OK;
}