ALSA: aloop: Avoid a bad mixure of guard() and goto

The rewrite of aloop driver code using guard() leaded to a mixture of
guard() and some goto; although it currently works, it isn't really a
good match.

For avoiding the bad match, just move the code using goto into a
function and wrap it with guard().

Fixes: ebd9b6c91d ("ALSA: aloop: Use guard() for mutex locks")
Reported-by: Sashiko <sashiko-bot@kernel.org>
Signed-off-by: Takashi Iwai <tiwai@suse.de>
Link: https://patch.msgid.link/20261007172533.14667-6-tiwai@suse.de
This commit is contained in:
Takashi Iwai 2026-10-07 19:25:23 +02:00
parent a3e8eec769
commit f7faf5d9b5

View File

@ -1375,7 +1375,7 @@ static const struct loopback_ops loopback_snd_timer_ops = {
.dpcm_info = loopback_snd_timer_dpcm_info,
};
static int loopback_open(struct snd_pcm_substream *substream)
static int __loopback_open(struct snd_pcm_substream *substream)
{
struct snd_pcm_runtime *runtime = substream->runtime;
struct loopback *loopback = substream->private_data;
@ -1384,7 +1384,6 @@ static int loopback_open(struct snd_pcm_substream *substream)
int err = 0;
int dev = get_cable_index(substream);
guard(mutex)(&loopback->cable_lock);
dpcm = kzalloc_obj(*dpcm);
if (!dpcm)
return -ENOMEM;
@ -1479,6 +1478,14 @@ static int loopback_open(struct snd_pcm_substream *substream)
return err;
}
static int loopback_open(struct snd_pcm_substream *substream)
{
struct loopback *loopback = substream->private_data;
guard(mutex)(&loopback->cable_lock);
return __loopback_open(substream);
}
static int loopback_close(struct snd_pcm_substream *substream)
{
struct loopback *loopback = substream->private_data;