summaryrefslogtreecommitdiff
path: root/sound/firewire/fireface/ff.c
diff options
context:
space:
mode:
authorTakashi Sakamoto <o-takashi@sakamocchi.jp>2018-10-10 15:35:02 +0900
committerTakashi Iwai <tiwai@suse.de>2018-10-10 12:11:50 +0200
commit3babca4555b20fc80aff4776662fb237257d9afd (patch)
tree10a967c09572ade5f331a61eae58b7a92e2666eb /sound/firewire/fireface/ff.c
parent873608dc6b5da7a2571419bfa10e0d088d39cee0 (diff)
ALSA: firewire: simplify cleanup process when failing to register sound card
In former commits, .private_free callback releases resources just for data transmission. This release function can be called without the resources are actually allocated in error paths. This commit applies a small refactoring to clean up codes in error paths. Signed-off-by: Takashi Sakamoto <o-takashi@sakamocchi.jp> Signed-off-by: Takashi Iwai <tiwai@suse.de>
Diffstat (limited to 'sound/firewire/fireface/ff.c')
-rw-r--r--sound/firewire/fireface/ff.c15
1 files changed, 5 insertions, 10 deletions
diff --git a/sound/firewire/fireface/ff.c b/sound/firewire/fireface/ff.c
index 37866beeb160..3f61cfeace69 100644
--- a/sound/firewire/fireface/ff.c
+++ b/sound/firewire/fireface/ff.c
@@ -27,17 +27,14 @@ static void name_card(struct snd_ff *ff)
dev_name(&ff->unit->device), 100 << fw_dev->max_speed);
}
-static void ff_free(struct snd_ff *ff)
+static void ff_card_free(struct snd_card *card)
{
+ struct snd_ff *ff = card->private_data;
+
snd_ff_stream_destroy_duplex(ff);
snd_ff_transaction_unregister(ff);
}
-static void ff_card_free(struct snd_card *card)
-{
- ff_free(card->private_data);
-}
-
static void do_registration(struct work_struct *work)
{
struct snd_ff *ff = container_of(work, struct snd_ff, dwork.work);
@@ -50,6 +47,8 @@ static void do_registration(struct work_struct *work)
&ff->card);
if (err < 0)
return;
+ ff->card->private_free = ff_card_free;
+ ff->card->private_data = ff;
err = snd_ff_transaction_register(ff);
if (err < 0)
@@ -79,14 +78,10 @@ static void do_registration(struct work_struct *work)
if (err < 0)
goto error;
- ff->card->private_free = ff_card_free;
- ff->card->private_data = ff;
ff->registered = true;
return;
error:
- snd_ff_transaction_unregister(ff);
- snd_ff_stream_destroy_duplex(ff);
snd_card_free(ff->card);
dev_info(&ff->unit->device,
"Sound card registration failed: %d\n", err);