openocd: fix simple cases of NULL comparison
[openocd.git] / src / svf / svf.c
index 10ad7e7136dd324cfd7e566792d922b4e830b435..e12fbce23cc5913eac488da9614c5045b06b3603 100644 (file)
@@ -302,7 +302,7 @@ static int svf_realloc_buffers(size_t len)
 
 static void svf_free_xxd_para(struct svf_xxr_para *para)
 {
-       if (NULL != para) {
+       if (para) {
                free(para->tdi);
                para->tdi = NULL;
 
@@ -395,7 +395,7 @@ COMMAND_HANDLER(handle_svf_command)
                        svf_ignore_error = 1;
                else {
                        svf_fd = fopen(CMD_ARGV[i], "r");
-                       if (svf_fd == NULL) {
+                       if (!svf_fd) {
                                int err = errno;
                                command_print(CMD, "open(\"%s\"): %s", CMD_ARGV[i], strerror(err));
                                /* no need to free anything now */
@@ -405,7 +405,7 @@ COMMAND_HANDLER(handle_svf_command)
                }
        }
 
-       if (svf_fd == NULL)
+       if (!svf_fd)
                return ERROR_COMMAND_SYNTAX_ERROR;
 
        /* get time */
@@ -417,7 +417,7 @@ COMMAND_HANDLER(handle_svf_command)
 
        svf_check_tdo_para_index = 0;
        svf_check_tdo_para = malloc(sizeof(struct svf_check_tdo_para) * SVF_CHECK_TDO_PARA_SIZE);
-       if (NULL == svf_check_tdo_para) {
+       if (!svf_check_tdo_para) {
                LOG_ERROR("not enough memory");
                ret = ERROR_FAIL;
                goto free_all;
@@ -675,7 +675,7 @@ static int svf_read_command_from_file(FILE *fd)
                                if (cmd_pos + 3 > svf_command_buffer_size) {
                                        svf_command_buffer = realloc(svf_command_buffer, cmd_pos + 3);
                                        svf_command_buffer_size = cmd_pos + 3;
-                                       if (svf_command_buffer == NULL) {
+                                       if (!svf_command_buffer) {
                                                LOG_ERROR("not enough memory");
                                                return ERROR_FAIL;
                                        }
@@ -1091,7 +1091,7 @@ xxr_common:
                        }
                        /* If TDO is absent, no comparison is needed, set the mask to 0 */
                        if (!(xxr_para_tmp->data_mask & XXR_TDO)) {
-                               if (NULL == xxr_para_tmp->tdo) {
+                               if (!xxr_para_tmp->tdo) {
                                        if (ERROR_OK !=
                                        svf_adjust_array_length(&xxr_para_tmp->tdo, i_tmp,
                                                xxr_para_tmp->len)) {
@@ -1099,7 +1099,7 @@ xxr_common:
                                                return ERROR_FAIL;
                                        }
                                }
-                               if (NULL == xxr_para_tmp->mask) {
+                               if (!xxr_para_tmp->mask) {
                                        if (ERROR_OK !=
                                        svf_adjust_array_length(&xxr_para_tmp->mask, i_tmp,
                                                xxr_para_tmp->len)) {
@@ -1420,7 +1420,7 @@ xxr_common:
                        if (num_of_argu > 2) {
                                /* STATE pathstate1 ... stable_state */
                                path = malloc((num_of_argu - 1) * sizeof(tap_state_t));
-                               if (NULL == path) {
+                               if (!path) {
                                        LOG_ERROR("not enough memory");
                                        return ERROR_FAIL;
                                }

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)