diff options
author | Takashi Iwai <tiwai@suse.de> | 2011-11-11 16:53:03 (GMT) |
---|---|---|
committer | Takashi Iwai <tiwai@suse.de> | 2011-11-16 10:14:04 (GMT) |
commit | cfc7c9d307b6a3557e333f960218d344d3a70ce7 (patch) | |
tree | 1da5dcddefe6720aa4385a239e02f737124a188b /sound/pci/hda/hda_jack.c | |
parent | d1cb620081f51c78cf95224efb593a886875078f (diff) | |
download | linux-fsl-qoriq-cfc7c9d307b6a3557e333f960218d344d3a70ce7.tar.xz |
ALSA: hda/jack - Fix NULL-dereference at probing
At probing time, the elements that aren't assigned to kctl or jack may
be called. Need proper NULL-checks.
Signed-off-by: Takashi Iwai <tiwai@suse.de>
Diffstat (limited to 'sound/pci/hda/hda_jack.c')
-rw-r--r-- | sound/pci/hda/hda_jack.c | 4 |
1 files changed, 3 insertions, 1 deletions
diff --git a/sound/pci/hda/hda_jack.c b/sound/pci/hda/hda_jack.c index eac002d..ef36cbb9 100644 --- a/sound/pci/hda/hda_jack.c +++ b/sound/pci/hda/hda_jack.c @@ -194,6 +194,8 @@ void snd_hda_jack_report_sync(struct hda_codec *codec) for (i = 0; i < codec->jacktbl.used; i++, jack++) if (jack->nid) { jack_detect_update(codec, jack); + if (!jack->kctl) + continue; state = get_jack_plug_state(jack->pin_sense); snd_kctl_jack_report(codec->bus->card, jack->kctl, state); } @@ -356,7 +358,7 @@ void snd_hda_input_jack_report(struct hda_codec *codec, hda_nid_t nid) unsigned int present; int type; - if (!jack) + if (!jack || !jack->jack) return; present = snd_hda_jack_detect(codec, nid); |