Commit 784fffbc authored by Takashi Sakamoto's avatar Takashi Sakamoto Committed by Takashi Iwai

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: default avatarTakashi Sakamoto <o-takashi@sakamocchi.jp>
Signed-off-by: default avatarTakashi Iwai <tiwai@suse.de>
parent a3aaf7d2
...@@ -189,8 +189,6 @@ static void efw_free(struct snd_efw *efw) ...@@ -189,8 +189,6 @@ static void efw_free(struct snd_efw *efw)
snd_efw_stream_destroy_duplex(efw); snd_efw_stream_destroy_duplex(efw);
snd_efw_transaction_remove_instance(efw); snd_efw_transaction_remove_instance(efw);
kfree(efw->resp_buf);
mutex_destroy(&efw->mutex); mutex_destroy(&efw->mutex);
fw_unit_put(efw->unit); fw_unit_put(efw->unit);
} }
...@@ -247,8 +245,9 @@ do_registration(struct work_struct *work) ...@@ -247,8 +245,9 @@ do_registration(struct work_struct *work)
/* prepare response buffer */ /* prepare response buffer */
snd_efw_resp_buf_size = clamp(snd_efw_resp_buf_size, snd_efw_resp_buf_size = clamp(snd_efw_resp_buf_size,
SND_EFW_RESPONSE_MAXIMUM_BYTES, 4096U); SND_EFW_RESPONSE_MAXIMUM_BYTES, 4096U);
efw->resp_buf = kzalloc(snd_efw_resp_buf_size, GFP_KERNEL); efw->resp_buf = devm_kzalloc(&efw->card->card_dev,
if (efw->resp_buf == NULL) { snd_efw_resp_buf_size, GFP_KERNEL);
if (!efw->resp_buf) {
err = -ENOMEM; err = -ENOMEM;
goto error; goto error;
} }
...@@ -300,8 +299,6 @@ do_registration(struct work_struct *work) ...@@ -300,8 +299,6 @@ do_registration(struct work_struct *work)
snd_efw_transaction_remove_instance(efw); snd_efw_transaction_remove_instance(efw);
snd_efw_stream_destroy_duplex(efw); snd_efw_stream_destroy_duplex(efw);
snd_card_free(efw->card); snd_card_free(efw->card);
kfree(efw->resp_buf);
efw->resp_buf = NULL;
dev_info(&efw->unit->device, dev_info(&efw->unit->device,
"Sound card registration failed: %d\n", err); "Sound card registration failed: %d\n", err);
} }
......
Markdown is supported
0%
or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment