linux-stable/sound/firewire
Xu Biang f1ef453157 ALSA: firewire-tascam: add missing unwind goto in snd_tscm_stream_start_duplex()
commit fb4a624f88 upstream.

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: c281d46a51 ("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>
Signed-off-by: Greg Kroah-Hartman <gregkh@linuxfoundation.org>
2023-04-20 12:13:51 +02:00
..
bebob ALSA: bebob: correct duplicated entries with TerraTec OUI 2021-07-05 19:31:12 +02:00
dice ALSA: dice: fix regression for Lexicon I-ONIX FW810S 2022-12-08 11:28:42 +01:00
digi00x ALSA: firewire-digi00x: cease from delayed card registration 2021-06-07 17:14:29 +02:00
fireface ALSA: fireface: cease from delayed card registration 2021-06-07 17:14:48 +02:00
fireworks ALSA: fireworks: fix wrong return count shorter than expected by 4 bytes 2022-05-12 12:30:01 +02:00
motu ALSA: firewire-motu: fix truncated bytes in message tracepoints 2021-09-21 18:48:32 +02:00
oxfw ALSA: oxfw: fix functional regression for Mackie Onyx 1640i in v5.14 or later 2021-11-18 19:16:57 +01:00
tascam ALSA: firewire-tascam: add missing unwind goto in snd_tscm_stream_start_duplex() 2023-04-20 12:13:51 +02:00
amdtp-am824.c ALSA: firewire-lib/motu: use int type for the value of bitwise OR with enumerator-constant 2021-05-18 12:21:52 +02:00
amdtp-am824.h ALSA: firewire-lib/motu: use int type for the value of bitwise OR with enumerator-constant 2021-05-18 12:21:52 +02:00
amdtp-stream-trace.h ALSA: firewire-lib: replace in_interrupt() with in_softirq() 2021-06-12 09:31:41 +02:00
amdtp-stream.c ALSA: firewire-lib: Fix 'amdtp_domain_start()' when no AMDTP_OUT_STREAM stream is found 2021-06-25 09:38:11 +02:00
amdtp-stream.h ALSA: firewire-lib: obsolete workqueue for period update 2021-06-10 09:50:37 +02:00
cmp.c ALSA: firewire: fix kernel-doc 2020-07-07 12:09:32 +02:00
cmp.h
fcp.c ALSA: firewire-lib: fix uninitialized flag for AV/C deferred transaction 2022-04-08 14:23:20 +02:00
fcp.h
isight.c ALSA: firewire: Drop superfluous ioctl PCM ops 2019-12-11 07:25:27 +01:00
iso-resources.c
iso-resources.h
Kconfig ALSA: bebob: add support for ToneWeal FW66 2021-06-20 08:42:27 +02:00
lib.c ALSA: firewire-lib: delete unused kernel API 2021-06-07 17:14:54 +02:00
lib.h ALSA: firewire-lib: delete unused kernel API 2021-06-07 17:14:54 +02:00
Makefile
packets-buffer.c
packets-buffer.h