diff options
author | Takashi Sakamoto <o-takashi@sakamocchi.jp> | 2018-10-10 15:35:02 +0900 |
---|---|---|
committer | Takashi Iwai <tiwai@suse.de> | 2018-10-10 12:11:50 +0200 |
commit | 3babca4555b20fc80aff4776662fb237257d9afd (patch) | |
tree | 10a967c09572ade5f331a61eae58b7a92e2666eb /sound/firewire/digi00x | |
parent | 873608dc6b5da7a2571419bfa10e0d088d39cee0 (diff) | |
download | linux-3babca4555b20fc80aff4776662fb237257d9afd.tar.bz2 |
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/digi00x')
-rw-r--r-- | sound/firewire/digi00x/digi00x.c | 15 |
1 files changed, 5 insertions, 10 deletions
diff --git a/sound/firewire/digi00x/digi00x.c b/sound/firewire/digi00x/digi00x.c index 7a24348968b9..6c6ea149ef6b 100644 --- a/sound/firewire/digi00x/digi00x.c +++ b/sound/firewire/digi00x/digi00x.c @@ -41,17 +41,14 @@ static int name_card(struct snd_dg00x *dg00x) return 0; } -static void dg00x_free(struct snd_dg00x *dg00x) +static void dg00x_card_free(struct snd_card *card) { + struct snd_dg00x *dg00x = card->private_data; + snd_dg00x_stream_destroy_duplex(dg00x); snd_dg00x_transaction_unregister(dg00x); } -static void dg00x_card_free(struct snd_card *card) -{ - dg00x_free(card->private_data); -} - static void do_registration(struct work_struct *work) { struct snd_dg00x *dg00x = @@ -65,6 +62,8 @@ static void do_registration(struct work_struct *work) &dg00x->card); if (err < 0) return; + dg00x->card->private_free = dg00x_card_free; + dg00x->card->private_data = dg00x; err = name_card(dg00x); if (err < 0) @@ -96,14 +95,10 @@ static void do_registration(struct work_struct *work) if (err < 0) goto error; - dg00x->card->private_free = dg00x_card_free; - dg00x->card->private_data = dg00x; dg00x->registered = true; return; error: - snd_dg00x_transaction_unregister(dg00x); - snd_dg00x_stream_destroy_duplex(dg00x); snd_card_free(dg00x->card); dev_info(&dg00x->unit->device, "Sound card registration failed: %d\n", err); |