* On the first pass, only load images if they have a full symtab.
         * Failing that, do a second pass where we accept .dynsym also
         */
-       for (self->symtab_type = SYMTAB__BUILD_ID_CACHE, want_symtab = 1;
+       want_symtab = 1;
+restart:
+       for (self->symtab_type = SYMTAB__BUILD_ID_CACHE;
             self->symtab_type != SYMTAB__NOT_FOUND;
             self->symtab_type++) {
                switch (self->symtab_type) {
                        snprintf(name, size, "%s%s", symbol_conf.symfs,
                                 self->long_name);
                        break;
-
-               default:
-                       /*
-                        * If we wanted a full symtab but no image had one,
-                        * relax our requirements and repeat the search.
-                        */
-                       if (want_symtab) {
-                               want_symtab = 0;
-                               self->symtab_type = SYMTAB__BUILD_ID_CACHE;
-                       } else
-                               continue;
+               default:;
                }
 
                /* Name is now the name of the next image to try */
                }
        }
 
+       /*
+        * If we wanted a full symtab but no image had one,
+        * relax our requirements and repeat the search.
+        */
+       if (ret <= 0 && want_symtab) {
+               want_symtab = 0;
+               goto restart;
+       }
+
        free(name);
        if (ret < 0 && strstr(self->name, " (deleted)") != NULL)
                return 0;