From: SF Markus Elfring <elfring@users.sourceforge.net>
To: alsa-devel@alsa-project.org, Clemens Ladisch <clemens@ladisch.de>,
Jaroslav Kysela <perex@perex.cz>, Takashi Iwai <tiwai@suse.com>
Cc: kernel-janitors@vger.kernel.org, LKML <linux-kernel@vger.kernel.org>
Subject: [PATCH 1/3] ALSA: bebob: Use common error handling code in snd_bebob_stream_start_duplex()
Date: Wed, 6 Sep 2017 12:22:16 +0200 [thread overview]
Message-ID: <541f0f9f-fc87-f65b-bbd8-fec5d45d5d2e@users.sourceforge.net> (raw)
In-Reply-To: <85f95150-9cec-7a53-7692-837ba543e1ec@users.sourceforge.net>
From: Markus Elfring <elfring@users.sourceforge.net>
Date: Wed, 6 Sep 2017 11:40:53 +0200
Add jump targets so that a bit of exception handling can be better reused
at the end of this function.
This issue was detected by using the Coccinelle software.
Signed-off-by: Markus Elfring <elfring@users.sourceforge.net>
---
sound/firewire/bebob/bebob_stream.c | 21 ++++++++++-----------
1 file changed, 10 insertions(+), 11 deletions(-)
diff --git a/sound/firewire/bebob/bebob_stream.c b/sound/firewire/bebob/bebob_stream.c
index 4d3034a68bdf..bc9e42b6368e 100644
--- a/sound/firewire/bebob/bebob_stream.c
+++ b/sound/firewire/bebob/bebob_stream.c
@@ -629,8 +629,7 @@ int snd_bebob_stream_start_duplex(struct snd_bebob *bebob, unsigned int rate)
if (err < 0) {
dev_err(&bebob->unit->device,
"fail to run AMDTP master stream:%d\n", err);
- break_both_connections(bebob);
- goto end;
+ goto break_connections;
}
/*
@@ -644,19 +643,15 @@ int snd_bebob_stream_start_duplex(struct snd_bebob *bebob, unsigned int rate)
dev_err(&bebob->unit->device,
"fail to ensure sampling rate: %d\n",
err);
- amdtp_stream_stop(&bebob->rx_stream);
- break_both_connections(bebob);
- goto end;
+ goto stop_rx_stream;
}
}
/* wait first callback */
if (!amdtp_stream_wait_callback(&bebob->rx_stream,
CALLBACK_TIMEOUT)) {
- amdtp_stream_stop(&bebob->rx_stream);
- break_both_connections(bebob);
err = -ETIMEDOUT;
- goto end;
+ goto stop_rx_stream;
}
}
@@ -666,9 +661,7 @@ int snd_bebob_stream_start_duplex(struct snd_bebob *bebob, unsigned int rate)
if (err < 0) {
dev_err(&bebob->unit->device,
"fail to run AMDTP slave stream:%d\n", err);
- amdtp_stream_stop(&bebob->rx_stream);
- break_both_connections(bebob);
- goto end;
+ goto stop_rx_stream;
}
/* wait first callback */
@@ -682,6 +675,12 @@ int snd_bebob_stream_start_duplex(struct snd_bebob *bebob, unsigned int rate)
}
end:
return err;
+
+stop_rx_stream:
+ amdtp_stream_stop(&bebob->rx_stream);
+break_connections:
+ break_both_connections(bebob);
+ return err;
}
void snd_bebob_stream_stop_duplex(struct snd_bebob *bebob)
--
2.14.1
next prev parent reply other threads:[~2017-09-06 10:22 UTC|newest]
Thread overview: 9+ messages / expand[flat|nested] mbox.gz Atom feed top
2017-09-06 10:21 [PATCH 0/3] ALSA: BeBoB: Fine-tuning for six function implementations SF Markus Elfring
2017-09-06 10:22 ` SF Markus Elfring [this message]
2017-09-24 3:50 ` [PATCH 1/3] ALSA: bebob: Use common error handling code in snd_bebob_stream_start_duplex() Takashi Sakamoto
2017-09-24 7:06 ` SF Markus Elfring
2017-09-26 23:30 ` Takashi Sakamoto
2017-09-27 6:38 ` SF Markus Elfring
2017-09-27 11:09 ` Takashi Sakamoto
2017-09-06 10:23 ` [PATCH 2/3] ALSA: bebob: Adjust six checks for null pointers SF Markus Elfring
2017-09-06 10:24 ` [PATCH 3/3] ALSA: bebob: Improve a size determination in parse_stream_formation() SF Markus Elfring
Reply instructions:
You may reply publicly to this message via plain-text email
using any one of the following methods:
* Save the following mbox file, import it into your mail client,
and reply-to-all from there: mbox
Avoid top-posting and favor interleaved quoting:
https://en.wikipedia.org/wiki/Posting_style#Interleaved_style
* Reply using the --to, --cc, and --in-reply-to
switches of git-send-email(1):
git send-email \
--in-reply-to=541f0f9f-fc87-f65b-bbd8-fec5d45d5d2e@users.sourceforge.net \
--to=elfring@users.sourceforge.net \
--cc=alsa-devel@alsa-project.org \
--cc=clemens@ladisch.de \
--cc=kernel-janitors@vger.kernel.org \
--cc=linux-kernel@vger.kernel.org \
--cc=perex@perex.cz \
--cc=tiwai@suse.com \
/path/to/YOUR_REPLY
https://kernel.org/pub/software/scm/git/docs/git-send-email.html
* If your mail client supports setting the In-Reply-To header
via mailto: links, try the mailto: link
Be sure your reply has a Subject: header at the top and a blank line
before the message body.
This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox;
as well as URLs for NNTP newsgroup(s).