[PATCH 5.15 33/76] ALSA: usb-audio: Correct the return code from snd_usb_endpoint_set_params()

From: Sasha Levin
Date: Wed Mar 13 2024 - 13:29:13 EST


From: Takashi Iwai <tiwai@xxxxxxx>

[ Upstream commit 9355b60e401d825590d37f04ea873c58efe9b7bf ]

snd_usb_endpoint_set_params() should return zero for a success, but
currently it returns the sample rate. Correct it.

Fixes: 2be79d586454 ("ALSA: usb-audio: Split endpoint setups for hw_params and prepare (take#2)")
Link: https://lore.kernel.org/r/20221009104212.18877-4-tiwai@xxxxxxx
Signed-off-by: Takashi Iwai <tiwai@xxxxxxx>
Stable-dep-of: 7822baa844a8 ("ALSA: usb-audio: add quirk for RODE NT-USB+")
Signed-off-by: Sasha Levin <sashal@xxxxxxxxxx>
---
sound/usb/endpoint.c | 2 ++
1 file changed, 2 insertions(+)

diff --git a/sound/usb/endpoint.c b/sound/usb/endpoint.c
index 486ef6b022552..80ead3db4d1c7 100644
--- a/sound/usb/endpoint.c
+++ b/sound/usb/endpoint.c
@@ -1388,6 +1388,8 @@ int snd_usb_endpoint_set_params(struct snd_usb_audio *chip,
ep->curframesize = ep->curpacksize / ep->cur_frame_bytes;

err = update_clock_ref_rate(chip, ep);
+ if (err >= 0)
+ err = 0;
unlock:
mutex_unlock(&chip->mutex);
return err;
--
2.43.0