summaryrefslogtreecommitdiff
path: root/sound/usb
diff options
context:
space:
mode:
authorTakashi Iwai <tiwai@suse.de>2021-10-01 12:54:25 +0200
committerTakashi Iwai <tiwai@suse.de>2021-10-01 12:54:56 +0200
commit23939115be181bc5dbc33aa8471adcdbffa28910 (patch)
tree8f5d80841a20480b511d9b9df2f9c179f66a6fc6 /sound/usb
parent28c369e60827f706cef4604a3e2848198f25bd26 (diff)
downloadlwn-23939115be181bc5dbc33aa8471adcdbffa28910.tar.gz
lwn-23939115be181bc5dbc33aa8471adcdbffa28910.zip
ALSA: usb-audio: Fix packet size calculation regression
The commit d215f63d49da ("ALSA: usb-audio: Check available frames for the next packet size") introduced the available frame size check, but the conversion forgot to initialize the temporary variable properly, and it resulted in a bogus calculation. This patch fixes it. Fixes: d215f63d49da ("ALSA: usb-audio: Check available frames for the next packet size") Reported-by: Colin Ian King <colin.king@canonical.com> Link: https://lore.kernel.org/r/20211001104417.14291-1-colin.king@canonical.com Link: https://lore.kernel.org/r/20211001105425.16191-1-tiwai@suse.de Signed-off-by: Takashi Iwai <tiwai@suse.de>
Diffstat (limited to 'sound/usb')
-rw-r--r--sound/usb/endpoint.c2
1 files changed, 1 insertions, 1 deletions
diff --git a/sound/usb/endpoint.c b/sound/usb/endpoint.c
index 42c0d2db8ba8..743b8287cfcd 100644
--- a/sound/usb/endpoint.c
+++ b/sound/usb/endpoint.c
@@ -182,7 +182,7 @@ static int next_packet_size(struct snd_usb_endpoint *ep, unsigned int avail)
if (ep->fill_max)
return ep->maxframesize;
- sample_accum += ep->sample_rem;
+ sample_accum = ep->sample_accum + ep->sample_rem;
if (sample_accum >= ep->pps) {
sample_accum -= ep->pps;
ret = ep->packsize[1];