]> www.pilppa.org Git - linux-2.6-omap-h63xx.git/blobdiff - sound/core/jack.c
Merge branch 'fix/hda' into topic/hda
[linux-2.6-omap-h63xx.git] / sound / core / jack.c
index c4bb9bad31331b0e4536a913fc7a67bdd0b3aaf8..284432f427f4b7c32a178a11329520e112dedbee 100644 (file)
@@ -34,6 +34,7 @@ static int snd_jack_dev_free(struct snd_device *device)
        else
                input_free_device(jack->input_dev);
 
+       kfree(jack->id);
        kfree(jack);
 
        return 0;
@@ -87,7 +88,7 @@ int snd_jack_new(struct snd_card *card, const char *id, int type,
        if (jack == NULL)
                return -ENOMEM;
 
-       jack->id = id;
+       jack->id = kstrdup(id, GFP_KERNEL);
 
        jack->input_dev = input_allocate_device();
        if (jack->input_dev == NULL) {
@@ -150,6 +151,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);