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_via.c | |
parent | ALSA: usb-audio: add channel map support (diff) | |
download | linux-361dab3ec2c59044f420cdf232523cd4af4e833e.tar.xz linux-361dab3ec2c59044f420cdf232523cd4af4e833e.zip |
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_via.c')
-rw-r--r-- | sound/pci/hda/patch_via.c | 2 |
1 files changed, 1 insertions, 1 deletions
diff --git a/sound/pci/hda/patch_via.c b/sound/pci/hda/patch_via.c index 7ae5f85105e9..274644f6bd48 100644 --- a/sound/pci/hda/patch_via.c +++ b/sound/pci/hda/patch_via.c @@ -241,6 +241,7 @@ static struct via_spec * via_new_spec(struct hda_codec *codec) if (spec == NULL) return NULL; + snd_array_init(&spec->kctls, sizeof(struct snd_kcontrol_new), 32); mutex_init(&spec->config_mutex); codec->spec = spec; spec->codec = codec; @@ -387,7 +388,6 @@ static struct snd_kcontrol_new *__via_clone_ctl(struct via_spec *spec, { struct snd_kcontrol_new *knew; - snd_array_init(&spec->kctls, sizeof(*knew), 32); knew = snd_array_new(&spec->kctls); if (!knew) return NULL; |