summaryrefslogtreecommitdiff
path: root/sound/core/jack.c
diff options
context:
space:
mode:
authorJie Yang <yang.jie@intel.com>2015-04-30 20:22:46 +0800
committerTakashi Iwai <tiwai@suse.de>2015-04-30 15:21:35 +0200
commit6ed9495e225605b7c4cd1544b87740e18ef43320 (patch)
tree9bcc9094a0fee4f68393bdd4848b79a0e8b9acdb /sound/core/jack.c
parent12e180a27f3e066a4ed4a446d428fd117f168beb (diff)
downloadlwn-6ed9495e225605b7c4cd1544b87740e18ef43320.tar.gz
lwn-6ed9495e225605b7c4cd1544b87740e18ef43320.zip
ALSA: jack: don't report input event for phantom jack
There is no input_dev for phantom jack, we should not report input event for it, otherwise, NULL pointer dereference error will occur. Fixes: 2ba2dfa1fcc7 ('ALSA: hda - Update to use the new jack kctls method') Signed-off-by: Jie Yang <yang.jie@intel.com> Signed-off-by: Takashi Iwai <tiwai@suse.de>
Diffstat (limited to 'sound/core/jack.c')
-rw-r--r--sound/core/jack.c11
1 files changed, 7 insertions, 4 deletions
diff --git a/sound/core/jack.c b/sound/core/jack.c
index e8b51f52e7df..0dbd618e3c94 100644
--- a/sound/core/jack.c
+++ b/sound/core/jack.c
@@ -339,6 +339,13 @@ void snd_jack_report(struct snd_jack *jack, int status)
if (!jack)
return;
+ list_for_each_entry(jack_kctl, &jack->kctl_list, list)
+ snd_kctl_jack_report(jack->card, jack_kctl->kctl,
+ status & jack_kctl->mask_bits);
+
+ if (!jack->input_dev)
+ return;
+
for (i = 0; i < ARRAY_SIZE(jack->key); i++) {
int testbit = SND_JACK_BTN_0 >> i;
@@ -357,10 +364,6 @@ void snd_jack_report(struct snd_jack *jack, int status)
input_sync(jack->input_dev);
- list_for_each_entry(jack_kctl, &jack->kctl_list, list)
- snd_kctl_jack_report(jack->card, jack_kctl->kctl,
- status & jack_kctl->mask_bits);
-
}
EXPORT_SYMBOL(snd_jack_report);