Commit 72bc8c43 authored by Takashi Sakamoto's avatar Takashi Sakamoto Committed by Takashi Iwai

ALSA: oxfw: use managed-resource to maintain model-specific data

ALSA oxfw driver allocates memory objects for data specific to some
models. These objects are used to maintain functionalities specific
to the models for ALSA rawMIDI/control interfaces. They 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 784fffbc
...@@ -372,8 +372,9 @@ int snd_oxfw_scs1x_add(struct snd_oxfw *oxfw) ...@@ -372,8 +372,9 @@ int snd_oxfw_scs1x_add(struct snd_oxfw *oxfw)
struct fw_scs1x *scs; struct fw_scs1x *scs;
int err; int err;
scs = kzalloc(sizeof(struct fw_scs1x), GFP_KERNEL); scs = devm_kzalloc(&oxfw->card->card_dev, sizeof(struct fw_scs1x),
if (scs == NULL) GFP_KERNEL);
if (!scs)
return -ENOMEM; return -ENOMEM;
scs->fw_dev = fw_parent_device(oxfw->unit); scs->fw_dev = fw_parent_device(oxfw->unit);
oxfw->spec = scs; oxfw->spec = scs;
......
...@@ -270,8 +270,9 @@ int snd_oxfw_add_spkr(struct snd_oxfw *oxfw, bool is_lacie) ...@@ -270,8 +270,9 @@ int snd_oxfw_add_spkr(struct snd_oxfw *oxfw, bool is_lacie)
unsigned int i, first_ch; unsigned int i, first_ch;
int err; int err;
spkr = kzalloc(sizeof(struct fw_spkr), GFP_KERNEL); spkr = devm_kzalloc(&oxfw->card->card_dev, sizeof(struct fw_spkr),
if (spkr == NULL) GFP_KERNEL);
if (!spkr)
return -ENOMEM; return -ENOMEM;
oxfw->spec = spkr; oxfw->spec = spkr;
......
...@@ -126,7 +126,6 @@ static void oxfw_free(struct snd_oxfw *oxfw) ...@@ -126,7 +126,6 @@ static void oxfw_free(struct snd_oxfw *oxfw)
kfree(oxfw->rx_stream_formats[i]); kfree(oxfw->rx_stream_formats[i]);
} }
kfree(oxfw->spec);
mutex_destroy(&oxfw->mutex); mutex_destroy(&oxfw->mutex);
fw_unit_put(oxfw->unit); fw_unit_put(oxfw->unit);
} }
...@@ -276,8 +275,6 @@ static void do_registration(struct work_struct *work) ...@@ -276,8 +275,6 @@ static void do_registration(struct work_struct *work)
oxfw->rx_stream_formats[i] = NULL; oxfw->rx_stream_formats[i] = NULL;
} }
snd_card_free(oxfw->card); snd_card_free(oxfw->card);
kfree(oxfw->spec);
oxfw->spec = NULL;
dev_info(&oxfw->unit->device, dev_info(&oxfw->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