mirror of
https://github.com/hardkernel/linux.git
synced 2026-03-24 19:40:21 +09:00
ALSA: usb-audio: Apply mutex around snd_usb_endpoint_set_params()
[ Upstream commita74f8d0aa9] The protection with chip->mutex was lost after splitting snd_usb_endpoint_set_params() and snd_usb_endpoint_prepare(). Apply the same mutex again to the former function. Fixes:2be79d5864("ALSA: usb-audio: Split endpoint setups for hw_params and prepare (take#2)") Link: https://lore.kernel.org/r/20221009104212.18877-3-tiwai@suse.de Signed-off-by: Takashi Iwai <tiwai@suse.de> Stable-dep-of: 7822baa844a8 ("ALSA: usb-audio: add quirk for RODE NT-USB+") Signed-off-by: Sasha Levin <sashal@kernel.org>
This commit is contained in:
committed by
Sasha Levin
parent
539493f147
commit
06b6de69cf
@@ -1339,10 +1339,11 @@ int snd_usb_endpoint_set_params(struct snd_usb_audio *chip,
|
||||
const struct audioformat *fmt = ep->cur_audiofmt;
|
||||
int err;
|
||||
|
||||
mutex_lock(&chip->mutex);
|
||||
/* release old buffers, if any */
|
||||
err = release_urbs(ep, false);
|
||||
if (err < 0)
|
||||
return err;
|
||||
goto unlock;
|
||||
|
||||
ep->datainterval = fmt->datainterval;
|
||||
ep->maxpacksize = fmt->maxpacksize;
|
||||
@@ -1380,13 +1381,16 @@ int snd_usb_endpoint_set_params(struct snd_usb_audio *chip,
|
||||
usb_audio_dbg(chip, "Set up %d URBS, ret=%d\n", ep->nurbs, err);
|
||||
|
||||
if (err < 0)
|
||||
return err;
|
||||
goto unlock;
|
||||
|
||||
/* some unit conversions in runtime */
|
||||
ep->maxframesize = ep->maxpacksize / ep->cur_frame_bytes;
|
||||
ep->curframesize = ep->curpacksize / ep->cur_frame_bytes;
|
||||
|
||||
return update_clock_ref_rate(chip, ep);
|
||||
err = update_clock_ref_rate(chip, ep);
|
||||
unlock:
|
||||
mutex_unlock(&chip->mutex);
|
||||
return err;
|
||||
}
|
||||
|
||||
static int init_sample_rate(struct snd_usb_audio *chip,
|
||||
|
||||
Reference in New Issue
Block a user