summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorWill Porter <mrwillporter@gmail.com>2026-08-27 18:21:38 -0500
committerTakashi Iwai <tiwai@suse.de>2026-08-31 09:54:18 +0200
commit077304dfa7d1c641fbc10310c831ba8505887bd2 (patch)
treee810f5d5c5d9a3b1227a0c1b7d1f0975a9311e53
parentcee9395acd8043be0644b25c34bfa86623f2b935 (diff)
ALSA: usb-audio: Add PM guard to Studio 1810c controls
The Studio 1810c control callbacks issue vendor transfers without preventing runtime suspend or disconnect. A transfer attempted after runtime suspend can fail because the USB device cannot accept submissions. Take snd_usb_lock before the driver data and USB mutexes in both callbacks. This resumes the device before either the state read or control write. It also prevents disconnect cleanup from racing the complete operation. Assisted-by: Codex:gpt-5.6-sol Signed-off-by: Will Porter <mrwillporter@gmail.com> Signed-off-by: Takashi Iwai <tiwai@suse.de> Link: https://patch.msgid.link/20260827232143.149197-2-mrwillporter@gmail.com
-rw-r--r--sound/usb/mixer_s1810c.c8
1 files changed, 8 insertions, 0 deletions
diff --git a/sound/usb/mixer_s1810c.c b/sound/usb/mixer_s1810c.c
index 2e5a8d37ec57..bdb5e3aaff3b 100644
--- a/sound/usb/mixer_s1810c.c
+++ b/sound/usb/mixer_s1810c.c
@@ -474,6 +474,10 @@ snd_s1810c_switch_get(struct snd_kcontrol *kctl,
u32 state = 0;
int ret;
+ CLASS(snd_usb_lock, pm)(mixer->chip);
+ if (pm.err < 0)
+ return -EIO;
+
guard(mutex)(&private->data_mutex);
ret = snd_s1810c_get_switch_state(mixer, kctl, &state);
if (ret < 0)
@@ -504,6 +508,10 @@ snd_s1810c_switch_set(struct snd_kcontrol *kctl,
u32 newval = 0;
int ret = 0;
+ CLASS(snd_usb_lock, pm)(mixer->chip);
+ if (pm.err < 0)
+ return -EIO;
+
guard(mutex)(&private->data_mutex);
ret = snd_s1810c_get_switch_state(mixer, kctl, &curval);
if (ret < 0)