transport: remove interface multiple transport warning
authorSpencer Oliver <spen@spen-soft.co.uk>
Mon, 19 Mar 2012 16:38:11 +0000 (16:38 +0000)
committerSpencer Oliver <spen@spen-soft.co.uk>
Fri, 30 Mar 2012 15:51:37 +0000 (15:51 +0000)
Currently if we have multiple transport's defined we receive an warning similar to:
must select a transport.
allow transport 'jtag'
allow transport 'swd

This removes that warning and only prints this info if transport_init fails.

Change-Id: I87126390f234bc2f705e1f150a0dcc110dcab151
Signed-off-by: Spencer Oliver <spen@spen-soft.co.uk>
Reviewed-on: http://openocd.zylin.com/532
Tested-by: jenkins
src/transport/transport.c

index 59f49a9..2f35965 100644 (file)
@@ -117,15 +117,9 @@ int allow_transports(struct command_context *ctx, const char **vector)
        if (!vector[1]) {
                LOG_INFO("only one transport option; autoselect '%s'", vector[0]);
                return transport_select(ctx, vector[0]);
-       } else {
-               /* guard against user config errors */
-               LOG_WARNING("must select a transport.");
-               while (*vector) {
-                       LOG_DEBUG("allow transport '%s'", *vector);
-                       vector++;
-               }
-               return ERROR_OK;
        }
+
+       return ERROR_OK;
 }
 
 /**
@@ -246,6 +240,13 @@ COMMAND_HANDLER(handle_transport_init)
        LOG_DEBUG("%s", __func__);
        if (!session) {
                LOG_ERROR("session's transport is not selected.");
+
+               /* no session transport configured, print transports then fail */
+               const char **vector = allowed_transports;
+               while (*vector) {
+                       LOG_ERROR("allow transport '%s'", *vector);
+                       vector++;
+               }
                return ERROR_FAIL;
        }