openocd: fix SPDX tag format for files .c
[fw/openocd] / src / transport / transport.c
index 9214dcd774fcabb392e703a74090efe56f1f71d2..d72a48baa9bcb5a17f51debc2f5525fc28d0b88c 100644 (file)
@@ -1,18 +1,7 @@
+// SPDX-License-Identifier: GPL-2.0-or-later
+
 /*
  * Copyright (c) 2010 by David Brownell
- *
- * This program is free software; you can redistribute it and/or modify
- * it under the terms of the GNU General Public License as published by
- * the Free Software Foundation; either version 2 of the License, or
- * (at your option) any later version.
-
- * This program is distributed in the hope that it will be useful,
- * but WITHOUT ANY WARRANTY; without even the implied warranty of
- * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the
- * GNU General Public License for more details.
-
- * You should have received a copy of the GNU General Public License
- * along with this program.  If not, see <http://www.gnu.org/licenses/>.
  */
 
 #ifdef HAVE_CONFIG_H
@@ -42,6 +31,7 @@
  */
 
 #include <helper/log.h>
+#include <helper/replacements.h>
 #include <transport/transport.h>
 
 extern struct command_context *global_cmd_ctx;
@@ -105,7 +95,7 @@ int allow_transports(struct command_context *ctx, const char * const *vector)
         * of one transport; C code should be definitive about what
         * can be used when all goes well.
         */
-       if (allowed_transports != NULL || session) {
+       if (allowed_transports || session) {
                LOG_ERROR("Can't modify the set of allowed transports.");
                return ERROR_FAIL;
        }
@@ -121,16 +111,6 @@ int allow_transports(struct command_context *ctx, const char * const *vector)
        return ERROR_OK;
 }
 
-/**
- * Used to verify correct adapter driver initialization.
- *
- * @returns true if the adapter declares one or more transports.
- */
-bool transports_are_declared(void)
-{
-       return allowed_transports != NULL;
-}
-
 /**
  * Registers a transport.  There are general purpose transports
  * (such as JTAG), as well as relatively proprietary ones which are
@@ -206,7 +186,7 @@ COMMAND_HELPER(transport_list_parse, char ***vector)
 
        /* our return vector must be NULL terminated */
        argv = calloc(n + 1, sizeof(char *));
-       if (argv == NULL)
+       if (!argv)
                return ERROR_FAIL;
 
        for (unsigned i = 0; i < n; i++) {