Consolidate target selection code into single get_target() that handles both names...
[fw/openocd] / src / target / image.c
index 71939e79b92e6cb73bae40a7e8d3df44396e848b..d72680d1b763499646635c47a4cea7c7791db44e 100644 (file)
@@ -711,10 +711,11 @@ int image_open(image_t *image, char *url, char *type_string)
        }
        else if (image->type == IMAGE_MEMORY)
        {
-               target_t *target = get_target_by_num(strtoul(url, NULL, 0));
-               if (target==NULL)
+               target_t *target = get_target(url);
+
+               if (target == NULL)
                {
-                       LOG_ERROR("Target '%s' does not exist", url);
+                       LOG_ERROR("target '%s' not defined", url);
                        return ERROR_FAIL;
                }