Repository navigation
Conversation
sof_remove.sh runs under 'set -e'. If a USB audio device (e.g. a loopback/offload device under test) is briefly busy when snd_usb_audio/snd_usbmidi_lib are removed, the script aborts right there. That leaves snd_sof removed but never reloaded, breaking the DSP for the rest of the test run, since reload_drivers() never completes. Track whether USB audio is still loaded after the removal attempt and tolerate the same failure on the shared ALSA-core modules it can keep busy (snd_hwdep, snd_rawmidi, snd_seq_device, snd_timer, snd, soundcore), the same way snd_sof_intel_hda_common's SDW-BRA busy case is already tolerated above. Unrelated failures on these modules still abort, since the tolerance only applies when USB audio itself failed to unload.
harajend
requested review from
a team,
lgirdwood,
marc-hb and
plbossart
as code owners
November 23, 2026 01:57
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Add this suggestion to a batch that can be applied as a single commit.This suggestion is invalid because no changes were made to the code.Suggestions cannot be applied while the pull request is closed.Suggestions cannot be applied while viewing a subset of changes.Only one suggestion per line can be applied in a batch.Add this suggestion to a batch that can be applied as a single commit.Applying suggestions on deleted lines is not supported.You must change the existing code in this line in order to create a valid suggestion.Outdated suggestions cannot be applied.This suggestion has been applied or marked resolved.Suggestions cannot be applied from pending reviews.Suggestions cannot be applied on multi-line comments.Suggestions cannot be applied while the pull request is queued to merge.Suggestion cannot be applied right now. Please check back later.
Problem
sof_remove.sh runs under 'bash -e'. If a USB audio device (e.g. a loopback/offload device used by CI) is briefly busy when snd_usb_audio/snd_usbmidi_lib are removed, the script aborts right there.
Root cause
Because the script aborts mid-way under set -e, snd_sof can already be removed by the time the abort happens, but reload_drivers() never gets to reload it. That breaks the DSP for every subsequent test case in the run, not just the current one.
Fix
Track whether USB audio is still loaded after the removal attempt (usb_audio_still_loaded) and tolerate the same failure on the shared ALSA-core modules it can keep busy: snd_hwdep, snd_rawmidi, snd_seq_device, snd_timer, snd, soundcore. This mirrors the existing tolerance already in place for snd_sof_intel_hda_common's SDW-BRA busy case a few lines above. Unrelated failures on these modules still abort normally, since the tolerance is conditional on USB audio itself having failed to unload.
Verification
Internally we carried an equivalent fix on our downstream fork and confirmed it resolves a cascade of ~38 failed test cases caused by a USB audio loopback device (WCL_HDA_AIOC) keeping shared modules busy during driver reload on an RVP DUT. This PR ports the same fix onto the current upstream module ordering (which already differs from our fork, e.g. the snd_usb_offload/soc_usb reordering and the snd_ump handling).