Skip to content

Commit cab7c04

Browse files
10ne1gregkh
authored andcommitted
ALSA: usb-audio: test EP_FLAG_RUNNING at urb completion
[ Upstream commit 13a6c8328e6056932dc680e447d4c5e8ad9add17 ] Testing EP_FLAG_RUNNING in snd_complete_urb() before running the completion logic allows us to save a few cpu cycles by returning early, skipping the pending urb in case the stream was stopped; the stop logic handles the urb and sets the completion callbacks to NULL. Signed-off-by: Ioan-Adrian Ratiu <adi@adirat.com> Signed-off-by: Takashi Iwai <tiwai@suse.de> Signed-off-by: Sasha Levin <alexander.levin@verizon.com> Signed-off-by: Greg Kroah-Hartman <gregkh@linuxfoundation.org>
1 parent 8ced91a commit cab7c04

1 file changed

Lines changed: 3 additions & 0 deletions

File tree

sound/usb/endpoint.c

Lines changed: 3 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -384,6 +384,9 @@ static void snd_complete_urb(struct urb *urb)
384384
if (unlikely(atomic_read(&ep->chip->shutdown)))
385385
goto exit_clear;
386386

387+
if (unlikely(!test_bit(EP_FLAG_RUNNING, &ep->flags)))
388+
goto exit_clear;
389+
387390
if (usb_pipeout(ep->pipe)) {
388391
retire_outbound_urb(ep, ctx);
389392
/* can be stopped during retire callback */

0 commit comments

Comments
 (0)