From: Mark Brown Date: Wed, 15 Oct 2008 16:07:47 +0000 (+0100) Subject: ALSA: Handle NULL jacks in snd_jack_report() X-Git-Tag: v2.6.28-rc1~260^2~1^4~1 X-Git-Url: http://pilppa.com/gitweb/?a=commitdiff_plain;h=9a3f371e9962749e5bdcf45a3bebdba555651a2b;p=linux-2.6-omap-h63xx.git ALSA: Handle NULL jacks in snd_jack_report() Facilitate drivers that wish to carry on if they can't create a jack input device by handling attempts to report the state of a NULL jack, removing the need to check for initialisation before use. Signed-off-by: Mark Brown Signed-off-by: Takashi Iwai --- diff --git a/sound/core/jack.c b/sound/core/jack.c index 8133a2b173a..bd2d9e6b55e 100644 --- a/sound/core/jack.c +++ b/sound/core/jack.c @@ -147,6 +147,9 @@ EXPORT_SYMBOL(snd_jack_set_parent); */ void snd_jack_report(struct snd_jack *jack, int status) { + if (!jack) + return; + if (jack->type & SND_JACK_HEADPHONE) input_report_switch(jack->input_dev, SW_HEADPHONE_INSERT, status & SND_JACK_HEADPHONE);