ALSA: usb-audio: Handle invalid running state at releasing EP
authorTakashi Iwai <tiwai@suse.de>
Sat, 6 Feb 2021 20:30:50 +0000 (21:30 +0100)
committerTakashi Iwai <tiwai@suse.de>
Mon, 8 Feb 2021 14:59:54 +0000 (15:59 +0100)
commitd6cda4655e2a7612a1e48c49795a5330abc01c5a
tree0417c072a24ffbc1a6897699c418e0ea48d015a2
parentc50bfc8a6866775be39d7e747e83e8a5a9051e2e
ALSA: usb-audio: Handle invalid running state at releasing EP

When we stop an endpoint in release_urbs(), it ignores the
inconsistent endpoint state and tries to release the resources.
This shouldn't happen in theory, but it's still safer to abort the
release and let the caller proper error handling.

Also, stop_and_unlink_urbs() called from release_urbs() does two step
works, and it's more straightforward to split this to two functions
again, so that the call from the PCM trigger won't take the path with
sleeping.

This patch modifies the EP management code to adapt two points above.

Fixes: d0f09d1e4a88 ("ALSA: usb-audio: Refactoring endpoint URB deactivation")
Cc: <stable@vger.kernel.org>
Link: https://lore.kernel.org/r/20210206203052.15606-2-tiwai@suse.de
Signed-off-by: Takashi Iwai <tiwai@suse.de>
sound/usb/endpoint.c