summaryrefslogtreecommitdiffstats
path: root/sound/pci/hda/hda_codec.c
diff options
context:
space:
mode:
authorSudip Mukherjee <sudipm.mukherjee@gmail.com>2015-04-02 13:21:43 +0200
committerTakashi Iwai <tiwai@suse.de>2015-04-04 14:32:16 +0200
commit751e2216899cb143fe1d5909fe762870faa945f6 (patch)
treed69612e15878e09eef8498c414c27c360d422ad4 /sound/pci/hda/hda_codec.c
parentALSA: hda - Enable widget power saving for Realtek codecs (diff)
downloadlinux-751e2216899cb143fe1d5909fe762870faa945f6.tar.xz
linux-751e2216899cb143fe1d5909fe762870faa945f6.zip
ALSA: hda: fix possible null dereference
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>
Diffstat (limited to 'sound/pci/hda/hda_codec.c')
-rw-r--r--sound/pci/hda/hda_codec.c5
1 files changed, 2 insertions, 3 deletions
diff --git a/sound/pci/hda/hda_codec.c b/sound/pci/hda/hda_codec.c
index 41851f9b48c1..16dfa1ed10dd 100644
--- a/sound/pci/hda/hda_codec.c
+++ b/sound/pci/hda/hda_codec.c
@@ -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,