Skip to contentSkip to conversation

ALSA: Handle NULL jacks in snd_jack_report()

PATCH Applied Mark Brown 2 participants 2 messages Oct 15, 2008 – Oct 16, 2008 Sound

lore
Share & tools
lore

Mark Brown

author
#0 lore raw

PATCH 1/1 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.

---
 sound/core/jack.c |    3 +++
 1 files changed, 3 insertions(+), 0 deletions(-)
sound/core/jack.c +3 -0
index 8133a2b..bd2d9e6 100644
@@ -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);
Signature · 1 line
1.5.6.5
Applied
#1 lore raw

At Wed, 15 Oct 2008 17:07:47 +0100,

Quoted 6 lines · Mark Brown

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.

Thanks, applied to topic/misc-fixes branch for the next pull request.

Takashi

Quoted 26 lines
---
 sound/core/jack.c |    3 +++
 1 files changed, 3 insertions(+), 0 deletions(-)
sound/core/jack.c +3 -0
index 8133a2b..bd2d9e6 100644
@@ -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);
Signature · 6 lines
1.5.6.5

_______________________________________________
Alsa-devel mailing list
[email protected]
http://mailman.alsa-project.org/mailman/listinfo/alsa-devel