diff options
author | Takashi Sakamoto <o-takashi@sakamocchi.jp> | 2018-10-03 08:21:52 +0900 |
---|---|---|
committer | Takashi Iwai <tiwai@suse.de> | 2018-10-04 07:54:07 +0200 |
commit | 784fffbcfe117b508ff628cf296541ab70463140 (patch) | |
tree | 2be5c60a9548f5bddbca8789b09327814690317b /sound/firewire/fireworks | |
parent | a3aaf7d2bd388caea2bd0fba266b815ac708c49d (diff) |
ALSA: fireworks: use managed-resource to maintain response buffer
ALSA fireworks driver allocates memory object to handle response from
target unit. The object is used to initiate transaction unique to
Fireworks board module. This can be released as managed-resource
of 'struct snd_card.card_dev'.
This commit uses managed-resource of the sound card device for this
purpose.
Signed-off-by: Takashi Sakamoto <o-takashi@sakamocchi.jp>
Signed-off-by: Takashi Iwai <tiwai@suse.de>
Diffstat (limited to 'sound/firewire/fireworks')
-rw-r--r-- | sound/firewire/fireworks/fireworks.c | 9 |
1 files changed, 3 insertions, 6 deletions
diff --git a/sound/firewire/fireworks/fireworks.c b/sound/firewire/fireworks/fireworks.c index 2ff7b9cff9b0..f680e2f27806 100644 --- a/sound/firewire/fireworks/fireworks.c +++ b/sound/firewire/fireworks/fireworks.c @@ -189,8 +189,6 @@ static void efw_free(struct snd_efw *efw) snd_efw_stream_destroy_duplex(efw); snd_efw_transaction_remove_instance(efw); - kfree(efw->resp_buf); - mutex_destroy(&efw->mutex); fw_unit_put(efw->unit); } @@ -247,8 +245,9 @@ do_registration(struct work_struct *work) /* prepare response buffer */ snd_efw_resp_buf_size = clamp(snd_efw_resp_buf_size, SND_EFW_RESPONSE_MAXIMUM_BYTES, 4096U); - efw->resp_buf = kzalloc(snd_efw_resp_buf_size, GFP_KERNEL); - if (efw->resp_buf == NULL) { + efw->resp_buf = devm_kzalloc(&efw->card->card_dev, + snd_efw_resp_buf_size, GFP_KERNEL); + if (!efw->resp_buf) { err = -ENOMEM; goto error; } @@ -300,8 +299,6 @@ error: snd_efw_transaction_remove_instance(efw); snd_efw_stream_destroy_duplex(efw); snd_card_free(efw->card); - kfree(efw->resp_buf); - efw->resp_buf = NULL; dev_info(&efw->unit->device, "Sound card registration failed: %d\n", err); } |