[PATCH 3/6] ALSA: usb-audio: Add PM guard to Scarlett meter reads
From: Will Porter
Date: Thu Aug 27 2026 - 19:23:05 EST
The Scarlett Gen 1 meter callback reads the device without preventing
runtime suspend or disconnect. The transfer can fail when userspace
polls the volatile control after the device suspends.
Hold snd_usb_lock across the meter request. This matches the guarded
Forte and common mixer control paths in this file.
Assisted-by: Codex:gpt-5.6-sol
Signed-off-by: Will Porter <mrwillporter@xxxxxxxxx>
---
sound/usb/mixer_scarlett.c | 4 ++++
1 file changed, 4 insertions(+)
diff --git a/sound/usb/mixer_scarlett.c b/sound/usb/mixer_scarlett.c
index 673eb8d8724d..369968565c19 100644
--- a/sound/usb/mixer_scarlett.c
+++ b/sound/usb/mixer_scarlett.c
@@ -707,6 +707,10 @@ static int scarlett_ctl_meter_get(struct snd_kcontrol *kctl,
int idx = snd_usb_ctrl_intf(elem->head.mixer->hostif) | (elem->head.id << 8);
int err;
+ CLASS(snd_usb_lock, pm)(chip);
+ if (pm.err < 0)
+ return -EIO;
+
err = snd_usb_ctl_msg(chip->dev,
usb_rcvctrlpipe(chip->dev, 0),
UAC2_CS_MEM,
--
2.47.3