Skip to contentSkip to conversation

ALSA: usb-audio: Fix packet size calculation regression

PATCH New Takashi Iwai 1 participant 1 message Oct 1, 2021 Sound

lore
Share & tools
lore
#0 lore raw

PATCH 1/1 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")
---
 sound/usb/endpoint.c | 2 +-
 1 file changed, 1 insertion(+), 1 deletion(-)
sound/usb/endpoint.c +1 -1
index 42c0d2db8ba8..743b8287cfcd 100644
@@ -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];
Signature · 1 line
2.26.2