+/* 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
*/
#include <helper/log.h>
+#include <helper/replacements.h>
#include <transport/transport.h>
extern struct command_context *global_cmd_ctx;
* 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;
}
return ERROR_OK;
}
-/**
- * Used to verify corrrect adapter driver initialization.
- *
- * @returns true iff the adapter declared 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
* Code implementing a transport needs to register it before it can
* be selected and then activated. This is a dynamic process, so
* that chips (and families) can define transports as needed (without
- * nneeding error-prone static tables).
+ * needing error-prone static tables).
*
* @param new_transport the transport being registered. On a
* successful return, this memory is owned by the transport framework.
/* 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++) {
}
Jim_SetResultString(interp, session->name, -1);
return JIM_OK;
- break;
case 2: /* assign */
if (session) {
if (!strcmp(session->name, argv[1]->bytes)) {
LOG_ERROR("Debug adapter doesn't support '%s' transport", argv[1]->bytes);
return JIM_ERR;
- break;
default:
Jim_WrongNumArgs(interp, 1, argv, "[too many parameters]");
return JIM_ERR;