We read every piece of feedback, and take your input very seriously.
To see all available qualifiers, see our documentation.
1 parent 906dc94 commit 87ad5efCopy full SHA for 87ad5ef
1 file changed
src/hal/utils/halcmd_commands.cc
@@ -1359,16 +1359,16 @@ int do_unloadrt_cmd(char *mod_name)
1359
halcmd_error("component '%s' is not loaded\n", mod_name);
1360
return -1;
1361
}
1362
- /* we now have a list of components, unload them */
1363
- n = 0;
+ /* we now have a list of components, unload them in reverse order */
+ n -= 1;
1364
retval1 = 0;
1365
- while ( comps[n][0] != '\0' ) {
+ while ( n >= 0 ) {
1366
// special case: initial prefix means it is not a real comp
1367
if (strstr(comps[n],HAL_PSEUDO_COMP_PREFIX) == comps[n] ) {
1368
- n++;
+ n--;
1369
continue;
1370
1371
- retval = unloadrt_comp(comps[n++]);
+ retval = unloadrt_comp(comps[n--]);
1372
/* check for fatal error */
1373
if ( retval < -1 ) {
1374
return retval;
0 commit comments