Commit 9a3f371e authored by Mark Brown's avatar Mark Brown Committed by Takashi Iwai

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: default avatarMark Brown <broonie@opensource.wolfsonmicro.com>
Signed-off-by: default avatarTakashi Iwai <tiwai@suse.de>
parent 428ffb71
...@@ -147,6 +147,9 @@ EXPORT_SYMBOL(snd_jack_set_parent); ...@@ -147,6 +147,9 @@ EXPORT_SYMBOL(snd_jack_set_parent);
*/ */
void snd_jack_report(struct snd_jack *jack, int status) void snd_jack_report(struct snd_jack *jack, int status)
{ {
if (!jack)
return;
if (jack->type & SND_JACK_HEADPHONE) if (jack->type & SND_JACK_HEADPHONE)
input_report_switch(jack->input_dev, SW_HEADPHONE_INSERT, input_report_switch(jack->input_dev, SW_HEADPHONE_INSERT,
status & SND_JACK_HEADPHONE); status & SND_JACK_HEADPHONE);
......
Markdown is supported
0%
or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment