static int seq_ump_client_open(struct seq_ump_client *client, int dir)
{
struct snd_ump_endpoint *ump = client->ump;
- int err = 0;
+ int err;
- mutex_lock(&ump->open_mutex);
+ guard(mutex)(&ump->open_mutex);
if (dir == STR_OUT && !client->opened[dir]) {
err = snd_rawmidi_kernel_open(&ump->core, 0,
SNDRV_RAWMIDI_LFLG_OUTPUT |
SNDRV_RAWMIDI_LFLG_APPEND,
&client->out_rfile);
if (err < 0)
- goto unlock;
+ return err;
}
client->opened[dir]++;
- unlock:
- mutex_unlock(&ump->open_mutex);
- return err;
+ return 0;
}
/* close the rawmidi */
{
struct snd_ump_endpoint *ump = client->ump;
- mutex_lock(&ump->open_mutex);
+ guard(mutex)(&ump->open_mutex);
if (!--client->opened[dir])
if (dir == STR_OUT)
snd_rawmidi_kernel_release(&client->out_rfile);
- mutex_unlock(&ump->open_mutex);
return 0;
}