linux/sound/usb
Will Porter 1739a97631 ALSA: usb-audio: Complete cleanup after system-resume errors
A failed system resume can leave the card unusable until reboot.
usb_audio_resume() jumps to err_out when snd_usb_pcm_resume() or
snd_usb_mixer_resume() fails. The error path skips the out: block, which
restores D0 and decrements chip->num_suspended_intf.

The card stays in SNDRV_CTL_POWER_D3hot, so later control access blocks in
snd_power_ref_and_wait(). USB core logs an interface resume callback error.
It does not retry that callback, so a later callback cannot complete the
skipped cleanup.

usb_audio_suspend() increments num_suspended_intf before returning success.
A system-resume callback must consume the system-suspend count even if a
component resume fails. Otherwise, the stranded count skews later suspend
and resume cycles.

Do not apply this cleanup to runtime-resume errors. Runtime PM can retry
-EAGAIN or -EBUSY without another suspend callback. The count must continue
to describe that suspended interface. Other runtime-resume errors latch
runtime_error in the PM core and do not cause an immediate callback retry.

Both parts of the system-resume error path are longstanding. Commit
88a8516a21 ("ALSA: usbaudio: implement USB autosuspend") introduced
err_out past the D0 restore. Commit 862b2509d1 ("ALSA: usb-audio: Fix
inconsistent card PM state after resume") later moved
num_suspended_intf-- into the out: block. The error path now skips both
operations.

No third-party code is needed to reach the error path.
snd_usb_mixer_resume() ends in snd_usb_mixer_activate(), which returns the
result of usb_submit_urb() for devices that have a mixer status URB. Its
mixer->private_resume hook can also fail through scarlett2_init_notify().
snd_usb_pcm_resume() issues a SET_CUR request to a UAC3 power domain. It
can return -EPIPE or -EIO when the device stalls the request.

Route a component error through out: only when system_suspend is nonzero.
Continue to return runtime-resume errors through err_out. Later component
resume stages remain skipped. The original error still reaches USB core.
A later transfer can fail if the device did not recover.

I reproduced the system-resume failure on an Audient iD14 MkI with an
out-of-tree diagnostic mixer resume hook. An injected -EIO on the unpatched
core left control readers in uninterruptible sleep in
snd_power_ref_and_wait() until a reboot. With this patch, the same failure
restored control access. A second system suspend and resume also succeeded
after I disabled fault injection.

Assisted-by: Claude:claude-opus-5
Assisted-by: Antigravity:gemini-3.1-pro-high
Assisted-by: Codex:gpt-5.6-sol
Fixes: 88a8516a21 ("ALSA: usbaudio: implement USB autosuspend")
Fixes: 862b2509d1 ("ALSA: usb-audio: Fix inconsistent card PM state after resume")
Cc: <stable@vger.kernel.org>
Signed-off-by: Will Porter <mrwillporter@gmail.com>
Link: https://patch.msgid.link/20260824225757.26749-1-mrwillporter@gmail.com
Signed-off-by: Takashi Iwai <tiwai@suse.de>
2026-08-25 10:01:44 +02:00
..
6fire ALSA: 6fire: bound the MIDI event length from the device 2026-08-05 09:32:42 +02:00
bcd2000 ALSA: bcd2000: clear the URB pointers on disconnect 2026-08-05 09:34:03 +02:00
caiaq ALSA: usb-audio: caiaq: validate EP1 reply lengths 2026-07-05 12:14:19 +02:00
hiface Convert 'alloc_obj' family to use the new default GFP_KERNEL argument 2026-02-21 17:09:51 -08:00
line6 ALSA: usb-audio/line6: Add support for POD HD PRO 2026-04-21 10:07:45 +02:00
misc ALSA: ua101: Reject too-short USB descriptors 2026-05-19 08:08:41 +02:00
qcom ALSA: usb-audio: qcom: Free QMI handle 2026-06-25 13:56:21 +02:00
usx2y Merge branch 'for-next' into for-linus 2026-08-17 09:53:02 +02:00
card.c ALSA: usb-audio: Complete cleanup after system-resume errors 2026-08-25 10:01:44 +02:00
card.h ALSA: usb-audio: Optimize the copy of packet sizes for implicit fb handling 2026-02-16 15:13:35 +01:00
clock.c ALSA: usb-audio: add QUIRK_FLAG_ALWAYS_SET_RATE for Mackie DLZ Creator XS 2026-08-09 12:29:33 +02:00
clock.h
endpoint.c Merge branch 'for-next' into for-linus 2026-08-17 09:53:02 +02:00
endpoint.h ALSA: usb-audio: Remove unused function declaration 2023-08-01 16:56:57 +02:00
fcp.c Merge branch 'for-next' into for-linus 2026-08-17 09:53:02 +02:00
fcp.h ALSA: FCP: Add Focusrite Control Protocol driver 2025-01-18 12:00:38 +01:00
format.c ALSA: usb-audio: stop parsing UAC2 rates at MAX_NR_RATES 2026-04-16 10:33:19 +02:00
format.h
helper.c ALSA: usb-audio: Export USB SND APIs for modules 2025-04-11 13:02:30 +02:00
helper.h ALSA: usb-audio: Support multiple control interfaces 2024-08-12 16:17:46 +02:00
implicit.c ALSA: usb-audio: Add implicit feedback quirk for RODE AI-1 2025-06-02 16:50:04 +02:00
implicit.h ALSA: usb-audio: Add new quirk FIXED_RATE for JBL Quantum810 Wireless 2022-12-22 09:13:54 +01:00
Kconfig ALSA:usb:qcom: add AUXILIARY_BUS to Kconfig dependencies 2026-03-18 12:36:39 +01:00
Makefile ALSA: usb-audio: qcom: Introduce QC USB SND offloading support 2025-04-11 13:02:32 +02:00
media.c Convert 'alloc_obj' family to use the new default GFP_KERNEL argument 2026-02-21 17:09:51 -08:00
media.h
midi.c ALSA: usb-audio: fix OOB write in snd_usbmidi_novation_output() 2026-08-24 08:47:13 +02:00
midi.h ALSA: usb-audio: Manage number of rawmidis globally 2023-05-23 12:11:00 +02:00
midi2.c ALSA: usb: Fix UAF at delayed release of MIDI2 EPs 2026-08-08 17:51:43 +02:00
midi2.h ALSA: usb-audio: USB MIDI 2.0 UMP support 2023-05-23 12:11:02 +02:00
mixer_maps.c ALSA: usb-audio: Add iD14 MkI to monitor-mix volume quirk 2026-08-23 11:05:13 +02:00
mixer_quirks.c Merge branch 'for-linus' into for-next 2026-07-30 11:28:26 +02:00
mixer_quirks.h
mixer_s1810c.c ALSA: usb-audio: add Studio 1824 support 2026-03-09 13:00:57 +01:00
mixer_s1810c.h
mixer_scarlett.c ALSA: usb-audio: Propagate errors in scarlett_ctl_enum_put() 2026-04-27 13:44:48 +02:00
mixer_scarlett.h ALSA: usb-audio: add mixer support for Focusrite Forte 2026-01-27 09:58:50 +01:00
mixer_scarlett2.c ALSA: scarlett2: Use a private URB for the notification endpoint 2026-08-10 13:36:20 +02:00
mixer_scarlett2.h ALSA: scarlett2: Rename scarlett_gen2 to scarlett2 2023-10-27 11:22:59 +02:00
mixer_us16x08.c ALSA: usb-audio: Update US-16x08 EQ/comp shadow state after successful writes 2026-04-27 13:44:49 +02:00
mixer_us16x08.h
mixer.c ALSA: usb-audio: Reverse MIXER_GET_CUR_BROKEN as MIXER_GET_CUR_OK 2026-08-23 11:03:34 +02:00
mixer.h ALSA: scarlett2: Use a private URB for the notification endpoint 2026-08-10 13:36:20 +02:00
pcm.c ALSA: usb-audio: Use the right limit for PCM OOB check 2026-01-21 09:22:12 +01:00
pcm.h ALSA: usb-audio: Export USB SND APIs for modules 2025-04-11 13:02:30 +02:00
power.c Convert 'alloc_obj' family to use the new default GFP_KERNEL argument 2026-02-21 17:09:51 -08:00
power.h ALSA: usb-audio: Support multiple control interfaces 2024-08-12 16:17:46 +02:00
proc.c ALSA: usb-audio: Replace manual mutex/spinlock with guard() 2025-08-12 08:36:17 +02:00
proc.h
quirks-table.h ALSA: usb-audio: Skip mixer creation on M-Audio Venom 2026-08-25 09:54:58 +02:00
quirks.c ALSA: usb-audio: Skip reading sample rate on M-Audio Venom 2026-08-25 09:54:45 +02:00
quirks.h ALSA: usb-audio: Make some quirk-string helpers local 2026-07-29 09:47:22 +02:00
stream.c ALSA: usb-audio: Avoid potential endless loop in convert_chmap_v3() 2026-04-28 08:14:21 +02:00
stream.h ALSA: usb-audio: Fix potential leak of pd at parsing UAC3 streams 2026-04-28 08:13:50 +02:00
usbaudio.h ALSA: usb-audio: Reverse MIXER_GET_CUR_BROKEN as MIXER_GET_CUR_OK 2026-08-23 11:03:34 +02:00
validate.c ALSA: usb-audio: Use correct version for UAC3 header validation 2026-02-26 07:37:29 +01:00