diff options
author | Takashi Iwai <tiwai@suse.de> | 2012-05-09 14:35:27 +0200 |
---|---|---|
committer | Takashi Iwai <tiwai@suse.de> | 2012-11-28 09:03:39 +0100 |
commit | 361dab3ec2c59044f420cdf232523cd4af4e833e (patch) | |
tree | a15a6119c598e83bdb5ca45676907c6c0a3645cb /sound/pci/hda/patch_realtek.c | |
parent | 04324ccc75f96b3ed7aad1c866d1b7925e977bdf (diff) |
ALSA: hda - Call snd_array_init() early and only once
This is a preliminary patch for introducing a protection to access
races of snd_array instances. Call snd_array_init() appropriately
at the initialization time and don't call it twice.
Also the allocations of codec-spec structs are cleaned up by helper
functions in patch_sigmatel.c and patch_analog.c.
Signed-off-by: Takashi Iwai <tiwai@suse.de>
Diffstat (limited to 'sound/pci/hda/patch_realtek.c')
-rw-r--r-- | sound/pci/hda/patch_realtek.c | 4 |
1 files changed, 2 insertions, 2 deletions
diff --git a/sound/pci/hda/patch_realtek.c b/sound/pci/hda/patch_realtek.c index af068653380..c7369a6764e 100644 --- a/sound/pci/hda/patch_realtek.c +++ b/sound/pci/hda/patch_realtek.c @@ -905,7 +905,6 @@ static const struct snd_kcontrol_new alc_automute_mode_enum = { static struct snd_kcontrol_new *alc_kcontrol_new(struct alc_spec *spec) { - snd_array_init(&spec->kctls, sizeof(struct snd_kcontrol_new), 32); return snd_array_new(&spec->kctls); } @@ -3605,7 +3604,6 @@ static struct hda_bind_ctls *new_bind_ctl(struct hda_codec *codec, { struct alc_spec *spec = codec->spec; struct hda_bind_ctls **ctlp, *ctl; - snd_array_init(&spec->bind_ctls, sizeof(ctl), 8); ctlp = snd_array_new(&spec->bind_ctls); if (!ctlp) return NULL; @@ -4376,6 +4374,8 @@ static int alc_alloc_spec(struct hda_codec *codec, hda_nid_t mixer_nid) codec->spec = spec; spec->mixer_nid = mixer_nid; snd_hda_gen_init(&spec->gen); + snd_array_init(&spec->kctls, sizeof(struct snd_kcontrol_new), 32); + snd_array_init(&spec->bind_ctls, sizeof(struct hda_bind_ctls *), 8); err = alc_codec_rename_from_preset(codec); if (err < 0) { |