summaryrefslogtreecommitdiffstats
path: root/sound/firewire
diff options
context:
space:
mode:
authorTakashi Sakamoto <o-takashi@sakamocchi.jp>2018-10-02 19:21:53 -0400
committerTakashi Iwai <tiwai@suse.de>2018-10-04 01:54:08 -0400
commit72bc8c4378f82307ff09f0959011fef2c818146d (patch)
tree0180c9dd0c405d634403229958031dfc34f0ec59 /sound/firewire
parent784fffbcfe117b508ff628cf296541ab70463140 (diff)
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: Takashi Sakamoto <o-takashi@sakamocchi.jp> Signed-off-by: Takashi Iwai <tiwai@suse.de>
Diffstat (limited to 'sound/firewire')
-rw-r--r--sound/firewire/oxfw/oxfw-scs1x.c5
-rw-r--r--sound/firewire/oxfw/oxfw-spkr.c5
-rw-r--r--sound/firewire/oxfw/oxfw.c3
3 files changed, 6 insertions, 7 deletions
diff --git a/sound/firewire/oxfw/oxfw-scs1x.c b/sound/firewire/oxfw/oxfw-scs1x.c
index f33497cdc706..9d9545880a28 100644
--- a/sound/firewire/oxfw/oxfw-scs1x.c
+++ b/sound/firewire/oxfw/oxfw-scs1x.c
@@ -372,8 +372,9 @@ int snd_oxfw_scs1x_add(struct snd_oxfw *oxfw)
372 struct fw_scs1x *scs; 372 struct fw_scs1x *scs;
373 int err; 373 int err;
374 374
375 scs = kzalloc(sizeof(struct fw_scs1x), GFP_KERNEL); 375 scs = devm_kzalloc(&oxfw->card->card_dev, sizeof(struct fw_scs1x),
376 if (scs == NULL) 376 GFP_KERNEL);
377 if (!scs)
377 return -ENOMEM; 378 return -ENOMEM;
378 scs->fw_dev = fw_parent_device(oxfw->unit); 379 scs->fw_dev = fw_parent_device(oxfw->unit);
379 oxfw->spec = scs; 380 oxfw->spec = scs;
diff --git a/sound/firewire/oxfw/oxfw-spkr.c b/sound/firewire/oxfw/oxfw-spkr.c
index cb905af0660d..66d4b1f73f0f 100644
--- a/sound/firewire/oxfw/oxfw-spkr.c
+++ b/sound/firewire/oxfw/oxfw-spkr.c
@@ -270,8 +270,9 @@ int snd_oxfw_add_spkr(struct snd_oxfw *oxfw, bool is_lacie)
270 unsigned int i, first_ch; 270 unsigned int i, first_ch;
271 int err; 271 int err;
272 272
273 spkr = kzalloc(sizeof(struct fw_spkr), GFP_KERNEL); 273 spkr = devm_kzalloc(&oxfw->card->card_dev, sizeof(struct fw_spkr),
274 if (spkr == NULL) 274 GFP_KERNEL);
275 if (!spkr)
275 return -ENOMEM; 276 return -ENOMEM;
276 oxfw->spec = spkr; 277 oxfw->spec = spkr;
277 278
diff --git a/sound/firewire/oxfw/oxfw.c b/sound/firewire/oxfw/oxfw.c
index b892a8642204..06d791acfdc5 100644
--- a/sound/firewire/oxfw/oxfw.c
+++ b/sound/firewire/oxfw/oxfw.c
@@ -126,7 +126,6 @@ static void oxfw_free(struct snd_oxfw *oxfw)
126 kfree(oxfw->rx_stream_formats[i]); 126 kfree(oxfw->rx_stream_formats[i]);
127 } 127 }
128 128
129 kfree(oxfw->spec);
130 mutex_destroy(&oxfw->mutex); 129 mutex_destroy(&oxfw->mutex);
131 fw_unit_put(oxfw->unit); 130 fw_unit_put(oxfw->unit);
132} 131}
@@ -276,8 +275,6 @@ error:
276 oxfw->rx_stream_formats[i] = NULL; 275 oxfw->rx_stream_formats[i] = NULL;
277 } 276 }
278 snd_card_free(oxfw->card); 277 snd_card_free(oxfw->card);
279 kfree(oxfw->spec);
280 oxfw->spec = NULL;
281 dev_info(&oxfw->unit->device, 278 dev_info(&oxfw->unit->device,
282 "Sound card registration failed: %d\n", err); 279 "Sound card registration failed: %d\n", err);
283} 280}