diff options
| author | Mark Brown <[email protected]> | 2023-07-23 22:33:05 +0000 |
|---|---|---|
| committer | Mark Brown <[email protected]> | 2023-07-23 22:33:05 +0000 |
| commit | de1b43a57aff8b1808bbfe0402932f9e373d1172 (patch) | |
| tree | 699c828946223aab18a0aab5175e6902a8ce2e42 /tools/lib/subcmd/help.c | |
| parent | ASoC: wm8960: Add DAC filter characteristics selection (diff) | |
| parent | Linux 6.5-rc3 (diff) | |
| download | kernel-de1b43a57aff8b1808bbfe0402932f9e373d1172.tar.gz kernel-de1b43a57aff8b1808bbfe0402932f9e373d1172.zip | |
ASoC: Merge up fixes from mainline
There's several things here that will really help my CI.
Diffstat (limited to 'tools/lib/subcmd/help.c')
| -rw-r--r-- | tools/lib/subcmd/help.c | 18 |
1 files changed, 12 insertions, 6 deletions
diff --git a/tools/lib/subcmd/help.c b/tools/lib/subcmd/help.c index 67a8d6b740ea..adfbae27dc36 100644 --- a/tools/lib/subcmd/help.c +++ b/tools/lib/subcmd/help.c @@ -68,8 +68,13 @@ void exclude_cmds(struct cmdnames *cmds, struct cmdnames *excludes) while (ci < cmds->cnt && ei < excludes->cnt) { cmp = strcmp(cmds->names[ci]->name, excludes->names[ei]->name); if (cmp < 0) { - zfree(&cmds->names[cj]); - cmds->names[cj++] = cmds->names[ci++]; + if (ci == cj) { + ci++; + cj++; + } else { + zfree(&cmds->names[cj]); + cmds->names[cj++] = cmds->names[ci++]; + } } else if (cmp == 0) { ci++; ei++; @@ -77,10 +82,11 @@ void exclude_cmds(struct cmdnames *cmds, struct cmdnames *excludes) ei++; } } - - while (ci < cmds->cnt) { - zfree(&cmds->names[cj]); - cmds->names[cj++] = cmds->names[ci++]; + if (ci != cj) { + while (ci < cmds->cnt) { + zfree(&cmds->names[cj]); + cmds->names[cj++] = cmds->names[ci++]; + } } for (ci = cj; ci < cmds->cnt; ci++) zfree(&cmds->names[ci]); |
