summaryrefslogtreecommitdiffstats
path: root/sound/core
diff options
context:
space:
mode:
authorTakashi Iwai <tiwai@suse.de>2015-04-30 15:31:43 +0200
committerTakashi Iwai <tiwai@suse.de>2015-04-30 15:31:43 +0200
commit3d716a0ad2e971cea46bb4393f9dfd7e76d883c6 (patch)
tree966492eb4036d8cc565333fe9cb361cb214d0b7b /sound/core
parentMerge branch 'topic/hda' into for-next (diff)
parentALSA: jack: Fix another NULL dereference due to empty input jack (diff)
downloadlinux-3d716a0ad2e971cea46bb4393f9dfd7e76d883c6.tar.xz
linux-3d716a0ad2e971cea46bb4393f9dfd7e76d883c6.zip
Merge branch 'topic/jack' into for-next
Diffstat (limited to 'sound/core')
-rw-r--r--sound/core/jack.c17
1 files changed, 13 insertions, 4 deletions
diff --git a/sound/core/jack.c b/sound/core/jack.c
index e8b51f52e7df..eb66327b5f1c 100644
--- a/sound/core/jack.c
+++ b/sound/core/jack.c
@@ -87,6 +87,10 @@ static int snd_jack_dev_register(struct snd_device *device)
snprintf(jack->name, sizeof(jack->name), "%s %s",
card->shortname, jack->id);
+
+ if (!jack->input_dev)
+ return 0;
+
jack->input_dev->name = jack->name;
/* Default to the sound card device. */
@@ -278,6 +282,8 @@ EXPORT_SYMBOL(snd_jack_new);
void snd_jack_set_parent(struct snd_jack *jack, struct device *parent)
{
WARN_ON(jack->registered);
+ if (!jack->input_dev)
+ return;
jack->input_dev->dev.parent = parent;
}
@@ -339,6 +345,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 +370,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);