~diwic/alsa-driver/snd-firewire-improve

  • Committer: Takashi Sakamoto
  • Author(s): Xu Biang
  • Date: 2023-06-13 02:03:32 UTC
  • Revision ID: git-v1:e4568e4f39efbcc3b5f5f3028db92cfa8bc725fc
ALSA: firewire-tascam: add missing unwind goto in snd_tscm_stream_start_duplex()

Smatch Warns:
sound/firewire/tascam/tascam-stream.c:493 snd_tscm_stream_start_duplex()
warn: missing unwind goto?

The direct return will cause the stream list of "&tscm->domain" unemptied
and the session in "tscm" unfinished if amdtp_domain_start() returns with
an error.

Fix this by changing the direct return to a goto which will empty the
stream list of "&tscm->domain" and finish the session in "tscm".

The snd_tscm_stream_start_duplex() function is called in the prepare
callback of PCM. According to "ALSA Kernel API Documentation", the prepare
callback of PCM will be called many times at each setup. So, if the
"&d->streams" list is not emptied, when the prepare callback is called
next time, snd_tscm_stream_start_duplex() will receive -EBUSY from
amdtp_domain_add_stream() that tries to add an existing stream to the
domain. The error handling code after the "error" label will be executed
in this case, and the "&d->streams" list will be emptied. So not emptying
the "&d->streams" list will not cause an issue. But it is more efficient
and readable to empty it on the first error by changing the direct return
to a goto statement.

The session in "tscm" has been begun before amdtp_domain_start(), so it
needs to be finished when amdtp_domain_start() fails.

Fixes: c281d46a51e3 ("ALSA: firewire-tascam: support AMDTP domain")
Signed-off-by: Xu Biang <xubiang@hust.edu.cn>
Reviewed-by: Dan Carpenter <error27@gmail.com>
Acked-by: Takashi Sakamoto <o-takashi@sakamocchi.jp>
Cc: <stable@vger.kernel.org>
Link: https://lore.kernel.org/r/20230406132801.105108-1-xubiang@hust.edu.cn
Signed-off-by: Takashi Iwai <tiwai@suse.de>
Filename Latest Rev Last Changed Committer Comment Size
..
include 286 10 years ago Takashi Sakamoto merge current upstream. As of 2013/10/25, commit Diff
sound 286 10 years ago Takashi Sakamoto merge current upstream. As of 2013/10/25, commit Diff
backport.h 1577 1 year ago Takashi Sakamoto remove useless backported headers of UAPI Linux k 43 bytes Diff Download File
dkms.conf 1575 1 year ago Takashi Sakamoto dkms: depending on Linux kernel v5.19 A commit ba 1.3 KB Diff Download File
ftransfer.c 446 10 years ago Takashi Sakamoto improvement for ftransfer - Remove options relate 10.1 KB Diff Download File
Makefile 1483 2 years ago Takashi Sakamoto add W=1 to build on kbuild for compiler warnings 718 bytes Diff Download File
README.rst 1576 1 year ago Takashi Sakamoto update README This commit refines README in ReStr 3.3 KB Diff Download File
timestamp.c 761 8 years ago Takashi Sakamoto add timestamp.c to demonstrate non-blocking transm 2.2 KB Diff Download File