target: with pointers, use NULL instead of 0 04/7604/2
authorAntonio Borneo <borneo.antonio@gmail.com>
Sat, 8 Apr 2023 23:40:51 +0000 (01:40 +0200)
committerAntonio Borneo <borneo.antonio@gmail.com>
Fri, 5 May 2023 22:14:29 +0000 (22:14 +0000)
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
src/target/arm9tdmi.c
src/target/armv8_dpm.c
src/target/dsp563xx_once.c
src/target/xtensa/xtensa.c

index 805330f259d4b8079b1aa7004fd24b0cc4bfd50f..3bacfaefdf504d0e4ad2ddbfaf7e5617181549f4 100644 (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)
index fcd4d5971e9d87b2cba8d1312785a24642b5fe41..d1eefe5b32e25f1d46e4083b726e1ae68046efc1 100644 (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,
index 22445067aa8bd51f57951c4b4c474ba13c6ad052..866f33152d4b6c964f1b27a38888044872bd1090 100644 (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) {
index fcd00487c87efaa1d5682c83db86818b15021fa5..63ffefce708099d1efafd725260bb50f21ffee67 100644 (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;
                }

Linking to existing account procedure

If you already have an account and want to add another login method you MUST first sign in with your existing account and then change URL to read https://review.openocd.org/login/?link to get to this page again but this time it'll work for linking. Thank you.

SSH host keys fingerprints

1024 SHA256:YKx8b7u5ZWdcbp7/4AeXNaqElP49m6QrwfXaqQGJAOk gerrit-code-review@openocd.zylin.com (DSA)
384 SHA256:jHIbSQa4REvwCFG4cq5LBlBLxmxSqelQPem/EXIrxjk gerrit-code-review@openocd.org (ECDSA)
521 SHA256:UAOPYkU9Fjtcao0Ul/Rrlnj/OsQvt+pgdYSZ4jOYdgs gerrit-code-review@openocd.org (ECDSA)
256 SHA256:A13M5QlnozFOvTllybRZH6vm7iSt0XLxbA48yfc2yfY gerrit-code-review@openocd.org (ECDSA)
256 SHA256:spYMBqEYoAOtK7yZBrcwE8ZpYt6b68Cfh9yEVetvbXg gerrit-code-review@openocd.org (ED25519)
+--[ED25519 256]--+
|=..              |
|+o..   .         |
|*.o   . .        |
|+B . . .         |
|Bo. = o S        |
|Oo.+ + =         |
|oB=.* = . o      |
| =+=.+   + E     |
|. .=o   . o      |
+----[SHA256]-----+
2048 SHA256:0Onrb7/PHjpo6iVZ7xQX2riKN83FJ3KGU0TvI0TaFG4 gerrit-code-review@openocd.zylin.com (RSA)