summaryrefslogtreecommitdiffstats
path: root/sound
diff options
context:
space:
mode:
authorXu Biang <xubiang@hust.edu.cn>2023-04-06 06:28:01 -0700
committerGreg Kroah-Hartman <gregkh@linuxfoundation.org>2023-04-20 12:10:24 +0200
commit8f6a20a4f4ce25391cf5afe941f2e0db95148113 (patch)
tree47f048eef1d73413d23d856be408d47e6beba6b6 /sound
parent69108a8a45c61461bddca06e084ad5b2e7111612 (diff)
downloadlinux-stable-8f6a20a4f4ce25391cf5afe941f2e0db95148113.tar.gz
linux-stable-8f6a20a4f4ce25391cf5afe941f2e0db95148113.tar.bz2
linux-stable-8f6a20a4f4ce25391cf5afe941f2e0db95148113.zip
ALSA: firewire-tascam: add missing unwind goto in snd_tscm_stream_start_duplex()
commit fb4a624f88f658c7b7ae124452bd42eaa8ac7168 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: 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> Signed-off-by: Greg Kroah-Hartman <gregkh@linuxfoundation.org>
Diffstat (limited to 'sound')
-rw-r--r--sound/firewire/tascam/tascam-stream.c2
1 files changed, 1 insertions, 1 deletions
diff --git a/sound/firewire/tascam/tascam-stream.c b/sound/firewire/tascam/tascam-stream.c
index eb07e1decf9b..47de9727ac73 100644
--- a/sound/firewire/tascam/tascam-stream.c
+++ b/sound/firewire/tascam/tascam-stream.c
@@ -475,7 +475,7 @@ int snd_tscm_stream_start_duplex(struct snd_tscm *tscm, unsigned int rate)
err = amdtp_domain_start(&tscm->domain, 0);
if (err < 0)
- return err;
+ goto error;
if (!amdtp_stream_wait_callback(&tscm->rx_stream,
CALLBACK_TIMEOUT) ||