]> git.karo-electronics.de Git - linux-beck.git/commitdiff
ALSA: hda: fix possible null dereference
authorSudip Mukherjee <sudipm.mukherjee@gmail.com>
Thu, 2 Apr 2015 11:21:43 +0000 (16:51 +0530)
committerTakashi Iwai <tiwai@suse.de>
Sat, 4 Apr 2015 12:32:16 +0000 (14:32 +0200)
we are dereferencing pcm first then checking pcm. instead now lets put
them in same if condition so that pcm is checked first.

Signed-off-by: Sudip Mukherjee <sudip@vectorindia.org>
Signed-off-by: Takashi Iwai <tiwai@suse.de>
sound/pci/hda/hda_codec.c

index 41851f9b48c1130229fd1d72a68a90a550334152..16dfa1ed10dd1d7fb7f8cb7946b633f165c8b70f 100644 (file)
@@ -3230,9 +3230,8 @@ static int add_std_chmaps(struct hda_codec *codec)
                        struct snd_pcm_chmap *chmap;
                        const struct snd_pcm_chmap_elem *elem;
 
-                       if (pcm->own_chmap)
-                               continue;
-                       if (!pcm || !hinfo->substreams)
+                       if (!pcm || pcm->own_chmap ||
+                           !hinfo->substreams)
                                continue;
                        elem = hinfo->chmap ? hinfo->chmap : snd_pcm_std_chmaps;
                        err = snd_pcm_add_chmap_ctls(pcm->pcm, str, elem,