summaryrefslogtreecommitdiff
path: root/sound/core/jack.c
diff options
context:
space:
mode:
authorTakashi Iwai <tiwai@suse.de>2015-04-30 15:25:00 +0200
committerTakashi Iwai <tiwai@suse.de>2015-04-30 15:27:55 +0200
commit43b2cd547edcba4733bf21ea2b3f6600e3bdc514 (patch)
tree64e02d9117b5a9c43f039f91c415ff3ce0239e6a /sound/core/jack.c
parent6ed9495e225605b7c4cd1544b87740e18ef43320 (diff)
ALSA: jack: Fix another NULL dereference due to empty input jack
Another fixes for NULL jack->input_dev in some places in jack.c. Fixes: 2ba2dfa1fcc7 ('ALSA: hda - Update to use the new jack kctls method') Signed-off-by: Takashi Iwai <tiwai@suse.de>
Diffstat (limited to 'sound/core/jack.c')
-rw-r--r--sound/core/jack.c6
1 files changed, 6 insertions, 0 deletions
diff --git a/sound/core/jack.c b/sound/core/jack.c
index 0dbd618e3c94..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;
}