aboutsummaryrefslogtreecommitdiffstats
path: root/sound/pci/hda/hda_codec.c
diff options
context:
space:
mode:
authorMengdong Lin <mengdong.lin@intel.com>2013-03-07 14:10:25 -0500
committerTakashi Iwai <tiwai@suse.de>2013-03-07 03:12:14 -0500
commit25336e8ae2d2fa64c9c4cc2c9c28f641134c9fa9 (patch)
tree3a3d8caab99e648f8875f5ec2becf58226d3fd29 /sound/pci/hda/hda_codec.c
parent9fedcc44f10d1e6820914f93a96d51bc7e653d98 (diff)
ALSA: hda - check NULL pointer when creating SPDIF controls
If the SPDIF control array cannot be reallocated, the function will return to avoid dereferencing a NULL pointer. Signed-off-by: Mengdong Lin <mengdong.lin@intel.com> Signed-off-by: Takashi Iwai <tiwai@suse.de>
Diffstat (limited to 'sound/pci/hda/hda_codec.c')
-rw-r--r--sound/pci/hda/hda_codec.c2
1 files changed, 2 insertions, 0 deletions
diff --git a/sound/pci/hda/hda_codec.c b/sound/pci/hda/hda_codec.c
index 04b57383e8cb..3dc656688c08 100644
--- a/sound/pci/hda/hda_codec.c
+++ b/sound/pci/hda/hda_codec.c
@@ -3334,6 +3334,8 @@ int snd_hda_create_dig_out_ctls(struct hda_codec *codec,
3334 return -EBUSY; 3334 return -EBUSY;
3335 } 3335 }
3336 spdif = snd_array_new(&codec->spdif_out); 3336 spdif = snd_array_new(&codec->spdif_out);
3337 if (!spdif)
3338 return -ENOMEM;
3337 for (dig_mix = dig_mixes; dig_mix->name; dig_mix++) { 3339 for (dig_mix = dig_mixes; dig_mix->name; dig_mix++) {
3338 kctl = snd_ctl_new1(dig_mix, codec); 3340 kctl = snd_ctl_new1(dig_mix, codec);
3339 if (!kctl) 3341 if (!kctl)